[darcs-users] can we get rid of perl requirement in our test suite?
Trent W. Buck
trentbuck at gmail.com
Thu May 28 01:51:38 UTC 2009
Nathan Gray <kolibrie at graystudios.org> writes:
> On Tue, May 26, 2009 at 09:58:50PM +0100, Eric Kow wrote:
>> In case any Perl hackers want to help us translate this to shell, or
>> maybe Haskell if need be:
>>
>> # 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);
>
> Looks like that is comparing all similarly named files between
> two directories ($1 and $2) and determining if their inode numbers
> (the second element returned from lstat is the inode number) are
> the same.
Maybe all the test *really* needs to check is if the number of times the
inode is used isn't one (which indicates the EXISTENCE of hard linking).
$ touch x
$ ln x y
$ touch z
$ ls -l
total 0
-rw-r--r-- 2 twb twb 0 2009-05-28 11:50 x
-rw-r--r-- 2 twb twb 0 2009-05-28 11:50 y
-rw-r--r-- 1 twb twb 0 2009-05-28 11:50 z
More information about the darcs-users
mailing list