tar misbehaves if compress utility missing
|Assignee:||Milan Jurik||% Done:|
|Category:||cmd - userland programs||Estimated time:||2.00 hours|
tar doesn't deal well with the situation where bzip2 or gzip (and in the future xz) are missing.
IMO, we should deal with that exec failing better, but that might be hard to do. The most likely failure mode is the utility is absent or doesn't have the right mode bits, so if we just stat() before we fork() and exec(), that would go very far in covering the most likely error cases.
This is important as these utilities cross consolidation and packaging boundaries, and some distros might elect not to install them.
More detail from Milan:
$ LC_ALL=C tar tf t.tar.xz
tar: Could not exec /usr/bin/xzcat: No such file or directory
tar: blocksize = 0
$ LC_ALL=C tar cvJf t.tar.xz nscd
Compressing 't.tar.xz' with '/usr/bin/xz'...
tar: Could not exec /usr/bin/xz: No such file or directory
a nscd 0K
a nscd/getprinter.c 2K
a nscd/gethost.c 3K
a nscd/cache.o 31K
This ends in empty file, ending in the middle of work.
Returns error 141.
The same as in case of gzip/bzip2 missing. No change in behavior.
Probably it could be improved but nobody cared yet.
#2 Updated by Milan Jurik almost 4 years ago
- File verify_tar.diff added
- Status changed from In Progress to Pending RTI
- % Done changed from 0 to 100
Basics implemented. More precise detection of return values and handling of temporary tarfiles during update need some additional steps and small redesign.
#3 Updated by Garrett D'Amore almost 4 years ago
- Status changed from Pending RTI to Resolved
user: Milan Jurik <email@example.com>
date: Tue Jun 05 10:09:55 2012 -0700
2730 tar misbehaves if compress utility missing
2731 add -a --auto feature to tar for gtar comptability
Reviewed by: Josef 'Jeff' Sipek <firstname.lastname@example.org>
Reviewed by: Richard Lowe <email@example.com>
Approved by: Garrett D'Amore <firstname.lastname@example.org>
Also available in: Atom