From: Donald Arseneau on
On Aug 5, 11:39 pm, "Donal K. Fellows"
<donal.k.fell...(a)manchester.ac.uk> wrote:
> Strictly, you can't even tell after normalization without using [file
> stat]

Ha! I just inserted that test in a script not one hour ago!

if ( (stat($destfile))[1] != (stat($tryfile))[1] ) {

Sorry, that script was in perl. I'll be banished now.

> because of hard links,

not that I really expected hard links, but that test seemed the
easiest to cover everything.

D
From: Donal K. Fellows on
On 11 Aug, 02:01, Donald Arseneau <a...(a)triumf.ca> wrote:
> Ha!  I just inserted that test in a script not one hour ago!
>
>  if ( (stat($destfile))[1] != (stat($tryfile))[1] ) {
>
> Sorry, that script was in perl.  I'll be banished now.

Well, inode numbers aren't guaranteed unique across different devices
either. You need to compare the device id too; the combination of the
'dev' and 'ino' fields from [file stat] is unique (to a single
machine; comparing across multiple machines is a different and much
tougher problem altogether).

Donal.
From: Andreas Leitgeb on
Donald Arseneau <asnd(a)triumf.ca> wrote:
> On Aug 5, 11:39 pm, "Donal K. Fellows"
><donal.k.fell...(a)manchester.ac.uk> wrote:
>> Strictly, you can't even tell after normalization without using [file
>> stat]
> Ha! I just inserted that test in a script not one hour ago!
> if ( (stat($destfile))[1] != (stat($tryfile))[1] ) {
> Sorry, that script was in perl. I'll be banished now.
>> because of hard links,
> not that I really expected hard links, but that test seemed the
> easiest to cover everything.

Each inode is only unique within it's containing filesystem.

In tcl, you should compare both "dev" and "ino" values from
[file stat]'s filled array.

In perl, I don't know where the dev is placed, and a small test
print stat("somefile");
just returned me one long digit string. (Luckily, I've finally
forgotten most of the perl I once knew)
Oh, wait, the first four digits seem to be the device, but that
might be coincidence, as well.

For another test, run your perl-script to compare / and /opt (assuming
they happen to be the roots of mounted filesystems, each)

From: Donald Arseneau on
On Aug 11, 1:56 am, Andreas Leitgeb <a...(a)gamma.logic.tuwien.ac.at>
wrote:
> Each inode is only unique within it's containing filesystem.

Right, thanks to you both.

> In perl, I don't know where the dev is placed, and a small test
>   print stat("somefile");
> just returned me one long digit string.

It returns an array (= Tcl list) but when you print an array
perl doesn't separate the elements by spaces :-(

> Oh, wait, the first four digits seem to be the device, but that
> might be coincidence, as well.

No coincidence -- the first two items are the device and inode.


From: Bruce on
Donald Arseneau wrote:
> On Aug 11, 1:56 am, Andreas Leitgeb <a...(a)gamma.logic.tuwien.ac.at>

>> In perl, I don't know where the dev is placed, and a small test
>> print stat("somefile");
>> just returned me one long digit string.
>
> It returns an array (= Tcl list) but when you print an array
> perl doesn't separate the elements by spaces :-(

cool - i can add another item to my "Why I hate perl" list ;)