[Tcsh] Fix variable expansion on expressions.

Matheus Garcia tateusg at hotmail.com
Mon Jun 10 02:21:30 UTC 2024


https://github.com/tcsh-org/tcsh/pull/107
It's known variables expand earlier than expression evaluations. The procedure
if ( $?a && "$a" != ) echo "$a"

would fail if a isn't set. The correct behavior is to evaluate $?a first, and, if expanded to zero, cancel further processing.

This work remedies the issue by postponing variable expansions during expression evaluations. The function Dfix1 is used for I/O redirections, and fails if the expansion is null or, if not quoted, larger than one word/vector. I believe this behavior is fine.

This work was also supposed to fix $< expansions on pipes and redirections. I had some success with a fix, but ends up blocking the shell, making it unusable and uninterruptible.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.astron.com/pipermail/tcsh/attachments/20240610/f905a141/attachment.htm>


More information about the Tcsh mailing list