unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
* bug in configure script
@ 2012-06-01 18:17 Jameson Graef Rollins
  2012-06-02 11:02 ` Tomi Ollila
  0 siblings, 1 reply; 3+ messages in thread
From: Jameson Graef Rollins @ 2012-06-01 18:17 UTC (permalink / raw)
  To: Notmuch Mail

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

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.  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.

[-- Attachment #2: Type: application/pgp-signature, Size: 835 bytes --]

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

* Re: bug in configure script
  2012-06-01 18:17 bug in configure script Jameson Graef Rollins
@ 2012-06-02 11:02 ` Tomi Ollila
  2012-06-02 18:23   ` Jameson Graef Rollins
  0 siblings, 1 reply; 3+ messages in thread
From: Tomi Ollila @ 2012-06-02 11:02 UTC (permalink / raw)
  To: Jameson Graef Rollins, Notmuch Mail

On Fri, Jun 01 2012, Jameson Graef Rollins <jrollins@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@notmuchmail.org
> http://notmuchmail.org/mailman/listinfo/notmuch

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

* Re: bug in configure script
  2012-06-02 11:02 ` Tomi Ollila
@ 2012-06-02 18:23   ` Jameson Graef Rollins
  0 siblings, 0 replies; 3+ messages in thread
From: Jameson Graef Rollins @ 2012-06-02 18:23 UTC (permalink / raw)
  To: Tomi Ollila, Notmuch Mail

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

On Sat, Jun 02 2012, Tomi Ollila <tomi.ollila@iki.fi> wrote:
> 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 think there must have been some copy/paste or transcription error
here?  FOO4 isn't something that you had previous set (or at least not
in what is shown).

In any event, it's clear from your second example that all we needed to
do was just quote the IFS when saving.  That fixed the problem for me,
so I submitted a patch.  I'm ashamed I didn't just see that solution
right off the bat.  Thanks for the inspiration, Tomi.

jamie.

[-- Attachment #2: Type: application/pgp-signature, Size: 835 bytes --]

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

end of thread, other threads:[~2012-06-02 18:23 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-06-01 18:17 bug in configure script Jameson Graef Rollins
2012-06-02 11:02 ` Tomi Ollila
2012-06-02 18:23   ` Jameson Graef Rollins

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).