diff options
author | jilles <jilles@FreeBSD.org> | 2010-12-18 23:03:51 +0000 |
---|---|---|
committer | jilles <jilles@FreeBSD.org> | 2010-12-18 23:03:51 +0000 |
commit | 84941f8297970e3618d7e98cdbef942031b9a596 (patch) | |
tree | 25ca73deea96a1e4bb9d3b97235aa742e7f61254 /tools | |
parent | 2a8eefc56b6eda956a168d2be7354df603b97b24 (diff) | |
download | FreeBSD-src-84941f8297970e3618d7e98cdbef942031b9a596.zip FreeBSD-src-84941f8297970e3618d7e98cdbef942031b9a596.tar.gz |
sh: arith: Disallow decimal constants starting with 0 (containing 8 or 9).
Constants in arithmetic starting with 0 should be octal only.
This avoids the following highly puzzling result:
$ echo $((018-017))
3
by making it an error instead.
Diffstat (limited to 'tools')
-rw-r--r-- | tools/regression/bin/sh/expansion/arith8.0 | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/tools/regression/bin/sh/expansion/arith8.0 b/tools/regression/bin/sh/expansion/arith8.0 new file mode 100644 index 0000000..2d03e50 --- /dev/null +++ b/tools/regression/bin/sh/expansion/arith8.0 @@ -0,0 +1,4 @@ +# $FreeBSD$ + +v=$( (eval ': $((08))') 2>&1 >/dev/null) +[ $? -ne 0 ] && [ -n "$v" ] |