Bug #2730

tar misbehaves if compress utility missing

Added by Garrett D'Amore over 3 years ago. Updated about 3 years ago.

Status:ResolvedStart date:2012-05-13
Priority:NormalDue date:
Assignee:Milan Jurik% Done:

100%

Category:cmd - userland programsEstimated time:2.00 hours
Target version:-
Difficulty:Medium Tags:

Description

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.

verify_tar.diff Magnifier (1.74 KB) Milan Jurik, 2012-05-31 05:03 PM

History

#1 Updated by Milan Jurik over 3 years ago

  • Status changed from New to In Progress
  • Assignee set to Milan Jurik

stat() is the necessary first step. The other would be better monitoring of return values from compress tools. The third is better error reporting.

#2 Updated by Milan Jurik over 3 years ago

  • File verify_tar.diffMagnifier 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 about 3 years ago

  • Status changed from Pending RTI to Resolved

Resolved in:

changeset: 13710:3cee4ba952f0
tag: tip
user: Milan Jurik <>
date: Tue Jun 05 10:09:55 2012 -0700
description:
2730 tar misbehaves if compress utility missing
2731 add -a --auto feature to tar for gtar comptability
Reviewed by: Josef 'Jeff' Sipek <>
Reviewed by: Richard Lowe <>
Approved by: Garrett D'Amore <>

Also available in: Atom