bug-gnulib
[Top][All Lists]
Advanced

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

Re: bootstrap symlink dependencies


From: Paul Eggert
Subject: Re: bootstrap symlink dependencies
Date: Mon, 16 May 2011 12:40:50 -0700
User-agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.17) Gecko/20110428 Fedora/3.1.10-1.fc14 Thunderbird/3.1.10

On 05/16/11 12:12, Eric Blake wrote:
> On the other hand, it only works with POSIX
> shells (Solaris /bin/sh doesn't understand the XSI notion of %% and ##).
> 

Another option might be something like this (untested)

lswords=`ls -1diL "$src" "$dst" 2>/dev/null` &&
inum= && \
for lsword in $lswords; do
  case $lsword in
    *[!0-9]*) ;;
    *) if test -z "$inum"; then
         inum=$lsword
       elif test $inum -ne $lsword; then
         inum=
         break
       fi ;;
  esac
done &&
test -n "$inum"

This uses just one fork+exec too, but it doesn't use the
XSI notion of %% and ##.  It can be fooled if "$src"
or "$dst" contains an integer surrounded by spaces, but
any such errors cause it to fail in a conservative way
(by doing needless remakes), and these errors should be
rare so that's not so bad.

It assumes [!0-9] works, though;
is that a safe assumption these days?



reply via email to

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