GNU bug report logs -
#35137
[df] incorrect parsing of /proc/self/mountinfo with \r in mount path
Previous Next
Full log
View this message in rfc822 format
[Message part 1 (text/plain, inline)]
[adding gnulib, coming from https://bugs.gnu.org/35137]
On 4/5/19 9:01 AM, Bernhard Voelker wrote:
> On 4/4/19 9:52 AM, Zbigniew Jędrzejewski-Szmek wrote:
>> See https://github.com/systemd/systemd/issues/12018 and
>> https://github.com/karelzak/util-linux/issues/780 for additional context.
>>
>> $ mkdir "$(echo -e foo\\rbar)"
>> $ sudo mount -t tmpfs tmpfs foo^Mbar/
>> $ cat -v /proc/self/mountinfo|grep foo
>> 865 39 0:59 / /tmp/foo^Mbar rw,relatime shared:462 - tmpfs tmpfs rw,seclabel
>> $ df -h | grep foo
>> $ df -h /tmp/foo$'\r'bar
>> Filesystem Size Used Avail Use% Mounted on
>> - 3.9G 0 3.9G 0% /tmp/foo?bar
>>
>> When asked to show all filesystems, the mount point is not shown at all.
>> When asked to show just that one, df parses the mount point correctly,
>> but it gets the filesystem type wrong.
>
> Thanks for the report.
>
> I see the issue is not yet solved in util-linux as well.
> For coreutils, the fix is in gnulib. Parsing the line is starting
> to get ugly ... dirty patch attached.
>
> This also caters for the issue that df(1) totally skips a file system
> if the source is an empty string which is allowed for e.g. tmpfs:
>
> $ mount -t tmpfs '' /mnt
> $ df -h | grep mnt
The attached is a patch for gnulib to fix the reported and two other issues
when parsing /proc/self/mountinfo.
Any objections?
Meanwhile, I'm working a test for coreutils' df.
FWIW: Karel fixed this issue in util-linux yesterday:
https://git.kernel.org/pub/scm/utils/util-linux/util-linux.git/commit/?id=86673b3a46
Have a nice day,
Berny
[0001-mountlist-make-parsing-proc-self-mountinfo-more-robu.patch (text/x-patch, attachment)]
This bug report was last modified 6 years and 61 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.