From: Yu Watanabe Date: Thu, 23 Jan 2025 00:04:12 +0000 (+0900) Subject: core/device: do not drop backslashes in SYSTEMD_WANTS=/SYSTEMD_USER_WANTS= (#35869) X-Git-Tag: v258-rc1~1517 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b6b814845970c556daeed994ab8ecf9fef7f3ff0;p=thirdparty%2Fsystemd.git core/device: do not drop backslashes in SYSTEMD_WANTS=/SYSTEMD_USER_WANTS= (#35869) Let consider the following udev rules: ``` PROGRAM="/usr/bin/systemd-escape foo-bar-baz", ENV{SYSTEMD_WANTS}+="test1@$result.service" PROGRAM="/usr/bin/systemd-escape aaa-bbb-ccc", ENV{SYSTEMD_WANTS}+="test2@$result.service" ``` Then, a device expectedly gains a property: ``` SYSTEMD_WANTS=test1@foo\x2dbar\x2dbaz.service test2@aaa\x2dbbb\x2dccc.service ``` After the event being processed by udevd, PID1 processes the device, the property previously was parsed with `extract_first_word(EXTRACT_UNQUOTE)`, then the device unit gained the following dependencies: ``` Wants=test1@foox2dbarx2dbaz.service test2@aaax2dbbbx2dccc.service ``` So both `%i` and `%I` for the template services did not match with the original data, and it was hard to use `systemd-escape` in `PROGRAM=` udev rule token. This makes the property parsed with `extract_first_word(EXTRACT_UNQUOTE|EXTRACT_RETAIN_ESCAPE)`, hence the device unit now gains the following dependencies: ``` Wants=test1@foo\x2dbar\x2dbaz.service test2@aaa\x2dbbb\x2dccc.service ``` and `%I` for the template services match with the original data. Fixes a bug caused by ceed8f0c8b9a46300eccd1afa2dd8d3c2cb6b47c (v233). Fixes #16735. Replaces #16737 and #35768. --- b6b814845970c556daeed994ab8ecf9fef7f3ff0