automake-patches
[Top][All Lists]
Advanced

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

Re: [PATCH] tests: avoid one last `...` command substitution in 'test-in


From: Eric Blake
Subject: Re: [PATCH] tests: avoid one last `...` command substitution in 'test-init.sh'
Date: Fri, 22 Jun 2012 16:50:25 -0600
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:13.0) Gecko/20120605 Thunderbird/13.0

On 06/22/2012 04:28 PM, Stefano Lattarini wrote:

>>> -  # Guard against failure to spawn sed (seen on MSYS), or empty $argv0.
>>> -  me=`echo "$argv0" | sed -e 's,.*[\\/],,;s/\.sh$//;s/\.tap$//'` \
>>> -    && test -n "$me" \
>>> -    || { echo "$argv0: failed to define \$me" >&2; exit 99; }
>>> +  # Strip all directory components.
>>> +  me=${argv0##*/}
>>
>> Should this strip to the last [\\/] instead of /?
>>
> Hrm, right.  But then, is something like '${argv0##*[\\/]`' actually portable
> to all decent shells?  Not sure.

Neither am I.  Everything after ## is supposed to be a glob, and [\\/]
is a glob, so I would assume so, but this is probably a corner case
likely to trip up assumptions.

> the user, *on MinGW/MSYS or Cygwin* manually invokes a test as, say,
> 
>   $ .\\t\\foo.sh

In which case, they deserve their longer error message.

> Of course, I'm ready to revisit this position if there will be real reports
> from real users/developers; until then, I'd keep the simpler idiom above.  OK?

Simpler is fine by me; I was just pointing out that you had a change in
behavior, and wondering whether it was intentional (answer is yes, it was).

-- 
Eric Blake   address@hidden    +1-919-301-3266
Libvirt virtualization library http://libvirt.org



Attachment: signature.asc
Description: OpenPGP digital signature


reply via email to

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