[BusyBox] FIxing Hiroshi Ito's other sed bug.

Rob Landley rob at landley.net
Tue Nov 23 12:19:43 UTC 2004


Okay, currently sed's $ triggers at end of every file, and with multiple files 
SuSv3 says it should only trigger at the end of the LAST file.  (Unless we're 
doing -i, anyway.)

Getting this right required restructuring things to create a file list 
(actually a FILE * list), and then processing it all in one go.  Unless, of 
course, you're using -i...

I think this patch fixes it.  Hiroshi, wanna re-run your tests?  It works for 
me (gnu and busybox sed produce same results) with:

echo -n -e "1one\n1two\n1three" > ../test1
echo -n > ../test2
echo -e "3one\n3two\n3three" > ../test3
sed -n "$ p" ../test1 ../test2 ../test3
sed -n "$ p" ../test1 ../test2
sed -i -n "$ p" ../test1 ../test2 ../test3

I'm posting this rather than just checking it in because A) I'm sleep deprived 
enough I may have broken something, B) I made the darn thing bigger and am 
thinking maybe there's something clever/gross I can do with append_list to 
get some of those bytes back...

Anyway, here's the first stab at getting the behavior correct.  Comments?

Rob
-------------- next part --------------
A non-text attachment was scrubbed...
Name: sed.patch
Type: text/x-diff
Size: 5512 bytes
Desc: not available
Url : http://lists.busybox.net/pipermail/busybox/attachments/20041123/99d14e9a/attachment.bin 


More information about the busybox mailing list