Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
GoogleCodeExporter opened this issue Mar 29, 2015 · 4 comments
Closed

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

GoogleCodeExporter opened this issue Mar 29, 2015 · 4 comments

Comments

@GoogleCodeExporter
Copy link

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
Copy link
Author

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

  • Added labels: ****
  • Removed labels: ****

@GoogleCodeExporter
Copy link
Author

[deleted comment]

@GoogleCodeExporter
Copy link
Author

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

  • Added labels: ****
  • Removed labels: ****

@GoogleCodeExporter
Copy link
Author

Fixed in r3225, sorry for a delay.

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

  • Changed state: Fixed
  • Added labels: ****
  • Removed labels: ****

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant