coreutils
[Top][All Lists]
Advanced

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

Re: factor tests: ugly long file names


From: Stefano Lattarini
Subject: Re: factor tests: ugly long file names
Date: Sat, 27 Oct 2012 11:25:41 +0200

Hi Jim.

On 10/27/2012 11:14 AM, Jim Meyering wrote:
> Stefano Lattarini wrote:
>>>> You can save a fork by avoiding a call to basename:
>>>>
>>>>     t=${testname##*/}
>>>
>>> Good point. I wasn't sure if that syntax is portable.
>>> I know it from old dtksh days.
>>>
>> It is portable to any decent POSIX shell.  And I think Coreutils assumes
>> that one is available on the build system.  But then, to ensure such a
>> shell is actually used, you'll have to invoke your script explicitly with
>> the configure-determined $(SHELL) from the make recipe below (thank you
>> Solaris for keeping an old non-POSIX shell as /bin/sh, sigh).
>>
>> Jim, can you confirm it's OK to assume that $(SHELL) points to a POSIX
>> shell in the coreutils build system?
> 
> It's even better than that.
> coreutils (via init.sh) guarantees that the shell
> used to invoke tests accepts $(...) syntax, so we don't
> have to use the anachronistic `...`.
>
Ah, but it seems to me that 'tests/factor/create-test.sh' doesn't
use 'tests/init.sh' -- nor I'm sure it can, being 'tests/init.sh'
designed to be sourced only by test scripts :-(

It would be really nice if Autoconf 2.70 would finally ensure that
the $SHELL it sets is a true POSIX shell ...  See also:
<http://lists.gnu.org/archive/html/bug-autoconf/2012-06/msg00009.html>

> It appears that every shell meeting the above criteria also
> supports ${var##X}, ${var#X}, ${var%%X}, etc. substitution,
> since this use has been in a test since 2007:
> 
>     symlink_loop_msg=${readlink_msg#'readlink: p/1: '}
> 
> init.sh explicitly requires ${var#X} support and a couple
> other shell features when $(EXEEXT) is nonempty, but I doubt
> you're building on mingw.
> 
> So, yes, it is safe to use that syntax in coreutils tests/ scripts.
>
Is this true even in light of my observation above?

Thanks,
  Stefano



reply via email to

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