[PATCH] alias: fix name quoting in printalias

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



single_quote() over-writes the stack string, so just output the name
separately first.

Fixes: commit 4ec545e8dc98a3f461cf56bed03adafa81c64aec ("alias: Quote
 name in printalias")
---
I coulda swore I tested it and that's where I got my commit message from;
I try to always use my history verbatim for the messages,
for this exact reason.
That said, I can reproduce the bug on trunk and my clean original branch,
so dunno how that got there. my b.

On trunk:
  $ src/dash -c 'alias foo=bar "a|b|c"=d; alias'
  'bar'='bar'
  'd'='d'
With patch:
  $ src/dash -c 'alias foo=bar "a|b|c"=d; alias'
  'foo'='bar'
  'a|b|c'='d'

 src/alias.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/alias.c b/src/alias.c
index 1375cdd..3cd589c 100644
--- a/src/alias.c
+++ b/src/alias.c
@@ -197,7 +197,8 @@ freealias(struct alias *ap) {
 
 void
 printalias(const struct alias *ap) {
-	out1fmt("%s=%s\n", single_quote(ap->name), single_quote(ap->val));
+	out1str(single_quote(ap->name));
+	out1fmt("=%s\n", single_quote(ap->name), single_quote(ap->val));
 }
 
 STATIC struct alias **
-- 
2.30.2

Attachment: signature.asc
Description: PGP signature


[Index of Archives]     [LARTC]     [Bugtraq]     [Yosemite Forum]     [Photo]

  Powered by Linux