tcsh-org / tcsh

This is a read-only mirror of the tcsh code repository.
https://www.tcsh.org/
Other
232 stars 42 forks source link

fix inifinite loop in :gas #16

Closed alzwded closed 4 years ago

alzwded commented 4 years ago

Running this:

set x=aa
echo $x:gas/a/ba/

would cause the shell to freeze in an infinite loop.

Per the man pages:

              [...] `a' and `g' can be used together to  apply  a
              modifier  globally.   With  the `s' modifier, only the pat‐
              terns contained in the original word are  substituted,  not
              patterns that contain any substitution result.

So, keep track of where the last substitution was made, and continue on from there.

zoulasc commented 4 years ago

Committed, thanks!