Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

More typeset bugs: POSIX_BUILTINS



In printparamnode is this comment:

      * Special POSIX rules: show the parameter as readonly/exported
      * even though it's unset, but with no value.

There's a test for this with "readonly", so apparently "readonly FOO"
has always had the property that the variable exists but seems to be
unset if and only if POSIX_BUILTINS is in force.  Similarly for
"export" although there's no test for it.

(This suggests that perhaps POSIX_BUILTINS is a reasonable choice for
enabling this behavior with typeset in general, even though typeset
and local are not actually part of POSIX.)

However, there's some confusion (this is with the master branch head):

% setopt POSIX_BUILTINS
% export OUTER
% typeset -p OUTER
% readonly -p OUTER
readonly OUTER
% typeset INNER
% export -p INNER
export INNER=''
% readonly FROZEN
% typeset -p FROZEN
% export -p FROZEN
export FROZEN
%

That is, each command prints its own name even when that's not
appropriate to the variable (and typeset prints nothing for names with
no value, although that's OK since it's not a POSIX builtin).




Messages sorted by: Reverse Date, Date, Thread, Author