tmpfiles: take 8 and 9 as hex digits in an \x escape

An f or w entry with \x39 in the argument writes the byte 3 followed
by a 9, where it should write a 9:

    f /tmp/file - - - - \x39

write_hex() only takes the digits 0 to 7, as for an octal escape.
Take all hex digits.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
This commit is contained in:
Joachim Wiberg committed 2026-11-21 17:13:53 +01:00
1 parent 64e299bedc
commit 7ec4376eb0
3 files changed
+12 -3

No files matched your search

+8
View File
@@ -64,3 +64,11 @@ CONF
run "/libexec/finit/tmpfiles --create $CONF"
assert "First match" "$(texec cat $DIR/w1 | tr '\n' ' ')" = "one two"
assert "Second match" "$(texec cat $DIR/w2 | tr '\n' ' ')" = "one two"
sep
say 'Escapes in the argument'
run "cat > $CONF" <<'CONF'
f /tmp/arg/hex - - - - \x39\x41\x4a\x6b
CONF
run "/libexec/finit/tmpfiles --create $CONF"
assert "All hex digits" "$(texec cat $DIR/hex)" = "9AJk"