bug in configure script

Tomi Ollila tomi.ollila at iki.fi
Sat Jun 2 04:02:57 PDT 2012


On Fri, Jun 01 2012, Jameson Graef Rollins <jrollins at finestructure.net> wrote:

> There's a bug in the configure script that is causing auto-reruns of
> ./configure to not inherit original command line options if there was
> more than one.  For instance, if I run:
>
> ./configure --with-gmime-version=2.4 --prefix=/home/jrollins/opt/notmuch
>
> Then in Makefile.config I get:
>
> configure_options = --with-gmime-version=2.4--prefix=/home/jrollins/opt/notmuch
>
> This means that auto-reruns of configure will not get the proper
> options.
>
> I tracked this down to an issue with IFS and /bin/sh.  The first line of
> ./configure is:
>
> readonly DEFAULT_IFS=$IFS
>
> DEFAULT_IFS is then used to reset IFS after it is modified within the
> script.  The problem is that /bin/sh is setting DEFAULT_IFS to be NULL
> (i.e. ''), which leads to no separation between variables when "$@" is
> expanded (which is itself problematic since I don't think "@" should use
> the IFS when expanded).  So this might be a bug in dash.  I don't know.
> In any event we need to fix this somehow.  

dash manual states that readonly name=value should work, but it seems
to have some side effects.

I tried some alternatives on command line:

$ readonly FOO1=$IFS
$ echo "$FOO1" | od -f x1
0000000 0a
0000001

$ readonly FOO2="$IFS" 
$ echo "$FOO2" | od -f x1
0000000 20 09 0a 0a
0000004

$ FOO3=$IFS
$ readonly FOO3
$ echo "$FOO4" | od -f x1
0000000 20 09 0a 0a
0000004

I.e. in dash 'readonly name=$value'  $value gets expanded like it was given 
in command line and not when just doing variable assignment.

Easiest is just to drop the 'readonly'; too bad it caused problems :(
(I have to go now -- but I'll make a patch later unless someone beats 
me by doing it sooner ;)

Tomi


> I see two obvious solutions:
>
> * use /bin/bash.  This a one line diff that fixes the problem
>   immediately.
>
> * replace:
>
>     IFS=$DEFAULT_IFS
>
>   with:
>
>     unset IFS
>
>   Unsetting IFS also resets IFS to the default, without going through
>   this intermediate step.
>
> I'm ok with either solution, but I'll wait for some feedback since I
> imagine someone will have an opinion.
>
> jamie.
> _______________________________________________
> notmuch mailing list
> notmuch at notmuchmail.org
> http://notmuchmail.org/mailman/listinfo/notmuch


More information about the notmuch mailing list