Stefan Monnier writes:
 > Kai Großjohann <[EMAIL PROTECTED]> writes:
 > > If the two files are on the same host (and user and method), we
 > > just use `test -nt' or its replacement.  If the two files are on
 > > different hosts, we try to find out the mtime of both files,
 > > which may or may not succeed, depending on whether we have Perl
 > > on the hosts in question.  If we can't do that, we punt.  But
 > > what does punting mean in this case?  Use `error'?  Signal a
 > > file-error?  I don't know.
 > 
 > I wouldn't worry too much about it and just raise a file-error.
 > After all, most if not all the calls to file-newer-than-file-p are
 > done for two files in the same directory (like .el and .elc kind of
 > things).
 > The only exception is probably backup files if you use a "backup
 > directory".  And it's not like you can do much better than raising
 > an error anyway.

Another stumbling block across different machines is that their clocks
may not be synchronized.


If however you do want to do things with remote mtimes, may I suggest
an alternative to perl.  To find out the stats of foo

    echo foo | cpio -oc 2>/dev/null | awk NR==1

and then use Lisp to decode the line.  Several older systems do not
have perl but echo, cpio, and awk should be present.  There are
variants of cpio but AFAIK the above should start with one of three
magic strings: "070701", "070702", "070707".   If anyone fancies
playing with that, the line as far as the filename has one of these
two formats.

    "070707" - first 76 characters, fields are octal.
        magic[6], dev[6], ino[6], mode[6], uid[6], gid[6], nlink[6],
        rdev[6], mtime[11], namesz[6], filesz[11]

    "070701", "070702" - first 110 characters, fields are hex.
        magic[6], ino[8], mode[8], uid[8], gid[8], nlink[8], mtime[8],
        filesize[8], maj[8], min[8], rmaj[8], rmin[8], namesize[8],
        chksum[8]

If foo is a symlink you may wish to resolve that first.  One
possibility might be to replace the "echo foo |" with

    /bin/ls -ld foo | awk '{print $NF}' |

Or maybe we've found out the true filename already.
-- 
Pete Forman              | Disclaimer: This posting is originated by
Western Geophysical      | myself and does not represent the opinion
[EMAIL PROTECTED]  | of Baker Hughes or its divisions.

Reply via email to