Bug 207831

Summary: "rpmbuild -ta example.tar.bz2" sometimes files to extract specfile
Product: [Fedora] Fedora Reporter: Mark Doliner <mark>
Component: rpmAssignee: Paul Nasrat <nobody+pnasrat>
Status: CLOSED DUPLICATE QA Contact: Mike McLean <mikem>
Severity: low Docs Contact:
Priority: medium    
Version: 5   
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2006-09-25 07:35:33 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
Possible fix for this bug none

Description Mark Doliner 2006-09-24 07:32:52 UTC
Description of problem:
In certain cases "rpmbuild -ta example.tar.bz2" will fail to extract the
specfile from within the archive, which results in failure to build the RPM and
a poor error message.

Version-Release number of selected component (if applicable):
rpm-4.4.2-15.2
rpm-build-4.4.2-15.2
rpm-libs-4.4.2-15.2
rpm-python-4.4.2-15.2
tar-1.15.91-1

How reproducible:
100% of the time, assuming the following conditions

Steps to Reproduce:
1. Using GNU tar 1.15.92 or more recent
2. Using a tar.bz2 (I did not test whether this bug affects tar.gz)
3. The specfile within the tar is named "something.spec" and not "Specfile"
4. Run "rpmbuild -ta example.tar.bz2"
  
Actual results:
rpmbuild exits after printing the following error messages are printed:
error: Name field must be present in package: (main package)
error: Version field must be present in package: (main package)
error: Release field must be present in package: (main package)
error: Summary field must be present in package: (main package)
error: Group field must be present in package: (main package)
error: License field must be present in package: (main package)

These messages are printed because the specfile was not extracted from the
tarball.  Instead, the SPECS directory will contain a 0 byte file with the name
"tar: Pattern matching characters used in file names. Please,"  Additionally,
nothing will be placed in the SOURCES or BUILD directories.

Expected results:
The spec file will be written to the SPECS directory, the tarball will be copied
to the SOURCES directory, and the build will continue in the BUILD directory.

Additional info:
This is caused by a change in GNU tar 1.15.92.  As of this version, the
"–wildcards" option must be passed to tar when using wildcard matching, and
rpmbuild uses a wildcard when trying to extract the specfile from bz2balls.  See
http://www.gnu.org/software/tar/manual/html_node/Changes.html for details on the
change to tar.

The attached patch is a hint for someone who wishes to fix this.  I did not test
the patch.  I do not know if passing the "--wildcards" option to tar will work
with versions of tar pre 1.15.92, but I have a hunch that it'll be fine (I get
the feeling that this option has been around for quite some time).

Comment 1 Mark Doliner 2006-09-24 07:32:52 UTC
Created attachment 137010 [details]
Possible fix for this bug

Comment 2 Mark Doliner 2006-09-24 07:34:23 UTC
To RPM builders, a possible workaround is to rename the specfile from
"whatever.spec" to "Specfile"

Comment 3 Mark Doliner 2006-09-24 09:02:52 UTC
Looking at the workaround I mentioned in comment #2... I guess it's pretty
unlikely that will work.  I thought it would because rpmbuild first tries to
extract "Specfile" and then tries to extract "*.spec"  However the call that
tries to extract "Specfile" doesn't seem very useful to me--I think it only
works when Specfile is at the first root of the tarball (not in a directory). 
In Gaim tarballs (and other projects I've seen), the specfile will actually be
located under the "gaim-2.0.0-beta3/" directory for example.

Comment 4 Paul Nasrat 2006-09-25 07:35:33 UTC

*** This bug has been marked as a duplicate of 206841 ***