HYPHEN is escaped in filename by "\x2d"

Bug #1990721 reported by Bernhard Riegler
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
systemd
New
Undecided
Unassigned

Bug Description

on Ubuntu22.04LTS I get the following filenames.
root@prod:/home/bernie22/fw# find / -xdev -name '*\x2d*'
/etc/systemd/system/snap-gtk\x2dcommon\x2dthemes-1535.mount
/etc/systemd/system/snap-gnome\x2d3\x2d38\x2d2004-115.mount
/etc/systemd/system/multi-user.target.wants/snap-gtk\x2dcommon\x2dthemes-1535.mount
/etc/systemd/system/multi-user.target.wants/snap-gnome\x2d3\x2d38\x2d2004-115.mount
/etc/systemd/system/multi-user.target.wants/snap-snapd\x2ddesktop\x2dintegration-14.mount
/etc/systemd/system/multi-user.target.wants/snap-snap\x2dstore-599.mount
/etc/systemd/system/multi-user.target.wants/snap-hunspell\x2ddictionaries\x2d1\x2d7\x2d2004-2.mount
/etc/systemd/system/snap-snapd\x2ddesktop\x2dintegration-14.mount
/etc/systemd/system/snap-snap\x2dstore-599.mount
/etc/systemd/system/snap-hunspell\x2ddictionaries\x2d1\x2d7\x2d2004-2.mount
/etc/systemd/system/default.target.wants/snap-gtk\x2dcommon\x2dthemes-1535.mount
/etc/systemd/system/default.target.wants/snap-gnome\x2d3\x2d38\x2d2004-115.mount
/etc/systemd/system/default.target.wants/snap-snapd\x2ddesktop\x2dintegration-14.mount
/etc/systemd/system/default.target.wants/snap-snap\x2dstore-599.mount
/etc/systemd/system/default.target.wants/snap-hunspell\x2ddictionaries\x2d1\x2d7\x2d2004-2.mount

why is the ASCII character HYPHEN escaped ?
remove this "\x2d"
a BACKSLASH is the source of a lot of troubles with filenames in UNIX and GNU/Linux.

Revision history for this message
Alberto Mardegan (mardy) wrote :

Hi Bernhard, the names of these files are not decided by snapd, but they follow systemd rules:
https://www.freedesktop.org/software/systemd/man/systemd.unit.html#String%20Escaping%20for%20Inclusion%20in%20Unit%20Names

I'll close this, but feel free to file a bug against upstream systemd (https://github.com/systemd/systemd/issues) if you think that this convention is wrong. I don't think they'd bother though, because it has been like this for many years, applications rely on this format, and moreover these are not files that the user should have the need to modify or move.

affects: snapcraft → systemd
Revision history for this message
Alberto Mardegan (mardy) wrote :

OK, it turns out that after moving the bug to systemd, I don't have permissions to close it anymore :-)

Revision history for this message
Bernhard Riegler (riegler-b) wrote :

thanks Alberto,
for pointing me to the details of systemd rules.

I am a fan of KISS (keep it simple s.......) any exception is one too much.

I still consider this a filesystem namespace pollution.
I work with UNIX since 1980, before GNU/Linux.
systemd master mind is ignoring the history of UNIX.

Now I understand why so many linux distributions reject this process PID=1 concept.

SLASH and BACKSLASH is a NO-NO in filenames.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.