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

Re: [BUG] Alias with unclosed quote leaves incorrect string in history



On Mar 8,  1:11am, ZyX wrote:
}
} % alias -g S='"'
} % echo S abc def S
} dquote> "
}  abc def S
} % echo S" abc def S
} "
} 
} which is the original string + a quote after first `S` which is wrong.

This is probably related to the bug with aliasing of "{" that I reported
as an afterthought in workers/34668.

} Second S also does not end the string, but I do not think this is a bug.

It's related to the way zsh mixes lexical analysis with alias expansion.
By the time you get to the second S, the first S has already expanded to
a double quote so the second S is quoted.

} Same thing will happen if I e.g. have unclosed `$(` or `'` in an
} alias. I think it is more correct to deal with this problem by
} errorring out when user tries to use such an alias.

There probably isn't any good way to do that.  It would require that we
treat the expansion of an alias as something to be lexed separately,
rather than treating it as having been pushed onto the input.



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