On Fri, 2 Oct 2009, Cristian Ionescu-Idbohrn wrote:

> Consider this script:
>
> ---8<---
> #!/bin/sh
>
> set -e
> #set -x
>
> echo "1. \$1='$1', size \${#\$1}=${#$1}" >&2
> echo "2. \$2='$2', size \${#\$2}=${#$2}" >&2
> echo "3. \$3='$3', size \${#\$3}=${#$3}" >&2
>
> echo "4. \$1='$1', size \${#1}=${#1}" >&2
> --->8---
>
> Expecting error 'bad substitution' on 1., 2. and 3.  I get:
>
>       size=5
>
> instead, no error.

Would the attached patch be an apprpriate bugfix for the above?


Cheers,

-- 
Cristian
--- ash.c.orig	2009-10-03 19:03:05.000000000 +0200
+++ ash.c	2009-10-03 19:04:57.000000000 +0200
@@ -6393,6 +6393,8 @@
 	syntax = quoted ? DQSYNTAX : BASESYNTAX;
 	switch (*name) {
 	case '$':
+		if (subtype == VSLENGTH)
+			raise_error_syntax("bad substitution");
 		num = rootpid;
 		goto numvar;
 	case '?':
_______________________________________________
busybox mailing list
[email protected]
http://lists.busybox.net/mailman/listinfo/busybox

Reply via email to