tramp-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Implementing file-attributes with "stat"?


From: Adrian Phillips
Subject: Re: Implementing file-attributes with "stat"?
Date: Tue, 26 Aug 2003 07:43:18 +0200
User-agent: Gnus/5.090016 (Oort Gnus v0.16) Emacs/21.2 (gnu/linux)

>>>>> "Kai" == Kai Gro├čjohann <address@hidden> writes:

[ New to list so first a thanks to Kai for tramp ]

    Kai> Tramp now uses a Perl implementation of file-attributes, if
    Kai> Perl is available on the remote host.  But I get the feeling
    Kai> it might be nice to use the "stat" program, if available.
    Kai> But I know nothing about it.  Does somebody know if stat can
    Kai> be used in a portable way such that it returns the data we
    Kai> need?

Doesn't look like it. Here is output from Irix and Linux stat :-

Irix # stat ~/.bashrc
/usr/people/metop/.bashrc:
        inode 79766431; dev 50331652; links 1; size 3020
        regular; mode is rw-r--r--; uid 805 (metop); gid 201 (sms)
        projid 0        st_fstype: xfs
        change time - Mon Aug 25 08:57:42 2003 <1061801862>
        access time - Tue Aug 26 05:34:00 2003 <1061876040>
        modify time - Fri May 30 05:47:36 2003 <1054273656>

Linux % stat ~/.bashrc
  File: "/metno/routine/metop/.bashrc"
  Size: 3020            Blocks: 8          IO Block: 8192   Regular File
Device: ah/10d  Inode: 79766431    Links: 1    
Access: (0644/-rw-r--r--)  Uid: (  805/   metop)   Gid: (  201/     sms)
Access: Tue Aug 26 05:34:00 2003
Modify: Fri May 30 05:47:36 2003
Change: Mon Aug 25 08:57:42 2003

And options :-

Irix # stat -?
Usage: stat [-idrlspjkugcamtqL] [-f fdesc] files ...
        inode, dev, rdev, links, size, perm, kind, user, grp
        ctime, atime, mtime, t = all times, q = quiet, L = lstat, j = project
        default is everything
        -f option takes file descriptor instead of filenames

Linux % stat -?
stat: invalid option -- ?
Usage: stat [-l] [-f] [-s] [-v] [-h] [-t] [-c format] file1 [file2 ...]


    Kai> (Type C-h f file-attributes RET for information on the data
    Kai> that's needed.  Some of it, such as the device number, can be
    Kai> faked without too much trouble.)

I think the various stats (Irix/Linux) have the info. required but I
didn't check exactly.

    Kai> I would be happy if you could do the Lisp part, but if you
    Kai> don't want to do that, it's also fine.  What I need is

Um, I could probably evetually hack something but with my level of
lisp it could take months :-)

    Kai> How portable is stat?  Does it behave similarly on all

It isn't - I noticed that Norbert Koch mentioned FreeBSD not having
it, AIX 4.x doesn't have it. If there were a GNU version it might be
easier to use that falling back to perl if it didn't exist.

At any rate, I can email you the man pages for Irix stat if you don't
have it (I'm assuming you have access to Linux stat),

Sincerely,

Adrian Phillips

-- 
Who really wrote the works of William Shakespeare ?
http://www.pbs.org/wgbh/pages/frontline/shakespeare/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]