/usr/bin/sed doesn't handle binary files.
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.
Updated by Johann Oskarsson over 8 years ago
- Assignee set to Johann Oskarsson
- % Done changed from 10 to 90
The webrev for the final change is here:
It's been reviewed by Josef 'Jeff' Sipek and Richard Lowe.