Bug 4069 - sed with in-place operation (-i switch) truncates file to zero (i.e. file is lost)
Summary: sed with in-place operation (-i switch) truncates file to zero (i.e. file is ...
Status: RESOLVED FIXED
Alias: None
Product: Busybox
Classification: Unclassified
Component: Networking (show other bugs)
Version: 1.18.x
Hardware: All All
: P5 major
Target Milestone: ---
Assignee: unassigned
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-08-16 08:24 UTC by ecaddict
Modified: 2011-08-16 11:36 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description ecaddict 2011-08-16 08:24:24 UTC
Correct behavior:
echo -e "ln1\nln2\nln3\nln4" > /tmp/sedtest && /bin/sed '1,2d' /tmp/sedtest
produces (as expected)
ln3
ln4


Error:
echo -e "ln1\nln2\nln3\nln4" > /tmp/sedtest && /bin/sed -i '1,2d' /tmp/sedtest && cat /tmp/sedtest
truncates the file (makes it empty, so cat does not show any content)

I've reported this bug based on this discussion:
http://code.google.com/p/wl500g/issues/detail?id=252&colspec=ID%20Type%20Status%20Priority%20Owner%20Summary%20Opened