Bug #3820
closed/usr/bin/sed doesn't handle binary files.
100%
Description
The "bug" is very simple. Internally, sed uses fgets() to read the lines of the input files. This means embedded zero bytes are completely ignored among other weird behavior when binary files are read in.
It makes /usr/bin/sed completely useless to extract zip contents from an executable python script. Example:
sed -e 1d python-zip-script > python-zip-script.zip
Where python-zip-script is a file with !#/usr/bin/python
in the first line, and the rest is a zip packaged python application.
GNU sed handles this just fine.
Files
Updated by Johann Oskarsson almost 10 years ago
- File main.c-getline.diff main.c-getline.diff added
- Status changed from New to In Progress
- % Done changed from 0 to 10
This patch removes the custom fgetln() replacement and uses getline() to read the lines.
Updated by Johann Oskarsson almost 10 years ago
- Assignee set to Johann Oskarsson
- % Done changed from 10 to 90
The webrev for the final change is here:
http://www.myrkraverk.com/~johann/webrev/illumos/3820-1/
It's been reviewed by Josef 'Jeff' Sipek and Richard Lowe.
Updated by Robert Mustacchi almost 10 years ago
Resolved in e3eaa28d3fe8168d8e638eb7030062ea13c13d76.
Updated by Robert Mustacchi almost 10 years ago
- Status changed from In Progress to Resolved
- Tags deleted (
needs-triage)