Skip to content

\r in path confuses libmount #780

@keszybz

Description

@keszybz

Based on systemd/systemd#12018. Systemd uses libmount to parse /proc/self/mountinfo.

$ mkdir "$(echo -e foo\\rbar)"
$ sudo mount -t tmpfs tmpfs foo^Mbar/
$ findmnt | grep foo
│ └─/tmp/foo                                tmpfs                          tmpfs       rw,bar,seclabel

Quoting systemd/systemd#12018 (comment):
fscanf() will split fields on whitespace, and what counts as whitespace is both locale-specific and different to the actual file format (even in the C locale). The Linux kernel, the GNU C library, and other utilities are quite specific that only SPC and TAB are field separator characters; whereas fscanf() will also incorrectly split fields on VT and CR.

Whether or not CR is a good idea in a mount point name, one should parse the data file correctly.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions