On 2025-08-30 15:40, 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).
This was actually the original issue I had tried to address, escaping
'#' in the beginning of the devname because it ends up in the beginning
of the line, thus masking out the entire line in mounts. I don't
remember at what point I concluded that escaping '#' always was the
answer (maybe to protect against any future instances where userspace
ends up ignoring the rest of the line following the '#'), but it appears
to be wrong.
Sid