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

David Howells dhowells at redhat.com
Tue Sep 2 10:48:08 PDT 2025


Linus Torvalds <torvalds at linux-foundation.org> wrote:

> On Tue, 2 Sept 2025 at 08:03, Siddhesh Poyarekar <siddhesh at gotplt.org> wrote:
> >
> > 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.
> 
> I wonder if instead of escaping hash-marks we could just disallow them
> as the first character in devname.

The problem with that is that it appears that people are making use of this.

Mount /afs with "-o dynroot" isn't a problem as that shouldn't be given a
device name - and that's the main way people access AFS.  With OpenAFS I don't
think you can do this at all since it has a single superblock that it crams
everything under.  For AuriStor, I think you can mount individual volumes, but
I'm not sure how it works.  For Linux's AFS, I made every volume have its own
superblock.

The standard format of AFS volume names is [%#][<cell>:]<volume-name-or-id>
but I could make it an option to stick something on the front and use that
internally and display that in /proc/mounts, e.g.:

	mount afs:#openafs.org:afs.root /mnt

which would at least mean that sh and bash wouldn't need the "#" escaping.

The problem is that the # and the % have specific documented meanings, so if I
was to get rid of the '#' entirely, I would need some other marker.  Maybe it
would be sufficient to just go on the presence or not of a '%'.

Maybe I could go with something like:

	openafs.org:root.cell:ro
	openafs.org:root.cell:rw
	openafs.org:root.cell:bak

rather than use #/%.

I don't think there should be a problem with still accepting lines beginning
with '#' in mount() if I display them with an appropriate prefix.  That would
at least permit backward compatibility.

David




More information about the linux-afs mailing list