sd-device: keep escaped strings in DEVLINK= property
authorYu Watanabe <watanabe.yu+github@gmail.com>
Sun, 6 Dec 2020 12:10:34 +0000 (21:10 +0900)
committerMichael Biebl <biebl@debian.org>
Mon, 18 Jan 2021 12:45:15 +0000 (12:45 +0000)
This fixes a bug introduced by 87a4d416e5126b6fb2528ae192a6a6a8033539ce.

Fixes #17772.

(cherry picked from commit 31063db0b4842a452c6eadde5b969aaee2a0516a)

Gbp-Pq: Name sd-device-keep-escaped-strings-in-DEVLINK-property.patch

src/libsystemd/sd-device/device-private.c

index 2801ebdcbe32080a929d574d562ac3b9d2777527..9070dfbdd1144f2dcf889aa415391667e2ae7a64 100644 (file)
@@ -319,7 +319,10 @@ static int device_amend(sd_device *device, const char *key, const char *value) {
                 for (const char *p = value;;) {
                         _cleanup_free_ char *word = NULL;
 
-                        r = extract_first_word(&p, &word, NULL, 0);
+                        /* udev rules may set escaped strings, and sd-device does not modify the input
+                         * strings. So, it is also necessary to keep the strings received through
+                         * sd-device-monitor. */
+                        r = extract_first_word(&p, &word, NULL, EXTRACT_RETAIN_ESCAPE);
                         if (r < 0)
                                 return r;
                         if (r == 0)