GNU bug report logs - #35137
[df] incorrect parsing of /proc/self/mountinfo with \r in mount path

Previous Next

Package: coreutils;

Reported by: Zbigniew Jędrzejewski-Szmek <zbyszek <at> in.waw.pl>

Date: Thu, 4 Apr 2019 07:54:01 UTC

Severity: normal

Full log


View this message in rfc822 format

From: Bernhard Voelker <mail <at> bernhard-voelker.de>
To: Zbigniew Jędrzejewski-Szmek <zbyszek <at> in.waw.pl>, 35137 <at> debbugs.gnu.org
Subject: bug#35137: [df] incorrect parsing of /proc/self/mountinfo with \r in mount path
Date: Fri, 5 Apr 2019 09:01:00 +0200
[Message part 1 (text/plain, inline)]
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

At least util-linux' findmnt has already worked around that case, see
https://git.kernel.org/pub/scm/utils/util-linux/util-linux.git/commit/?id=18a52a5094f8

Finally, other users of gnulib/lib/mountlist.c are also affected.

Have a nice day,
Berny
[mountlist.diff (text/x-patch, attachment)]

This bug report was last modified 6 years and 97 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.