[Top][All Lists]

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

autoconf test for `ls -t` doesn't account for envar QUOTING_STYLE

From: Cathy Garrett
Subject: autoconf test for `ls -t` doesn't account for envar QUOTING_STYLE
Date: Tue, 23 Oct 2018 23:12:00 -0400
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.2.1

I've found a bug in autoconf related to the ls command's environment

By having QUOTING_STYLE=c in my environment, the following stanza fails.

### BEGIN ./configure stanza

# Do 'set' in a subshell so we don't clobber the current shell's
# arguments.  Must try -L first in case configure is actually a
# symlink; some systems play weird games with the mod time of symlinks
# (eg FreeBSD returns the mod time of the symlink's containing
# directory).
if (
   for am_try in 1 2; do
     echo "timestamp, slept: $am_has_slept" > conftest.file
     set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null`
     if test "$*" = "X"; then
        # -L didn't work.
        set X `ls -t "$srcdir/configure" conftest.file`
     if test "$*" != "X $srcdir/configure conftest.file" \
        && test "$*" != "X conftest.file $srcdir/configure"; then

        # If neither matched, then we have a broken ls.  This can happen
        # if, for instance, CONFIG_SHELL is bash and it inherits a
        # broken ls alias from the environment.  This has actually
        # happened.  Such a system could not be considered "sane".
        as_fn_error $? "ls -t appears to fail.  Make sure there is not a
  alias in your environment" "$LINENO" 5
     if test "$2" = conftest.file || test $am_try -eq 2; then
     # Just in case.
     sleep 1
   test "$2" = conftest.file
   # Ok.
   as_fn_error $? "newly created file is older than distributed files!
Check your system clock" "$LINENO" 5
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
$as_echo "yes" >&6; }
# If we didn't sleep, we still need to ensure time stamps of
config.status and
# generated files are strictly newer.
if grep 'slept: no' conftest.file >/dev/null 2>&1; then
  ( sleep 1 ) &

rm -f conftest.file

### END ./configure stanza

The reason for the failure is in the code

if test "$*" != "X $srcdir/configure conftest.file" \
        && test "$*" != "X conftest.file $srcdir/configure"; then

My ls is not aliased, but because of my use of the envar QUOTING_STYLE,
it makes $* look like this:

X "./configure" "conftest.file"


X "conftest.file" "./configure"

both of which fail the test.

Setting QUOTING_STYLE to an empty string causes ls to wig out in stderr
on each invocation, but it passes all of the tests for the two AUR
packages I was using it on, librelp and pcaudiolib. Within the above
stanza, QUOTING_STYLE needs to be accounted for to prevent this stanza
from failing incorrectly.

Relevant software versions follow:
ls (GNU coreutils) 8.30
autoconf (GNU Autoconf) 2.69
automake (GNU automake) 1.16.1
autogen (GNU AutoGen) 5.18.12
libtool (GNU libtool)
Pacman v5.1.1 - libalpm v11.0.1
aurman :: 2.18-1

Cathy Garrett

reply via email to

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