Ticket #43146

built-in printf doesn't expand hex sequences

Open Date: 2021-10-29 08:18 Last Update: 2021-10-30 01:18

Reporter:
(Anonymous)
Owner:
Status:
Open [Owner assigned]
Component:
MileStone:
(None)
Priority:
5 - Medium
Severity:
5 - Medium
Resolution:
None
File:
None
Vote
Score: 0
No votes
0.0% (0/0)
0.0% (0/0)

Details

yash:

$ printf "\x66\x65\n"
\x66\x65

busybox sh and bash:

$ printf "\x66\x65\n"
fe

this is somewhat of a bummer as now i can't pass anything outside ascii space as commandline parameters to apps (as yash doesn't implement echo -ne either)

Ticket History (3/4 Histories)

2021-10-29 08:18 Updated by: None
  • New Ticket "built-in printf doesn't expand hex sequences" created
2021-10-29 21:41 Updated by: magicant
  • Details Updated
2021-10-29 21:59 Updated by: magicant
  • Type Update from Bugs to Feature Requests
Comment

Why not use the portable octal escapes?

$ printf "\146\145\n"
fe

Yash does support echo -ne too. Maybe you forgot to enable it.

$ ECHO_STYLE=GNU
$ echo -ne '\0146\0145\n'
fe
2021-10-30 01:18 Updated by: None
Comment

Why not use the portable octal escapes?

because that'd require converting all hex stuff (e.g. taken from hexeditor) first into octal, and rewriting a lot of stuff like https://github.com/sabotage-linux/sabotage/blob/master/KEEP/alarmclock ...

ECHO_STYLE=GNU

ah thanks, good to know. still, no hex :/

Attachment File List

No attachments

Edit

You are not logged in. I you are not logged in, your comment will be treated as an anonymous post. » Login