Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
PerlMonks  

Re^3: Any way to determine path being monitored with Win32::ChangeNotify?

by Discipulus (Canon)
on Nov 13, 2014 at 09:06 UTC ( [id://1107075]=note: print w/replies, xml ) Need Help??


in reply to Re^2: Any way to determine path being monitored with Win32::ChangeNotify?
in thread Anyway to determine path being monitored with Win32::ChangeNotify?

Hello i'm baffled too (but learned new word: baffled) because i knew inode was always 0 on windows.. but effectively the version suggested by Athanasius, ie gnuwin32 return some number while unxutils return 0.
>touch test.txt > > >which ls.exe >C:\various_stuffs\bin\UnxUtils\usr\local\wbin\ls.exe > >ls -il test.txt 0 -rw-rw-rw- 1 user group 0 Nov 13 09:57 test.tx +t >C:\some_path\GnuWin32\bin\ls.exe -il test.txt >3377699722053632 -rw-rw-rw- 1 lt 0 0 2014-11-13 09:57 test.txt >

Can someone tell us if we can use reliably this inode number?

Thanks
L*
There are no rules, there are no thumbs..
Reinvent the wheel, then learn The Wheel; may be one day you reinvent one of THE WHEELS.

Replies are listed 'Best First'.
Re^4: Any way to determine path being monitored with Win32::ChangeNotify?
by soonix (Canon) on Nov 13, 2014 at 09:19 UTC
Re^4: Any way to determine path being monitored with Win32::ChangeNotify?
by BrowserUk (Patriarch) on Nov 13, 2014 at 09:46 UTC
    but effectively the version suggested by Athanasius, ie gnuwin32 return some number

    Hm. I've spent an hour going through the ls.c trying to work out what that number might be, but I've failed to find anything that looks a likely source.

    One thing I do know is that it isn't a true inode number, cos they simply do not exist!.

    Which can only mean that they are making it up, though I can't see where.

    I also cannot think of any reliable way to do so. If the based it upon some kind of hashing of the other stat/lstat information, it would change everytime the file was read/written/changed/renamed/....

    Is the number consistent between runs of the gnuwin/ls executable?


    With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
    Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
    "Science is about questioning the status quo. Questioning authority".
    In the absence of evidence, opinion is indistinguishable from prejudice.
      Thanks for your effort. I remember too that inodes simply does not exists on win. Can that number be something derived from Master File Table? i'm guessing only.
      Anyway the number are consistent, more: they are consistent even for hard links, and using stat (maybe next hour inspecting stat.c ;=)..):
      >touch test02.txt >C:\SCRIPTS\GnuWin32-bis\bin\ls.exe -il test02.txt 12666373953464529 -rw-rw-rw- 1 lt 0 0 2014-11-13 11:26 test02.txt >C:\SCRIPTS\GnuWin32-bis\bin\ln test02.txt link-to-test02.txt >C:\SCRIPTS\GnuWin32-bis\bin\ls.exe -il test02.txt link-to-test02.txt 12666373953464529 -rw-rw-rw- 2 lt 0 0 2014-11-13 11:26 link-to-test02 +.txt 12666373953464529 -rw-rw-rw- 2 lt 0 0 2014-11-13 11:26 test02.txt >echo Perl > test02.txt >cat test02.txt Perl >cat link-to-test02.txt Perl >C:\SCRIPTS\GnuWin32-bis\bin\ls.exe -il test02.txt link-to-test02.txt 12666373953464529 -rw-rw-rw- 2 lt 0 7 2014-11-13 11:28 link-to-test02 +.txt 12666373953464529 -rw-rw-rw- 2 lt 0 7 2014-11-13 11:28 test02.txt >C:\SCRIPTS\GnuWin32-bis\bin\stat -c "%i %N" test02.txt 12666373953464529 `test02.txt' >C:\SCRIPTS\GnuWin32-bis\bin\stat -c "%i %N\n" link-to-test02.txt 12666373953464529 `link-to-test02.txt'

      L*
      UPDATE: they state explicitely here:
      st_ino Number of the information node (the inode) for the file (UNIX-specific). On UNIX file systems, the inode describes the file date and time stamps, permissions, and content. When files are hard-linked to one another, they share the same inode. The inode, and therefore st_ino, has no meaning in the FAT, HPFS, or NTFS file systems.

      L*
      UPDATE BIS:
      C:\Windows\system32>fsutil file queryfileid c:\SCRIPTS\test02.txt ID del file: 0x002d00000016a8d1 C:\Windows\system32>fsutil file queryfilenamebyid c:\ 0x002d00000016a +8d1 Nome collegamento causale al file: \\?\C:\SCRIPTS\test02.txt #0x002d00000016a8d1 hex is equal to 12666373953464529 dec (the same nu +mber as above!!!)

      L*
      There are no rules, there are no thumbs..
      Reinvent the wheel, then learn The Wheel; may be one day you reinvent one of THE WHEELS.
        MSDN says about FileID of GetFileInformationByHandle:
        The file identifier and the volume serial number uniquely identify a file on a single computer. To determine whether two open handles represent the same file, combine the identifier and the volume serial number for each file and compare them.
        So, it should be possible to simulate inodes on Win32, at least for systemscompilers where ints are big enough and/or someone has taken care that all variables holding inodes have a suitable size.
        (the same number as above!!!)

        It looks like it should be reliable then.

        But I think I must have the wrong source code (http://switch.dl.sourceforge.net/project/gnuwin32/coreutils/5.3.0/coreutils-5.3.0-src.zip), cos I'm damned if I can find anything that looks like it uses anything other that stat?


        With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
        Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
        "Science is about questioning the status quo. Questioning authority".
        In the absence of evidence, opinion is indistinguishable from prejudice.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others learning in the Monastery: (3)
As of 2024-03-29 04:45 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found