<div dir="ltr"><div dir="ltr"><br></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Mon, Feb 15, 2021 at 6:31 AM Rob Landley <<a href="mailto:rob@landley.net">rob@landley.net</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Sigh, thunderbird crashed and I lost 8 gazillion open reply windows with<br>
half-composed messages. (Kmail used to remember messages being composed and open<br>
them back up again when it was relaunched. I miss kmail, but they tied it to a<br>
boat anchor of a desktop...)<br>
<br>
Oh well, makes closing down my laptop so I can do a distro version upgrade only<br>
a half day instead of a full day's work...<br>
<br>
On 2/14/21 1:32 PM, Yi-yo Chiang wrote:<br>
> Hi Rob,<br>
> <br>
> I think the main purpose of the original patch is to show mounts whose<br>
> stat()/statvfs() failed.<br>
<br>
And the current one should do that? (I don't have any mount points I can't stat<br>
because my laptop doesn't do crazy things with linux security modules, maybe I<br>
can put one in a directory I can't read or something to simulate that...)<br></blockquote><div><br></div><div>yeah, lgtm.</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
> For example, an under-privileged user may be able to read /proc/mounts but lack<br>
> the permission to stat(vfs) the mount point, so showing "-" is a way of saying<br>
> "I know this XXX device is being mount on YYY mount point, however for whatever<br>
> reason I lack the means to get usage information from the filesystem".<br>
<br>
And the test I'm using is that the dev node is zero, which should never happen<br>
because you can't mount a NULL device. Instead of adding an external flag, it's<br>
the same in-band signaling it was using before.<br>
<br>
Previously, the logic would skip such mounts (you could get them in the list of<br>
mount points if all you wanted was the path, but we had no info about them so df<br>
would skip them). Elliott apparently wanted to display them as  - - - - entries<br>
and I _think_ the current code does that but haven't tested it because I can<br>
stat all my filesystems because I'm not crazy enough to use LFS.<br></blockquote><div><br></div><div>to be clear, i was seeing this just on regular debian!</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
> So I think 5f5f97f215bb accomplishes what the original change wants by not<br>
> skipping 0:0 device at all and gives "st_dev == 0" a special meaning of<br>
> "stat(mount point) failed".<br>
<br>
I think it does too, but haven't tested it, which is why I asked.<br>
<br>
> The only question I have left, is it guaranteed that st_dev must be zero or left<br>
> unchanged when stat() fails? Or do we need to do something like, "if stat() /<br>
> statvfs() fails, ensure st_dev is zero" in portability.c to ensure the caller<br>
> knows that stat(mount point) failed?<br>
<br>
Linux leaves it alone. I can't speak for Apple.<br></blockquote><div><br></div><div>annoyingly on macOS 11.2, / is device 0:0 ---</div><div>```</div><div>$ ./toybox stat /<br>  File: /<br>  Size: 640    Blocks: 0       IO Blocks: 512  directory<br>Device: 1000004h/16777220d   Inode: 2        Links: 20       Device type: 0,0<br>Access: (0755/drwxr-xr-x)    Uid: (    0/    root)       Gid: (    0/   wheel)<br>Access: 2020-01-01 00:00:00.000000000 -0800<br>Modify: 2020-01-01 00:00:00.000000000 -0800<br>Change: 2020-01-01 00:00:00.000000000 -0800<br></div><div>```</div><div><br></div><div>but df's numbers all look wrong on macOS right now anyway, which  is presumably why it isn't in macos_defconfig yet...</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
Rob<br>
_______________________________________________<br>
Toybox mailing list<br>
<a href="mailto:Toybox@lists.landley.net" target="_blank">Toybox@lists.landley.net</a><br>
<a href="http://lists.landley.net/listinfo.cgi/toybox-landley.net" rel="noreferrer" target="_blank">http://lists.landley.net/listinfo.cgi/toybox-landley.net</a><br>
</blockquote></div></div>