From f1058ba09afa97cc45769b6e8e84d34910e510ec Mon Sep 17 00:00:00 2001 From: Jilles Tjoelker Date: Tue, 8 Jul 2014 22:04:44 +0000 Subject: [PATCH] sh: Add test for ${01} and ${010} that already works. Although it is probably unwise to use this, POSIX is clear that leading zeroes are permitted in positional parameters (and do not indicate octal). Such positional parameters are checked for being unset and/or null correctly, but their value is incorrectly expanded. --- bin/sh/tests/parameters/Makefile | 1 + bin/sh/tests/parameters/positional3.0 | 4 ++++ 2 files changed, 5 insertions(+) create mode 100644 bin/sh/tests/parameters/positional3.0 diff --git a/bin/sh/tests/parameters/Makefile b/bin/sh/tests/parameters/Makefile index fafc059ec24..4f9ae31ce3b 100644 --- a/bin/sh/tests/parameters/Makefile +++ b/bin/sh/tests/parameters/Makefile @@ -13,6 +13,7 @@ FILES+= optind1.0 FILES+= optind2.0 FILES+= positional1.0 FILES+= positional2.0 +FILES+= positional3.0 FILES+= pwd1.0 FILES+= pwd2.0 diff --git a/bin/sh/tests/parameters/positional3.0 b/bin/sh/tests/parameters/positional3.0 new file mode 100644 index 00000000000..1200469b4e1 --- /dev/null +++ b/bin/sh/tests/parameters/positional3.0 @@ -0,0 +1,4 @@ +# $FreeBSD$ + +r=$(${SH} -c 'echo ${01:+yes}${010:+yes}' '' a '' '' '' '' '' '' '' '' b) +[ "$r" = yesyes ]