Re: [RFC] does # really need to be escaped in devnames?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sat, Aug 30, 2025 at 12:40:32PM -0700, Linus Torvalds wrote:
> On Sat, 30 Aug 2025 at 00:33, Al Viro <viro@xxxxxxxxxxxxxxxxxx> wrote:
> >
> > So...  Siddhesh, could you clarify the claim about breaking getmntent(3)?
> > Does it or does it not happen on every system that has readonly AFS
> > volumes mounted?
> 
> Hmm. Looking at various source trees using Debian code search, at
> least dietlibc doesn't treat '#' specially at all.
> 
> And glibc seems to treat only a line that *starts* with a '#'
> (possibly preceded by space/tab combinations) as an empty line.
> 
> klibc checks for '#' at the beginning of the file (without any
> potential space skipping before)
> 
> Busybox seems to do the same "skip whitespace, then skip lines
> starting with '#'" that glibc does.
> 
> So I think the '#'-escaping logic is wrong.  We should only escape '#'
> marks at the beginning of a line (since we already escape spaces and
> tabs, the "preceded by whitespace" doesn't matter).
> 
> And that means that we shouldn't do it in 'mangle()' at all - because
> it's irrelevant for any field but the first.
> 
> And the first field in /proc/mounts is that 'r->mnt_devname' (or
> show_devname), and again, that should only trigger on the first
> character, not every character.

*nod*

Amusingly enough, glibc addmntent(3) does *not* consider # for an
octal escape.

BTW, another amuzing bogosity:

	seq_escape(m, "blah", "X") => "blah"
	seq_escape(m, "blah", "b") => "\142lah"
	seq_escape(m, "blah", "") => "\142\154\141\150"

IOW, about 10 years ago an empty string switched meaning from "escape nothing"
to "escape everything"...




[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [NTFS 3]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [NTFS 3]     [Samba]     [Device Mapper]     [CEPH Development]

  Powered by Linux