Bug 356111 - busybox sed cuts output at random multiples of 1024
busybox sed cuts output at random multiples of 1024
Status: CLOSED RAWHIDE
Product: Fedora
Classification: Fedora
Component: busybox (Show other bugs)
rawhide
i386 Linux
low Severity low
: ---
: ---
Assigned To: Ivana Varekova
Fedora Extras Quality Assurance
: Reopened
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2007-10-28 21:34 EDT by Hans Ulrich Niedermann
Modified: 2007-11-30 17:12 EST (History)
0 users

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2007-10-31 11:04:41 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)
Test input (1.28 KB, text/plain)
2007-10-29 19:32 EDT, Hans Ulrich Niedermann
no flags Details
Run both GNU sed and busybox sed on in.txt (260 bytes, text/plain)
2007-10-29 19:33 EDT, Hans Ulrich Niedermann
no flags Details
Add another forgotten output flush (463 bytes, patch)
2007-10-30 10:13 EDT, Hans Ulrich Niedermann
no flags Details | Diff

  None (edit)
Description Hans Ulrich Niedermann 2007-10-28 21:34:23 EDT
Description of problem:

  In calls like
    /sbin/busybox sed -n '1,$p' /some/textfile > output.txt
  busybox cuts the output to multiples of 1024 (including 0).
  It seems to be independent of the actual sed command given.

Version-Release number of selected component (if applicable):

  busybox-1.6.1-2.fc8 (/sbin/busybox sed)
  bash-3.2-18.fc8 (calls busybox sed)

How reproducible:

  Every time.

Steps to Reproduce:
1. Find a long text file (e.g. /etc/passwd or /etc/abcde.conf)
2. /sbin/busybox sed -n '1,$p' long.txt > output.txt
3. ls -l long.txt output.txt
4. diff -u long.txt output.txt
  
Actual results:

  output.txt is 0, 1024, 4096, 8192 bytes long, while long.txt is longer.

Expected results:

  For text files, long.txt and output.txt should be equal with '1,$p'.

Additional info:

  Workaround:
    /sbin/busybox sed -n '1,$p' long.txt | cat > output.txt
Comment 1 Ivana Varekova 2007-10-29 10:32:12 EDT
Fixed in busybox-1.7.2-2.fc9.
Comment 2 Hans Ulrich Niedermann 2007-10-29 19:31:25 EDT
Not for all cases. I have locally built and installed busybox-1.7.2-2.fc9 from
Fedora CVS - and ran into problems when trying the next sed expression.

Test case being uploaded as attachments.
Comment 3 Hans Ulrich Niedermann 2007-10-29 19:32:53 EDT
Created attachment 242501 [details]
Test input
Comment 4 Hans Ulrich Niedermann 2007-10-29 19:33:50 EDT
Created attachment 242511 [details]
Run both GNU sed and busybox sed on in.txt
Comment 5 Hans Ulrich Niedermann 2007-10-30 10:13:23 EDT
Created attachment 243411 [details]
Add another forgotten output flush

Together with your busybox-1.7.2-sed.patch, this at fixes all my current use
cases.

I'm not saying this is the general solution. I'd need to completely dive into
that code for that degree of confidence.

I guess upstream should take a look at it.
Comment 6 Ivana Varekova 2007-10-31 11:04:41 EDT
Thanks, this problem is fixed in busybox-1.7.2-3.fc9 but fflush in your patch
was on the wrong place. 
Please if there is still any problem please reopen this bug. 
I contacted busybox upstream with this issue so I hope this problem will be
fixed in some new upstream version too.


Note You need to log in before you can comment on or make changes to this bug.