tree-wide: get rid of backslashes in file names

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.
This commit is contained in:
Daan De Meyer
2026-07-02 10:30:55 +00:00
committed by Zbigniew Jędrzejewski-Szmek
parent b7769aa34e
commit d04fbcf956
5 changed files with 12 additions and 3 deletions

View 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