45009: POSIX_CD needs to suppress some forms of option.

Otherwise forms of argument allowed by POSIX are interpreted as
options instead.
5.9
Peter Stephenson 5 years ago
parent 273d669a56
commit cb4dc95643

@ -290,6 +290,8 @@ of the list shown by the tt(dirs) command, starting with zero.
An argument of the form `tt(-)var(n)' counts from the right.
If the tt(PUSHD_MINUS) option is set, the meanings of `tt(PLUS())'
and `tt(-)' in this context are swapped.
If the tt(POSIX_CD) option is set, this form of tt(cd) is not recognised
and will be interpreted as the first form.
If the tt(-q) (quiet) option is specified, the hook function tt(chpwd)
and the functions in the array tt(chpwd_functions) are not called.

@ -148,7 +148,8 @@ ifzman(zmanref(zshbuiltins))\
ifnzman(noderef(Shell Builtin Commands)).
If the option is set, the shell does not test for directories beneath
the local directory (`tt(.)') until after all directories in tt(cdpath)
have been tested.
have been tested, and the tt(cd) and tt(chdir) commands do not recognise
arguments of the form `{tt(PLUS())|tt(-)}var(n)' as directory stack entries.
Also, if the option is set, the conditions under which the shell
prints the new directory after changing to it are modified. It is

@ -912,7 +912,7 @@ cd_get_dest(char *nam, char **argv, int hard, int func)
char *end;
doprintdir++;
if (argv[0][1] && (argv[0][0] == '+' || argv[0][0] == '-')
if (!isset(POSIXCD) && argv[0][1] && (argv[0][0] == '+' || argv[0][0] == '-')
&& strspn(argv[0]+1, "0123456789") == strlen(argv[0]+1)) {
dd = zstrtol(argv[0] + 1, &end, 10);
if (*end == '\0') {

Loading…
Cancel
Save