#1148586 shtool: `shtool echo` expands escape sequence when it shouldn't

#1148586#5
Date:
2026-09-21 08:48:54 UTC
From:
To:
Dear Maintainer,

I have found this bug while writing autopkgtests for the package in Ubuntu. By default, `shtool echo` should not expand escape sequences.
------------------
Steps to reproduce
------------------

1. apt install shtool on Ubuntu Stonking
2. Run the following command:

   ubuntu@s:~$ shtool echo '\1' | cat -v
   ^A

3. Observe the output with the unprintable character instead of the literal '\1' line.
--------------- Expected output --------------- ubuntu@s:~$ shtool echo '\1' | cat -v \1
----- Notes ----- This behavior is required by the currently failing first upstream test: @begin{echo} test ".`shtool echo foo bar quux`" = ".foo bar quux" bytes=`shtool echo -n foo | wc -c | awk '{ printf("%s", $1); }'` test ".$bytes" = .3 bytes=`shtool echo '\1' | wc -c | awk '{ printf("%s", $1); }'` test ".$bytes" = .3 @end{echo} The upstream test consistently fails but still exits with zero. In Ubuntu, we have a patch to use non-zero exit code on failure, and another patch to skip the test case until a solution is decided. LP Bug: https://bugs.launchpad.net/ubuntu/+source/shtool/+bug/2167073