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.

(cherry picked from commit d04fbcf956)
(cherry picked from commit 160d4f1259)
(cherry picked from commit dbc45dc12c)
(cherry picked from commit df920607e4)
This commit is contained in:
Daan De Meyer
2026-07-02 10:30:55 +00:00
committed by Luca Boccassi
parent 872e1e4ea5
commit dc5e6c1480
4 changed files with 8 additions and 2 deletions

View File

@@ -231,11 +231,13 @@ units = [
{ 'file' : 'sysinit.target' },
{ 'file' : 'syslog.socket' },
{
'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' },
@@ -901,6 +903,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
@@ -926,6 +931,7 @@ foreach unit : units
endif
elif install
install_data(source,
rename : name,
install_dir : systemunitdir,
install_tag : unit.get('install_tag', ''))
endif