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

Re: bug: _store_cache and ksh arrays



On Tue, 19 Oct 2004, Alexey Tourbin wrote:

> Actually _comp_options neither set no unset KSH_TYPESET along with
> MAGIC_EQUAL_SUBST.  Hence the problem.  Here is a patch.

_comp_options can't change MAGIC_EQUAL_SUBST because some completers 
behave differently depending on an [[ -o magicequalsubst ]] test.
Just NO_kshtypeset should be sufficient.

> Anyway I can't understand why "$var=( ${(kv@Pqq)^^var} )" should give
> only one element for array with those options set.

I know why it happens, but I think it's a bug.  However, it might be just
a documentation bug rather than a code bug.  Here's the doc:

MAGIC_EQUAL_SUBST
     All unquoted arguments of the form `ANYTHING=EXPRESSION' appearing
     after the command name have filename expansion (that is, where
     EXPRESSION has a leading `~' or `=') performed on EXPRESSION as if
     it were a parameter assignment.  The argument is not otherwise
     treated specially; it is passed to the command as a single
     argument, and not used as an actual parameter assignment.  For
     example, in echo foo=~/bar:~/rod, both occurrences of ~ would be
     replaced.  Note that this happens anyway with typeset and similar
     statements.

     This option respects the setting of the KSH_TYPESET option.  In
     other words, if both options are in effect, arguments looking like
     assignments will not undergo wordsplitting.

The problem is with the word "unquoted" in the first line above.  It would 
seem that MAGIC_EQUAL_SUBST applies to double-quoted arguments, and only
single quoting entirely protects them.  In the absence of KSH_TYPESET this
is not apparent, because double-quoting is sufficient to prevent filename
expansion, but with KSH_TYPESET the side-effect on parameter expansion is
revealed.



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