Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling
 
PerlMonks  

Re: Portable way to determine if two names refer to the same file?

by Anonymous Monk
on Aug 19, 2019 at 00:14 UTC ( [id://11104669]=note: print w/replies, xml ) Need Help??


in reply to Portable way to determine if two names refer to the same file?

If one considers some of the filesystems that are now available in support of containers, and maybe even network filesystems such as NFS, a test of inodes will not work. I am not sure that there exists a 100%-certain way to do this that will work everywhere.
  • Comment on Re: Portable way to determine if two names refer to the same file?

Replies are listed 'Best First'.
Re^2: Portable way to determine if two names refer to the same file?
by jcb (Parson) on Aug 19, 2019 at 00:55 UTC

    If the system claims POSIX conformance and testing dev:ino is unreliable, the system is defective:

    The st_ino and st_dev fields taken together uniquely identify the file within the system.
    Note that st_dev must be unique within a Local Area Network (LAN) in a ``system'' made up of multiple computers' file systems connected by a LAN.
    Networked implementations of a POSIX-conforming system must guarantee that all files visible within the file tree (including parts of the tree that may be remotely mounted from other machines on the network) on each individual processor are uniquely identified by the combination of the st_ino and st_dev fields.
    — Above quotes from https://pubs.opengroup.org/onlinepubs/009695399/basedefs/sys/stat.h.html

    I would be very surprised if traditional Unix did not provide this guarantee, so I am fairly sure that all current "unix" platforms will meet it. If some container tool causes this to be violated, that tool is defective, end of story. There is a very strong expectation that modern "*nix" means POSIX.

Re^2: Portable way to determine if two names refer to the same file?
by afoken (Chancellor) on Aug 19, 2019 at 06:14 UTC
Re^2: Portable way to determine if two names refer to the same file?
by Anonymous Monk on Aug 20, 2019 at 14:45 UTC

    You know this based on personal experience? You wrote a program which attempted to test equality of files using inodes and found that the test doesn't work when one or more of the files are remote?

    Didn't think so.

    So you're basing it on other research you've read, where someone else did that test? Can you link us to at least one such research report?

    Didn't think so.

    As usual.... you are full of hot air.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://11104669]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others surveying the Monastery: (4)
As of 2024-04-25 12:37 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found