All of lore.kernel.org
 help / color / mirror / Atom feed
From: наб <nabijaczleweli@nabijaczleweli.xyz>
To: Harald van Dijk <harald@gigawatt.nl>
Cc: Herbert Xu <herbert@gondor.apana.org.au>, dash@vger.kernel.org
Subject: [PATCH] alias: fix name quoting in printalias
Date: Mon, 9 Jan 2023 01:12:19 +0100	[thread overview]
Message-ID: <20230109001219.2ylktzb7uckoeti5@tarta.nabijaczleweli.xyz> (raw)
In-Reply-To: <ae838562-3d6d-aad8-f3ae-8d7d23e25c4d@gigawatt.nl>

[-- Attachment #1: Type: text/plain, Size: 1144 bytes --]

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 #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

  reply	other threads:[~2023-01-09  0:12 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-12-17 19:07 [PATCH] alias: aliascmd: refuse uninvokable aliases наб
2022-12-18  3:04 ` Herbert Xu
2022-12-18  3:34   ` наб
2022-12-19  8:09     ` Herbert Xu
2023-01-05  9:06     ` Herbert Xu
2023-01-05 12:49       ` [PATCH RESEND] alias: printalias: quote the name, too наб
2023-01-08 12:07         ` Herbert Xu
2023-01-08 23:51           ` Harald van Dijk
2023-01-09  0:12             ` наб [this message]
2023-01-09  0:15               ` [PATCH v2] alias: fix name quoting in printalias наб
2023-01-09  0:30                 ` Harald van Dijk
2023-01-11  0:06                   ` Harald van Dijk
2023-01-11 10:11                     ` Herbert Xu
2023-01-09  4:37                 ` Herbert Xu
2023-01-08 12:30 ` [PATCH] alias: aliascmd: refuse uninvokable aliases Harald van Dijk

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230109001219.2ylktzb7uckoeti5@tarta.nabijaczleweli.xyz \
    --to=nabijaczleweli@nabijaczleweli.xyz \
    --cc=dash@vger.kernel.org \
    --cc=harald@gigawatt.nl \
    --cc=herbert@gondor.apana.org.au \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.