[darcs-users] can we get rid of perl requirement in our test suite?

Steve Gardner steve.gardner at solitonit.com
Wed May 27 08:55:37 UTC 2009


Eric Kow wrote:
> On Wed, May 27, 2009 at 11:15:03 +1000, Trent W. Buck wrote:
>   
>>> # succeeds if there are hard links
>>> use File::Basename;
>>> $res=0;
>>> while ($fn=<'$1'/*>) {
>>>   $fn2="'$2'/" . basename($fn);
>>>   @fd1=lstat($fn);
>>>   @fd2=lstat($fn2);
>>>   $res += ($fd1[1] != $fd2[1]);
>>> };
>>> exit($res);
>>>
>>> Ideas? Surely something like ls -l should help us do what we want?
>>>       
>> It is always wrong to use ls(1) output programmatically.
>> http://mywiki.wooledge.org/ParsingLs
>>
>> If we're lucky, stat(1) is part of POSIX.
>>     
>
> If we're not lucky, how about a small wrapper around the Haskell
> System.Posix.getFileStatus?  It may also wind up being useful for
> other scripts.
>
> In case anybody is wondering, I believe the prize is making it easier
> for Windows users to run the test suite: fewer requirements.
>
>   
On Windows, stat(1) isn't available in MSYS 1.0.10 but "test file1 -ef 
file2" is. Unfortunately the POSIX.1-2008 page for "test" ([1]) doesn't 
require implementations to support it, despite giving it a mention near 
the end of the "Rationale" section.

  [1] http://www.opengroup.org/onlinepubs/9699919799/utilities/test.html

Best regards

Steve Gardner


More information about the darcs-users mailing list