bug-coreutils
[Top][All Lists]
Advanced

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

bug#6555: stat enhancement


From: Pádraig Brady
Subject: bug#6555: stat enhancement
Date: Thu, 19 Aug 2010 16:51:48 +0100
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.1.8) Gecko/20100227 Thunderbird/3.0.3

On 19/08/10 16:24, Jim Meyering wrote:
> Pádraig Brady wrote:
>> On 13/08/10 04:01, A Burgie wrote:
>>> I have received confirmation of the completion of my exciting
>>> paperwork.  I can send the PDF for proof but at this point all of the
>>> legal stuff should be handled.
>>
>> I updated the patch further, adding a test,
>> and fixing a small mem leak in print_stat().
>> However I'm wary about pushing as I'm worried
>> about bypassing most of the logic from df::show_point().
>> I.E. do we lose anything by not using read_file_system_list()?
> 
> Hi Pádraig and Aaron,
> That patch looks fine.  Thanks to both of you!
> 
> I noticed that there is a semantic difference with df.  Running
> "df symlink-to-dir" works like "df dir", while "stat --format=%m
> symlink-to-dir" operates on the symlink, not on the directory.  That does
> seem to be the proper default, given stat's --dereference (-L) option
> (which I confirmed does work fine).
> 
> It might be worth adding a note in the texinfo doc that people looking
> for df-like semantics from %m should use --dereference (-L).

I also noticed differences with /dev/nodes.
That's probably ok though, but would need to be documented:

$ stat -c%m /dev/sda3
/dev
$ df -P /dev/sda3 | sed -n '1!s/.* \([^ ]*$\)/\1/p'
/boot

I also noticed differences with bind mounts though,
which I need to look into further.
There are also comments in df::show_point() to
indicate find_mount_points() is only a fall back and
may hang. Perhaps we need to move more of show_point()
to `stat`?

$ mkdir tdir
$ touch tfile
$ sudo mount --bind /dev/shm/ tdir
$ touch tdir/tfile
$ sudo mount --bind /dev/shm/tfile tfile

$ df -P tfile tdir/ tdir/tfile | sed -n '1!s/.* \([^ ]*$\)/\1/p'
/dev/shm
/dev/shm
/dev/shm
$ stat -c%m tfile tdir/ tdir/tfile
/old_home
/old_home/padraig/git/tdir
/old_home/padraig/git/tdir

BTW, I updated the patch to output '?' when find_mount_point() == NULL

cheers,
Pádraig.





reply via email to

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