Bug 185598

Summary: Won't build as non-root user
Product: Red Hat Enterprise Linux 4 Reporter: John Morris <jmorris>
Component: dhcpv6Assignee: Jason Vas Dias <jvdias>
Status: CLOSED NOTABUG QA Contact:
Severity: low Docs Contact:
Priority: medium    
Version: 4.0   
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-03-16 22:27:38 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
Small .spec patch to make configure writable none

Description John Morris 2006-03-16 00:57:03 UTC
Created attachment 126185 [details]
Small .spec patch to make configure writable

Comment 1 John Morris 2006-03-16 00:57:03 UTC
Description of problem:

Attempts to build as a non-root user fail with a permissions error.

Version-Release number of selected component (if applicable):

dhcpv6-0.10-14_EL4

How reproducible:

Always

Steps to Reproduce:
1. rpmbuild --rebuild dhcpv6-0.10-14_EL4.src.rpm
  
Actual results:

+ export 'LDFLAGS=-pie -Wl,-z,relro,-z,now,-z,nodlopen,-z,noexecstack'
+ LDFLAGS='-pie -Wl,-z,relro,-z,now,-z,nodlopen,-z,noexecstack'
+ autoconf
autom4te: cannot open configure: Permission denied
error: Bad exit status from /var/tmp/rpm-tmp.502 (%build)
 
 
RPM build errors:
    Bad exit status from /var/tmp/rpm-tmp.502 (%build)

configure needs to be writable, fixable from within the .spec with patch below

Comment 2 Jason Vas Dias 2006-03-16 22:27:38 UTC
Hmm, very strange - this does not happen for me - how were you building dhcpv6 ?

If you had used rpmbuild to build the package, then rpmbuild would do:
  + /bin/chmod -Rf a+rX,u+w,g-w,o-w .

But if you are rebuilding as a non-root user, rpmbuild would need to be told
to install things in different directories - 
/usr/src/redhat/{SOURCES,BUILD,RPMS,SRPMS,SPECS}
where rpmbuild installs files and does builds is typically not writable by
non-root users by default.

I tested this as a non-root user, and did:
$ mkdir /tmp/dhcpv6-test
$ cd /tmp/dhcpv6-test
$ rpm -ivh --define '_sourcedir /tmp/dhcpv6-test' \
           --define '_specdir /tmp/dhcpv6-test' \
           /tmp/dhcpv6-0.10-14_EL4.src.rpm
$ rpmbuild --define '_sourcedir /tmp/dhcpv6-test' \
           --define '_specdir /tmp/dhcpv6-test' \
           --define '_builddir /tmp/dhcpv6-test' \
           --define '_srcrpmdir /tmp/dhcpv6-test' \
           --define '_rpmdir /tmp/dhcpv6-test' \
           -ba dhcpv6.spec
This worked fine. I also tried:
$ rpmbuild --rebuild \
           --define '_sourcedir /tmp/dhcpv6-test' \
           --define '_specdir /tmp/dhcpv6-test' \
           --define '_builddir /tmp/dhcpv6-test' \
           --define '_srcrpmdir /tmp/dhcpv6-test' \
           --define '_rpmdir /tmp/dhcpv6-test' \
           /tmp/dhcpv6-0.10-14_EL4.src.rpm
This also worked fine.

rpmbuild should be changing all permissions correctly:
$ rpm --showrc | grep fixperms
-14: _fixperms  %{__chmod} -Rf a+rX,u+w,g-w,o-w

Did you not use rpmbuild to build the RPM ? If not, then do:
  # chmod -Rf a+rX,u+w,g-w,o-w .
before building in the current directory.

We can only ensure that all our packages build OK as a 
non-root user if built by rpmbuild - we cannot implement support
for every conceivable method of rebuilding a package without rpmbuild, 
or for building into /usr/src/redhat/* as a non-root userid if those
directories are not modifiable by a non-root user.