GNU bug report logs -
#6555
stat enhancement
Previous Next
Reported by: A Burgie <dajoker <at> gmail.com>
Date: Fri, 2 Jul 2010 20:55:01 UTC
Severity: normal
Done: Pádraig Brady <P <at> draigBrady.com>
Bug is archived. No further changes may be made.
Full log
Message #73 received at 6555 <at> debbugs.gnu.org (full text, mbox):
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.
This bug report was last modified 14 years and 272 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.