[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: bug#35137: [df] incorrect parsing of /proc/self/mountinfo with \r in
From: |
Bernhard Voelker |
Subject: |
Re: bug#35137: [df] incorrect parsing of /proc/self/mountinfo with \r in mount path |
Date: |
Wed, 10 Apr 2019 00:31:35 +0200 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.6.1 |
[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
Description: Text Data
- Re: bug#35137: [df] incorrect parsing of /proc/self/mountinfo with \r in mount path,
Bernhard Voelker <=