diff mbox series

[BUG] ${#10}

Message ID b91eab68-0a8a-36f0-a947-344cf2c168f5@simtreas.ru (mailing list archive)
State Superseded
Delegated to: Herbert Xu
Headers show
Series [BUG] ${#10} | expand

Commit Message

Vladimir N. Oleynik Feb. 5, 2021, 8:49 a.m. UTC
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
diff mbox series

Patch

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