[Top][All Lists]
[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: |
Sun, 07 Nov 2010 12:22:13 +0100 |
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.
No, but it looks that way.
When the new FreeBSD 8.1 /bin/sh "local" issue makes it so IFS is
not restored, coreutils gets numerous failures.
I've never seen that before.
It looks like both of the other IFS-restoring coreutils tests would
fail if IFS restoration failed.
$ git grep -w IFS|grep -E 'old|save'
old/fileutils/ChangeLog: * tests/mkdir/perm: Don't put a newline\
in IFS; that's not portable to
tests/chmod/usage:old_IFS=$IFS
tests/chmod/usage: IFS=$old_IFS
tests/init.cfg: local saved_IFS="$IFS"
tests/init.cfg: IFS=$saved_IFS
tests/mkdir/perm: old_IFS=$IFS
tests/mkdir/perm: IFS=$old_IFS
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:
for sh in sh bash ksh pdksh dash zsh; do
type $sh > /dev/null || continue;
$sh -c 'i=$IFS; test -n "$IFS"' || echo fail
done
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.
diff --git a/tests/init.sh b/tests/init.sh
index a57de77..a37d129 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.