Ernillew / wl500g

Automatically exported from code.google.com/p/wl500g
0 stars 0 forks source link

/bin/sed with -i switch truncates file to zero #252

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?

/bin/sed truncates the file to zero when used with the -i (in place switch)

What is the expected output? What do you see instead?
echo -e "ln1\nln2\nln3\nln4" > /tmp/sedtest && /bin/sed '1,2d' /tmp/sedtest
produces (as exected)
ln3
ln4

echo -e "ln1\nln2\nln3\nln4" > /tmp/sedtest && /bin/sed -i '1,2d' /tmp/sedtest 
&& cat /tmp/sedtest
truncates the file (makes it empty)

What version of the product are you using?
1.9.2.7-rtn-r3158 (RT-N16)

Please provide any additional information below.

I know that probably this is an issue in busybox but I think it's easier for 
you to trace it back to the original source of the problem.

I've run into this with my traffic logger script and lost some data when I 
wanted to discard old one...

Original issue reported on code.google.com by ecadd...@gmail.com on 13 Aug 2011 at 6:31

GoogleCodeExporter commented 9 years ago
Yes, it is a bug of busybox. It exists in both 1.18.5 & 1.19.0 and don't 
depends on platform (I'm tested mips32 & x86).

We hasn't any custom sed patches, so bug reproducible in original sources too. 
Please, file a new bug in bb bugzilla https://bugs.busybox.net/

Original comment by lly.dev on 14 Aug 2011 at 6:52

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
I've created the following report:
https://bugs.busybox.net/show_bug.cgi?id=4069

Original comment by ecadd...@gmail.com on 16 Aug 2011 at 8:26

GoogleCodeExporter commented 9 years ago
Fixed in r3225, sorry for a delay.

Original comment by lly.dev on 1 Sep 2011 at 4:01