dash.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] [BUG] ${#10}
@ 2021-02-05  8:49 Vladimir N. Oleynik
  2021-02-08  3:41 ` [PATCH] parser: Fix regression on ${#10} expansion Herbert Xu
  0 siblings, 1 reply; 4+ messages in thread
From: Vladimir N. Oleynik @ 2021-02-05  8:49 UTC (permalink / raw)
  To: dash

[-- 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;
 

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2021-02-11  4:57 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-02-05  8:49 [PATCH] [BUG] ${#10} Vladimir N. Oleynik
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

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).