FS#61694 - [systemd] mkinitcpio "systemd" build hook does not handle "special characters" in Exec* options

Attached to Project: Arch Linux
Opened by Marcel Röthke (mroethke) - Saturday, 09 February 2019, 21:04 GMT
Last edited by Buggy McBugFace (bugbot) - Saturday, 25 November 2023, 20:13 GMT
Task Type Bug Report
Category Packages: Core
Status Closed
Assigned To Dave Reisner (falconindy)
Christian Hesse (eworm)
Architecture All
Severity Low
Priority Normal
Reported Version
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 2
Private No

Details

Description:
Exec* option in systemd service files can have "special characters" (!, !!, @,- , +) directly after the "=", they alter systemds behavior and have nothing to do with the binary path. This is documented in the man page systemd.service under "ExecStart".
The function add_systemd_unit from the systemd hook does not handle this and errors out, because it can't find the binary.


Additional info:

package version:
systemd: 240.34-3
mkinitcpio: 25-1

I attached a minimal hook that shows this issue and a simple fix that works for me™.



Steps to reproduce:
1. Write an mkinitcpio hook that uses add_systemd_unit with "special characters" in Exec* options e.g. systemd-networkd.service
2. Add custom hook to to hooks array
2. rebuild initramfs
This task depends upon

Closed by  Buggy McBugFace (bugbot)
Saturday, 25 November 2023, 20:13 GMT
Reason for closing:  Moved
Additional comments about closing:  https://gitlab.archlinux.org/archlinux/p ackaging/packages/systemd/issues/4
Comment by Eli Schwartz (eschwartz) - Wednesday, 13 February 2019, 20:05 GMT
expr is pretty bad as a shellscripting tool, honestly -- it requires forking an external binary and its use tends to be confusing. You can do it all in bash; what about (requires extglob):

echo "${values[0]##+([^/a-zA-Z0-9])}"

If you don't want to use extglob:

prefix="${values[0]%%[/a-zA-Z0-9]*}"
idx=${#prefix}
echo "${values[0]:idx}"
Comment by Buggy McBugFace (bugbot) - Tuesday, 08 August 2023, 19:11 GMT
This is an automated comment as this bug is open for more then 2 years. Please reply if you still experience this bug otherwise this issue will be closed after 1 month.

Loading...