1
0
Fork 0
mirror of git://git.code.sf.net/p/zsh/code synced 2025-06-12 07:28:04 +02:00

51306: error message in ${unset?error} should be expanded

This commit is contained in:
Peter Stephenson 2023-02-02 10:12:17 +00:00
parent 21baad1037
commit 76d095df9d
4 changed files with 16 additions and 2 deletions

View file

@ -1,5 +1,8 @@
2023-02-02 Peter Stephenson <p.stephenson@samsung.com> 2023-02-02 Peter Stephenson <p.stephenson@samsung.com>
* 51306: Doc/Zsh/expn.yo, Src/subst.c, Test/D04parameter.ztst:
error message in ${unset?...} should be expanded.
* 51307: Src/input.c, Src/parse.c, Test/A02alias.ztst: error * 51307: Src/input.c, Src/parse.c, Test/A02alias.ztst: error
on attempt to expand alias in function definition name didn't on attempt to expand alias in function definition name didn't
find the original alias and printed an extra error. find the original alias and printed an extra error.

View file

@ -665,7 +665,9 @@ item(tt(${)var(name)tt(:?)var(word)tt(}))(
In the first form, if var(name) is set, or in the second form if var(name) In the first form, if var(name) is set, or in the second form if var(name)
is both set and non-null, then substitute its value; otherwise, print is both set and non-null, then substitute its value; otherwise, print
var(word) and exit from the shell. Interactive shells instead return to var(word) and exit from the shell. Interactive shells instead return to
the prompt. If var(word) is omitted, then a standard message is printed. the prompt. If var(word) is omitted, then a standard message is
printed. Note that var(word) is expanded even though its value
is not substituted onto the command line.
) )
enditem() enditem()

View file

@ -3076,7 +3076,11 @@ paramsubst(LinkList l, LinkNode n, char **str, int qt, int pf_flags,
if (vunset) { if (vunset) {
if (isset(EXECOPT)) { if (isset(EXECOPT)) {
*idend = '\0'; *idend = '\0';
zerr("%s: %s", idbeg, *s ? s : "parameter not set"); if (*s){
singsub(&s);
zerr("%s: %s", idbeg, s);
} else
zerr("%s: %s", idbeg, "parameter not set");
/* /*
* In interactive shell we need to return to * In interactive shell we need to return to
* top-level prompt --- don't clear this error * top-level prompt --- don't clear this error

View file

@ -110,6 +110,11 @@
*>*foo:1: 1: no arguments given *>*foo:1: 1: no arguments given
>reached >reached
message="expand me and remove quotes"
(: ${UNSET_PARAM?$message})
1:${...?....} performs expansion on the message
?(eval):2: UNSET_PARAM: expand me and remove quotes
print ${set1:+word1} ${set1+word2} ${null1:+word3} ${null1+word4} print ${set1:+word1} ${set1+word2} ${null1:+word3} ${null1+word4}
print ${unset1:+word5} ${unset1+word6} print ${unset1:+word5} ${unset1+word6}
0:${...:+...}, ${...+...} 0:${...:+...}, ${...+...}