]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
tree-wide: get rid of backslashes in file names
authorDaan De Meyer <daan@amutable.com>
Thu, 2 Jul 2026 10:30:55 +0000 (10:30 +0000)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Fri, 3 Jul 2026 08:10:09 +0000 (10:10 +0200)
File names containing backslashes cannot be checked out on Windows,
are not handled properly by build systems such as buck, and are awkward
to work with in general, so store the \x2d slice units under sanitized
file names, and rename them to the real unit name on install via a new
optional "name" key in the units list.

The fuzz-unit-file corpus sample is renamed as well; its file name is
not meaningful to the fuzzer, and dropping the backslash means it is no
longer skipped by the meson workaround for
https://github.com/mesonbuild/meson/issues/1564, so it runs as a
regression test again.

test/fuzz/fuzz-unit-file/dm-backslash.swap [moved from test/fuzz/fuzz-unit-file/dm-back\x2dslash.swap with 100% similarity]
units/meson.build
units/system-systemd-cryptsetup.slice [moved from units/system-systemd\x2dcryptsetup.slice with 100% similarity]
units/system-systemd-mute-console.slice [moved from units/system-systemd\x2dmute\x2dconsole.slice with 100% similarity]
units/system-systemd-veritysetup.slice [moved from units/system-systemd\x2dveritysetup.slice with 100% similarity]

index d61138bf7b2ba5e3e578ba24215ea59f4f612057..ab7989b4b9d4d099794ffb77803fc1b8bc46f2c9 100644 (file)
@@ -150,7 +150,10 @@ units = [
           'symlinks' : ['sockets.target.wants/']
         },
         { 'file' : 'systemd-mute-console@.service' },
-        { 'file' : 'system-systemd\\x2dmute\\x2dconsole.slice' },
+        {
+          'file' : 'system-systemd-mute-console.slice',
+          'name' : 'system-systemd\\x2dmute\\x2dconsole.slice',
+        },
         { 'file' : 'network-online.target' },
         { 'file' : 'network-pre.target' },
         { 'file' : 'network.target' },
@@ -242,11 +245,13 @@ units = [
         { 'file' : 'syslog.socket' },
         { 'file' : 'system-install.target' },
         {
-          'file' : 'system-systemd\\x2dcryptsetup.slice',
+          'file' : 'system-systemd-cryptsetup.slice',
+          'name' : 'system-systemd\\x2dcryptsetup.slice',
           'conditions' : ['HAVE_LIBCRYPTSETUP'],
         },
         {
-          'file' : 'system-systemd\\x2dveritysetup.slice',
+          'file' : 'system-systemd-veritysetup.slice',
+          'name' : 'system-systemd\\x2dveritysetup.slice',
           'conditions' : ['HAVE_LIBCRYPTSETUP'],
         },
         { 'file' : 'system-update-cleanup.service' },
@@ -1108,6 +1113,9 @@ foreach unit : units
                 needs_jinja = false
                 name = source
         endif
+        # Unit names that contain characters which are awkward in source file names (e.g. the
+        # backslash in \x2d escapes) are stored under a sanitized file name and renamed on install.
+        name = unit.get('name', name)
         source = files(source)
 
         install = true
@@ -1133,6 +1141,7 @@ foreach unit : units
                 endif
         elif install
                 install_data(source,
+                             rename : name,
                              install_dir : systemunitdir,
                              install_tag : unit.get('install_tag', ''))
         endif