Ticket #43146

built-in printf doesn't expand hex sequences

Date d'ouverture: 2021-10-29 08:18 Dernière mise à jour: 2021-10-30 01:18

Rapporteur:
(Anonyme)
Propriétaire:
État:
Ouvert [Owner assigned]
Composant:
Jalon:
(Aucun)
Priorité:
5 - moyen
Sévérité:
5 - moyen
Résolution:
Aucun
Fichier:
Aucun
Vote
Score: 0
No votes
0.0% (0/0)
0.0% (0/0)

Détails

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 Bogues to Demandes de fonctionnalités
Commentaire

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
Commentaire

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

Modifier

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