Bug #2730

tar misbehaves if compress utility missing

Added by Garrett D'Amore almost 2 years ago. Updated almost 2 years ago.

Status:Resolved Start date:2012-05-13
Priority:Normal Due date:
Assignee:Milan Jurik % Done:

100%

Category:cmd - userland programs Spent time: -
Target version:- Estimated time:2.00 hours
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 (1.7 kB) Milan Jurik, 05/31/2012 05:03 pm

History

Updated by Milan Jurik almost 2 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.

Updated by Milan Jurik almost 2 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.

Updated by Garrett D'Amore almost 2 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 PDF