diff options
author | Rob Landley <rob@landley.net> | 2004-10-30 06:54:19 +0000 |
---|---|---|
committer | Rob Landley <rob@landley.net> | 2004-10-30 06:54:19 +0000 |
commit | ce4f0e982b40763798b268d24947a61cac625d39 (patch) | |
tree | d7e680e89e0d6fb9843cb00552d8520de6fcf5e0 /init | |
parent | 332c4728656a72ddd116f031b654994863275c9d (diff) |
Hiroshi Ito found some bugs. The 'c' command (cut and paste) was hardwired
to not put a newline at the end (which was backwards, it should have been
hardwired _to_ put a newline at the end, whether or not the input line
ended with a newline). Test case for that:
echo | sed -e '$ctest'
And then this would segfault:
echo | sed -e 'g'
Because pattern_space got freed but the dead pointer was only overwritten
in an if statement that didn't trigger if the hold space was empty. Oops.
While debugging it, I found out that the hold space is persistent between
multiple input files, so I promoted it to a global and added it to the
memory cleanup. The relevant test case (to compare with That Other Sed) is:
echo -n woo > woo
sed -e h -e g woo
echo "fish" | sed -e '/woo/h' -e "izap" -e 's/woo/thingy/' -e '/fish/g' woo -
And somebody gratuitously stuck in a c99 int8_t type for something that's just
a flag, so I grouped the darn ints.
Diffstat (limited to 'init')
0 files changed, 0 insertions, 0 deletions