unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
* [PATCH] configure: disallow whitespace in paths, extend checks to $PWD
@ 2019-09-01 20:09 Tomi Ollila
  2019-09-11 20:21 ` Daniel Kahn Gillmor
  2019-09-11 21:57 ` David Bremner
  0 siblings, 2 replies; 3+ messages in thread
From: Tomi Ollila @ 2019-09-01 20:09 UTC (permalink / raw)
  To: notmuch; +Cc: tomi.ollila

Whitespace in $NOTMUCH_SRCDIR (and $PWD) may work in builds,
but definitely will not work in tests. It would be difficult
to make tests support whitespace in test filename paths -- and
fragile to maintain if done.

So it is just easier and safer to disallow whitespace there.

In case of out of tree build $NOTMUCH_SRCDIR differs from $PWD
(current directory). Extend this whitespace, and also previously
made unsafe characters check to $PWD too.
---

Tried to make test work w/ $IFS characters in paths. Not trivial
since there are variables like $NOTMUCH_TESTS which split to separate
filenames on SPC. Got an idea to set IFS=$'\n' and use newline as
separator -- but then many other places where arg splitting on SPC
is used would fail. There would be ways but making it work would
just make developers' work harder...

 configure | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/configure b/configure
index ef81e71b..3c148e12 100755
--- a/configure
+++ b/configure
@@ -31,6 +31,22 @@ case $NOTMUCH_SRCDIR in ( *\'* | *['\"`$']* )
 	exit 1
 esac
 
+case $PWD in ( *\'* | *['\"`$']* )
+	echo "Definitely unsafe characters in current directory '$PWD'".
+	exit 1
+esac
+
+# In case of whitespace, builds may work, tests definitely will not.
+case $NOTMUCH_SRCDIR in ( *["$IFS"]* )
+	echo "Whitespace in source path '$NOTMUCH_SRCDIR' not supported".
+	exit 1
+esac
+
+case $PWD in ( *["$IFS"]* )
+	echo "Whitespace in current directory '$PWD' not supported".
+	exit 1
+esac
+
 subdirs="util compat lib parse-time-string completion doc emacs"
 subdirs="${subdirs} performance-test test test/test-databases"
 subdirs="${subdirs} bindings"
-- 
2.21.0

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] configure: disallow whitespace in paths, extend checks to $PWD
  2019-09-01 20:09 [PATCH] configure: disallow whitespace in paths, extend checks to $PWD Tomi Ollila
@ 2019-09-11 20:21 ` Daniel Kahn Gillmor
  2019-09-11 21:57 ` David Bremner
  1 sibling, 0 replies; 3+ messages in thread
From: Daniel Kahn Gillmor @ 2019-09-11 20:21 UTC (permalink / raw)
  To: Tomi Ollila, notmuch

[-- Attachment #1: Type: text/plain, Size: 819 bytes --]

On Sun 2019-09-01 23:09:46 +0300, Tomi Ollila wrote:
> Whitespace in $NOTMUCH_SRCDIR (and $PWD) may work in builds,
> but definitely will not work in tests. It would be difficult
> to make tests support whitespace in test filename paths -- and
> fragile to maintain if done.
>
> So it is just easier and safer to disallow whitespace there.
>
> In case of out of tree build $NOTMUCH_SRCDIR differs from $PWD
> (current directory). Extend this whitespace, and also previously
> made unsafe characters check to $PWD too.

This is a sad constraint to have, but i understand it and i think Tomi's
patch is both a sensible guard, and a realistic acknowledgement of the
state of play today.  If someone wants to fix it (which would be great),
they can remove these checks when they fix it.

LGTM, please merge.

        --dkg

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 227 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] configure: disallow whitespace in paths, extend checks to $PWD
  2019-09-01 20:09 [PATCH] configure: disallow whitespace in paths, extend checks to $PWD Tomi Ollila
  2019-09-11 20:21 ` Daniel Kahn Gillmor
@ 2019-09-11 21:57 ` David Bremner
  1 sibling, 0 replies; 3+ messages in thread
From: David Bremner @ 2019-09-11 21:57 UTC (permalink / raw)
  To: Tomi Ollila, notmuch; +Cc: tomi.ollila

Tomi Ollila <tomi.ollila@iki.fi> writes:

> Whitespace in $NOTMUCH_SRCDIR (and $PWD) may work in builds,
> but definitely will not work in tests. It would be difficult
> to make tests support whitespace in test filename paths -- and
> fragile to maintain if done.
>
> So it is just easier and safer to disallow whitespace there.
>
> In case of out of tree build $NOTMUCH_SRCDIR differs from $PWD
> (current directory). Extend this whitespace, and also previously
> made unsafe characters check to $PWD too.

pushed,

d

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2019-09-11 21:57 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-09-01 20:09 [PATCH] configure: disallow whitespace in paths, extend checks to $PWD Tomi Ollila
2019-09-11 20:21 ` Daniel Kahn Gillmor
2019-09-11 21:57 ` David Bremner

Code repositories for project(s) associated with this public inbox

	https://yhetil.org/notmuch.git/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).