Bug 185598 - Won't build as non-root user
Won't build as non-root user
Status: CLOSED NOTABUG
Product: Red Hat Enterprise Linux 4
Classification: Red Hat
Component: dhcpv6 (Show other bugs)
4.0
All Linux
medium Severity low
: ---
: ---
Assigned To: Jason Vas Dias
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2006-03-15 19:57 EST by John Morris
Modified: 2007-11-30 17:07 EST (History)
0 users

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2006-03-16 17:27:38 EST
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)
Small .spec patch to make configure writable (262 bytes, patch)
2006-03-15 19:57 EST, John Morris
no flags Details | Diff

  None (edit)
Description John Morris 2006-03-15 19:57:03 EST
Created attachment 126185 [details]
Small .spec patch to make configure writable
Comment 1 John Morris 2006-03-15 19:57:03 EST
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 17:27:38 EST
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.

Note You need to log in before you can comment on or make changes to this bug.