I've got some code for a backup program I've been writing in Python. It
runs well on CPython 2., CPython 3.1, and pypy 1.3.
I thought I'd try jython 2.5.2rc2 for fun, but I'm finding that it has no
os.fstat() function. I'm guessing this is related to java's historical
reluctance to enable things that aren't cross platform.
But without os.fstat, how does one eliminate the possibility of symlink
races when traversing a *ix filesystem? I thought you were supposed to
lstat, open and then fstat, to make sure the file hadn't changed.
I strace'd (on Ubuntu 10.10) a "jython -c" opening /etc/passwd, and saw that
shortly after the file was opened, there was an fstat on the same file
descriptor, even though my code wasn't explicitly fstat'ing. Does this mean
that java is smart enough to watch out for symlink races on its own, without
an fstat in my python code?
Either way, it might be really nice if jython could provide a bunch of
*ix-related functions, along the lines of: