Date: Sun, 1 Aug 1999 11:00:02 -0700 (PDT) From: "Danny J. Zerkel" <dzerkel@columbus.rr.com> To: freebsd-bugs@FreeBSD.org Subject: Re: bin/12137: something wrong with shell -- functions with arithm expressions Message-ID: <199908011800.LAA47664@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
The following reply was made to PR bin/12137; it has been noted by GNATS. From: "Danny J. Zerkel" <dzerkel@columbus.rr.com> To: freebsd-gnats-submit@freebsd.org, mi@aldan.algebra.com Cc: Subject: Re: bin/12137: something wrong with shell -- functions with arithm expressions Date: Sun, 01 Aug 1999 13:51:38 -0400 Mikhail, Well the addition is not required, nor does it have to be a function. This problem occurs when taking the length of an numbered argument value inside an algorithmic expression. So this displays the same error: set -- "abc (def [xyz])" echo $((${#1})) The problem appears to be that the argument variable is being parsed for special characters, which result in an extra character for every character in the set: !*?[=~:/- This parsing should not occur if we are going to take the length of the resulting string. Try this to see it: set -- "!*?[=~:/-" echo $((${#1})) 18! This patch should fix only this problem, without any side effects: --- /usr/src/bin/sh/parser.c.orig Sun Sep 13 15:24:57 1998 +++ /usr/src/bin/sh/parser.c Sun Aug 1 13:37:33 1999 @@ -1239,7 +1239,7 @@ } else { pungetc(); } - if (dblquote || arinest) + if (subtype != VSLENGTH && (dblquote || arinest)) flags |= VSQUOTE; *(stackblock() + typeloc) = subtype | flags; if (subtype != VSNORMAL) -- Danny J. Zerkel dzerkel@columbus.rr.com To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-bugs" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199908011800.LAA47664>