Bug 458906

Summary: torcs.spec doesn't extract .tgz sources in CentOS 5.2
Product: [Fedora] Fedora Reporter: David Savinkoff <dsavnkff>
Component: torcsAssignee: Matthias Saou <matthias>
Status: CLOSED NOTABUG QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: medium Docs Contact:
Priority: medium    
Version: rawhide   
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: 2008-08-13 09:08:18 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:

Description David Savinkoff 2008-08-13 03:39:02 UTC
User-Agent:       Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.8.1.16) Gecko/20080713 SeaMonkey/1.1.11

I couldn't compile torcs-1.3.0-7.fc10.src.rpm on CentOS 5.2
until I modified torcs.spec with:

%setup -q -T -D -a 1 -T -D -a 2 -T -D -a 3 -T -D -a 4

The original torcs.spec has: %setup -q -a 1 -a 2 -a 3 -a 4

Torcs now compiles without problems, and works like a charm!

Note that the problem is with torcs.spec and not with the
%setup macro. Please update torcs.spec and test that it works
on Fedora also.


Reproducible: Always

Steps to Reproduce:
1. rpm -ivh torcs-1.3.0-7.fc10.src.rpm     ## on CentOS 5.2 ##
2. rpmbuild -ba --define 'dist .el5'  torcs.spec

Actual Results:  
[regular@localhost SPECS]$ rpmbuild -ba --define 'dist .el5' torcs.spec
Executing(%prep): /bin/sh -e /var/tmp/rpm-tmp.43704
+ umask 022
+ cd /usr/src/redhat/BUILD
+ LANG=C
+ export LANG
+ unset DISPLAY
+ cd /usr/src/redhat/BUILD
+ rm -rf torcs-1.3.0
+ /bin/gzip -dc /usr/src/redhat/SOURCES/TORCS-1.3.0-src.tgz
+ tar -xf -
tar: .: Cannot utime: Operation not permitted
tar: Error exit delayed from previous errors
error: Bad exit status from /var/tmp/rpm-tmp.43704 (%prep)


RPM build errors:
    Bad exit status from /var/tmp/rpm-tmp.43704 (%prep)
[regular@localhost SPECS]$ 

( Yes, I build under /usr/src/redhat  I've done a chmod 1777 to
  the appropriate subdirectories to make them act like /tmp )


Expected Results:  
Build succeeds.

Comment 1 Matthias Saou 2008-08-13 09:08:18 UTC
This is clearly not a spec file problem. I see that the torcs tarball was made in a weird-ish way, where it extracts as "./foo/..." instead of "foo/...", so it's probably trying to do some changes to "." which aren't permitted in your case.

Using that ugly hack just to work around this is not something I'll implement. My opinion is that you shouldn't be building in a directory similar to /tmp in which multiple users can write, or if you do, deal with the consequences (i.e. clashes with some other user's files, a tarball extracting world writeable files which can potentially be overwritten by other users of the system while you're building, etc.).

I don't even understand how when adding "-T" you still get Source0 to get unpacked. And using "-D" seems completely wrong as you can get unexpected results if you re-run the build with the previous one not having completed %clean.

Come to think of it, I think (but haven't tested) that the only reason why "-T" has worked for you was because you had a leftover build and ran the next with "-D", meaning that if you clean out your /usr/src/redhat/ directory properly, your hack won't even work anymore!

Two solutions :
 * Inform the torcs developers that their tarball is different from the "usual" ones, and ask them if they can fix that.
 * Build in a directory tree which is only accesssible by your current user and no one else.

Comment 2 David Savinkoff 2008-08-13 19:08:08 UTC
(In reply to comment #1)
> This is clearly not a spec file problem. I see that the torcs tarball was made
> in a weird-ish way, where it extracts as "./foo/..." instead of "foo/...", so
> it's probably trying to do some changes to "." which aren't permitted in your
> case.
> 
> Using that ugly hack just to work around this is not something I'll implement.
> My opinion is that you shouldn't be building in a directory similar to /tmp in
> which multiple users can write, or if you do, deal with the consequences (i.e.
> clashes with some other user's files, a tarball extracting world writeable
> files which can potentially be overwritten by other users of the system while
> you're building, etc.).
> 
> I don't even understand how when adding "-T" you still get Source0 to get
> unpacked. And using "-D" seems completely wrong as you can get unexpected
> results if you re-run the build with the previous one not having completed
> %clean.
> 
> Come to think of it, I think (but haven't tested) that the only reason why "-T"
> has worked for you was because you had a leftover build and ran the next with
> "-D", meaning that if you clean out your /usr/src/redhat/ directory properly,
> your hack won't even work anymore!
> 
> Two solutions :
>  * Inform the torcs developers that their tarball is different from the "usual"
> ones, and ask them if they can fix that.
>  * Build in a directory tree which is only accesssible by your current user and
> no one else.

Note that the scope of the 'leftover build' is within the build,
and previous build gets erased before the tarballs are re-extracted.

My previous hack was to extract the .tgz tarballs and make .bz2 's.
(maybe there IS a problem somewhere)

The following will Always work because it uses The Force:
%setup -q -T -D -a 1 -T -D -a 2 -T -D -a 3 -T -D -a 4
Using less force probably works because SELinux isn't ENFORCING.