]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
profile/systemd-osc-context: Remove invalid octets
authorChris Lindee <chris.lindee+github@gmail.com>
Mon, 16 Feb 2026 06:08:31 +0000 (00:08 -0600)
committerChris Lindee <chris.lindee+github@gmail.com>
Mon, 16 Feb 2026 09:15:53 +0000 (03:15 -0600)
UAPI.15 requires:
* No C0 Control Characters (`\x00-\x1f`)
* No DEL character (`\x7f`)

The following would be nice, but requires a `sed` implementation that is
aware of UTF-8: `-e $'y/\x00-\x1f\x7f/␀-␟␡/'`.

References:
 [0] https://uapi-group.org/specifications/specs/osc_context/#general-syntax

profile.d/80-systemd-osc-context.sh

index dfed4664044db7aed44d5c12cadba735655adbfc..537facdf1a9483f00549ca95078337a3532ec81c 100644 (file)
@@ -28,7 +28,7 @@ __systemd_osc_context_escape() {
     # uuids, id128, hostnames, usernames, since they all come with syntax
     # requirements that exclude \ and ; anyway. This hence primarily is about
     # escaping the current working directory.
-    echo "$1" | sed -e 's/\\/\\x5c/g' -e 's/;/\\x3b/g'
+    echo "$1" | sed -e 's/\\/\\x5c/g' -e 's/;/\\x3b/g' -e 's/[[:cntrl:]]/⍰/g'
 }
 
 __systemd_osc_context_common() {