dash.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Vladimir N. Oleynik" <dzo@simtreas.ru>
To: dash@vger.kernel.org
Subject: [PATCH] [BUG] ${#10}
Date: Fri, 5 Feb 2021 12:49:15 +0400	[thread overview]
Message-ID: <b91eab68-0a8a-36f0-a947-344cf2c168f5@simtreas.ru> (raw)

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

Hello.

dash have bug for ${#10} and etc: ignores 0... in name (without errors :)

$ foo() { echo "length 10-th arg '${10}' is ${#10}"; }
$ foo a1 a2 a3 a4 a5 a6 a7 a8 a9 a10 a11
length 10-th arg 'a10' is 2

But need:
length 10-th arg 'a10' is 3


Micro patch attached


--w
vodz

[-- Attachment #2: lenght-na_bug.diff.txt --]
[-- Type: text/plain, Size: 323 bytes --]

--- parser.c~	2021-02-04 00:51:34.000000000 +0400
+++ parser.c	2021-02-05 12:42:43.616635640 +0400
@@ -1274,7 +1274,7 @@
 			do {
 				STPUTC(c, out);
 				c = pgetc_eatbnl();
-			} while (!subtype && is_digit(c));
+			} while ((!subtype || subtype == VSLENGTH) && is_digit(c));
 		} else if (c != '}') {
 			int cc = c;
 

             reply	other threads:[~2021-02-05  8:50 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-02-05  8:49 Vladimir N. Oleynik [this message]
2021-02-08  3:41 ` [PATCH] parser: Fix regression on ${#10} expansion Herbert Xu
2021-02-10 15:30   ` Vladimir N. Oleynik
2021-02-11  4:55     ` Herbert Xu

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=b91eab68-0a8a-36f0-a947-344cf2c168f5@simtreas.ru \
    --to=dzo@simtreas.ru \
    --cc=dash@vger.kernel.org \
    --subject='Re: [PATCH] [BUG] ${#10}' \
    /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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).