[Top][All Lists]

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

Re: [FYI] {master} maint: assume 'test -x' is portable

From: Eric Blake
Subject: Re: [FYI] {master} maint: assume 'test -x' is portable
Date: Thu, 23 Feb 2012 16:25:54 -0700
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:10.0.1) Gecko/20120209 Thunderbird/10.0.1

On 02/23/2012 04:10 PM, Stefano Lattarini wrote:
> On 02/23/2012 11:49 PM, Harlan Stenn wrote:
>> Eric wrote:
>>> The autoconf manual still recommends:
>>> Do not use @samp{test -x}, because 4.3BSD does not
>>> have it.
>>> Is this still an issue?  Or should we be updating the autoconf manual?
>> I remember this biting me within the last ~4 years' time.
>> I don't know if it's still an issue or not, though, as we might have
>> places in our codebase where 'test -x' may have crept back in since
>> then.
>> If there is an easy way to test for it, I'd rather there was something
>> like an AC_SANITY macro that would test for these ancient cases and
>> squawk if the running system botched them.

Using the M4sh language of autoconf already has _AS_DETECT_BETTER_SHELL;
we've used it for sanity probes in the past, and doing a sanity probe
for a working 'test -x' and 'rm -f' now would be reasonable.

Question - should this still be advisory for autoconf 2.69 (probe, and
loudly complain about failures of the probe, but use the fallback
throughout the rest of the script) or mandatory (probe, and outright
refuse to continue if the system doesn't meet the bare minimums, so we
can simplify the rest of the script).

For 'test -x', that's usually a shell builtin; so we can require it of
the shell.  For 'rm -f', that's a separate executable, so I'm leaning
more towards a probe, and see what feedback we get, while still using
the workarounds for now.


> .. I was preparing a patch about this already, that also
> took care of removing the workaround for missing "test -x"
> in M4SH.

You took care of part of it,...

> +# This used to check whether `test -x' worked.  Today, this should be
> +# the case on all non-museum systems, so just assume it works.
> +# FIXME: this macro should probably be removed in a future refactoring.
>  m4_defun([_AS_TEST_PREPARE],
> -[if test -x / >/dev/null 2>&1; then
> -  as_test_x='test -x'
> -else
> -  if ls -dL / >/dev/null 2>&1; then
> -    as_ls_L_option=L
> -  else
> -    as_ls_L_option=
> -  fi
> -  as_test_x='
> -    eval sh -c '\''
> -      if test -d "$[]1"; then
> -     test -d "$[]1/.";
> -      else
> -     case $[]1 in @%:@(
> -     -*)set "./$[]1";;
> -     esac;
> -     case `ls -ld'$as_ls_L_option' "$[]1" 2>/dev/null` in @%:@((
> -     ???[[sx]]*):;;*)false;;esac;fi
> -    '\'' sh
> -  '
> -fi
> +[as_test_x='test -x'
>  dnl as_executable_p is present for backward compatibility with Libtool
>  dnl 1.5.22, but it should go away at some point.
>  as_executable_p=$as_test_x

We still have to set as_test_x for libtool; but I'm thinking we should
go one step further, and rewrite AS_TEST_X to just blindly call 'test
-x' rather than '$as_test_x', if we go with the minimum shell requirement.

Eric Blake   address@hidden    +1-919-301-3266
Libvirt virtualization library

Attachment: signature.asc
Description: OpenPGP digital signature

reply via email to

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