bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [coreutils] Re: Builds of coreutils-8.6.19-1369f


From: Jim Meyering
Subject: Re: [coreutils] Re: Builds of coreutils-8.6.19-1369f
Date: Sat, 13 Nov 2010 11:02:53 +0100

Ralf Wildenhues wrote:
> * Jim Meyering wrote on Sun, Nov 07, 2010 at 12:22:13PM CET:
>> Ralf Wildenhues wrote:
>> > * Jim Meyering wrote on Sat, Nov 06, 2010 at 06:14:05PM CET:
>> >> Ralf Wildenhues wrote:
>> >> > - Posix does not require IFS to be set upon script startup.  It
>> >> > only requires
>> >> > that, if IFS is unset, word splitting ought to behave as if it were set 
>> >> > to
>> >> > space, tab, and newline, in that order.  That is why the
>> >> > startup code of all
>> >> > autotools scripts explicitly sets IFS, so that saving and restoring 
>> >> > works.
>> >>
>> >> Thanks.  That's good to know, but it appears not to be an issue
>> >> for any shell that gets past the init.sh tests.
>> >
>> > Are you sure?  It affects any test that saves and restores IFS in any
>> > way.
>
>> Do you know of a modern shell that acts as you describe?
>> I've run the following on a decent selection of systems,
>> and saw no failure:
>
> Some version of dash did that, IIRC.  A wild guess would
> be RH 6 (yes, quite a while ago, I haven't come across it
> again since).  Point is that Posix allows the behavior.
>
>> If some shell does fail, perhaps init.sh should use a patch like the 
>> following.
>> I hesitate to add code like this, unless there's at least one
>> known system where it makes a difference.
>
> The fix looks good to me.

Ok.  In spite of this being solely (as far as I know) to work
around such an old bug in dash, I've gone ahead:

>From 6383a3bbe16d3615791568c030fed5bfe86a4381 Mon Sep 17 00:00:00 2001
From: Jim Meyering <address@hidden>
Date: Sat, 13 Nov 2010 10:51:06 +0100
Subject: [PATCH] init.sh: ensure that IFS is defined, just in case...

* tests/init.sh (setup_): Ensure that IFS is defined,
so that saving and restoring it works as expected.  This
appears to be useful at least for an old version of dash
from a long time ago (RH 6).  See here for details:
http://thread.gmane.org/gmane.comp.gnu.coreutils.general/436/focus=455
---
 ChangeLog     |    7 +++++++
 tests/init.sh |    6 ++++++
 2 files changed, 13 insertions(+), 0 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 0c4a9fb..5656ded 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,12 @@
 2010-11-13  Jim Meyering  <address@hidden>

+       init.sh: ensure that IFS is defined, just in case...
+       * tests/init.sh (setup_): Ensure that IFS is defined,
+       so that saving and restoring it works as expected.  This
+       appears to be useful at least for an old version of dash
+       from a long time ago (RH 6).  See here for details:
+       http://thread.gmane.org/gmane.comp.gnu.coreutils.general/436/focus=455
+
        maint.mk: tighten "test a == b" check
        * top/maint.mk (sc_prohibit_test_double_equal): Restrict this
        test to files that contain something like #!/bin/sh.
diff --git a/tests/init.sh b/tests/init.sh
index a57de77..14f3b19 100644
--- a/tests/init.sh
+++ b/tests/init.sh
@@ -330,6 +330,12 @@ setup_()
     || fail_ "failed to create temporary directory in $initial_cwd_"
   cd "$test_dir_"

+  # As autoconf-generated configure scripts do, ensure that IFS
+  # is defined initially, so that saving and restoring $IFS works.
+  gl_init_sh_nl_='
+'
+  IFS=" ""     $gl_init_sh_nl_"
+
   # This trap statement, along with a trap on 0 below, ensure that the
   # temporary directory, $test_dir_, is removed upon exit as well as
   # upon receipt of any of the listed signals.
--
1.7.3.2.4.g60aa9



reply via email to

[Prev in Thread] Current Thread [Next in Thread]