diff options
author | Peter Stephenson <pws@zsh.org> | 2017-03-07 10:43:58 +0000 |
---|---|---|
committer | Peter Stephenson <pws@zsh.org> | 2017-03-07 10:43:58 +0000 |
commit | f3f8537cfa05414ad14494e809d9ebfeef86ebbc (patch) | |
tree | cfb02314dd129609ef3d6fc85ce75fc63b8c9582 /Src/exec.c | |
parent | a8345a40b1a79bb3a5c524ccf5fedf78040ae40e (diff) | |
download | zsh-f3f8537cfa05414ad14494e809d9ebfeef86ebbc.tar.gz zsh-f3f8537cfa05414ad14494e809d9ebfeef86ebbc.tar.xz zsh-f3f8537cfa05414ad14494e809d9ebfeef86ebbc.zip |
40760: Always tokenize unquoted - to Dash.
This fixes use of pattern match character ranges in unusual contexts. Attempt to detect a tokenized - in cases where we don't care.
Diffstat (limited to 'Src/exec.c')
-rw-r--r-- | Src/exec.c | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/Src/exec.c b/Src/exec.c index 6af4ddbf3..8b3224652 100644 --- a/Src/exec.c +++ b/Src/exec.c @@ -2779,9 +2779,10 @@ execcmd_exec(Estate state, Execcmd_params eparams, char *argdata = (char *) getdata(argnode); char *cmdopt; int has_p = 0, has_vV = 0, has_other = 0; - while (*argdata == '-') { + while (IS_DASH(*argdata)) { /* Just to be definite, stop on single "-", too, */ - if (!argdata[1] || (argdata[1] == '-' && !argdata[2])) + if (!argdata[1] || + (IS_DASH(argdata[1]) && !argdata[2])) break; for (cmdopt = argdata+1; *cmdopt; cmdopt++) { switch (*cmdopt) { @@ -2835,7 +2836,7 @@ execcmd_exec(Estate state, Execcmd_params eparams, * as if this is command [non-option-stuff]. This * isn't a good place for standard option handling. */ - if (!strcmp(argdata, "--")) + if (IS_DASH(argdata[0]) && IS_DASH(argdata[1]) && !argdata[2]) uremnode(args, firstnode(args)); } if ((cflags & BINF_EXEC) && nextnode(firstnode(args))) { @@ -2855,7 +2856,7 @@ execcmd_exec(Estate state, Execcmd_params eparams, * people aren't likely to mix the option style * with the zsh style. */ - while (next && *next == '-' && strlen(next) >= 2) { + while (next && IS_DASH(*next) && strlen(next) >= 2) { if (!firstnode(args)) { zerr("exec requires a command to execute"); lastval = 1; @@ -2863,7 +2864,7 @@ execcmd_exec(Estate state, Execcmd_params eparams, goto done; } uremnode(args, firstnode(args)); - if (!strcmp(next, "--")) + if (IS_DASH(next[0]) && IS_DASH(next[1]) && !next[2]) break; for (cmdopt = &next[1]; *cmdopt; ++cmdopt) { switch (*cmdopt) { |