Public bug reported:

I have found this bug while writing autopkgtests for the package. 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 likely root cause is that shtool internally calls echo. However,
echo resolves to the built in command of /bin/sh. Even when shtool tries
to pass -E, the built in version doesn't support it. The best solution
would probably be to make shtool use /usr/bin/echo in some way (e.g., an
alias).

** Affects: shtool (Ubuntu)
     Importance: Undecided
     Assignee: Csaba Györgyi (gycsaba96)
         Status: New

** Changed in: shtool (Ubuntu)
     Assignee: (unassigned) => Csaba Györgyi (gycsaba96)

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/2167073

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

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/shtool/+bug/2167073/+subscriptions


-- 
ubuntu-bugs mailing list
[email protected]
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to