Hi! On Sun, Dec 18, 2022 at 11:04:19AM +0800, Herbert Xu wrote: > The main objective of dash is to try to be minimal, so I'm not > going to take this patch. In that case, how's about the scissor-patch below that fixes the main questionable part of this (these dubious aliases executed as code when re-evaled, which POSIX says should be fine)? It's roughly what zsh does. -- >8 -- Subject: [PATCH] alias: printalias: quote the name, too This ensures even something like alias 'a|b|c=d' is output by alias as 'a|b|c'='d' instead of a|b|c='d' which is both "suitable for reinput to the shell" per POSIX and doesn't execute the aliases as code. --- src/alias.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/alias.c b/src/alias.c index daeacbb..1375cdd 100644 --- a/src/alias.c +++ b/src/alias.c @@ -197,7 +197,7 @@ freealias(struct alias *ap) { void printalias(const struct alias *ap) { - out1fmt("%s=%s\n", ap->name, single_quote(ap->val)); + out1fmt("%s=%s\n", single_quote(ap->name), single_quote(ap->val)); } STATIC struct alias ** -- 2.30.2
Attachment:
signature.asc
Description: PGP signature