Bug 132871

Summary: dhcpv6 does not build from unprivileged acct
Product: [Fedora] Fedora Reporter: Steve Grubb <linux_4ever>
Component: dhcpv6Assignee: Jason Vas Dias <jvdias>
Status: CLOSED CURRENTRELEASE QA Contact:
Severity: medium Docs Contact:
Priority: medium    
Version: rawhideCC: redhat-bugzilla
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: dhcpv6-0.10-13 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2005-05-17 22:26:24 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:
Bug Depends On:    
Bug Blocks: 123268, 136451    
Attachments:
Description Flags
Patch to fix spec file
none
Patch to fix make file
none
Patch for Makefile none

Description Steve Grubb 2004-09-18 14:50:07 UTC
From Bugzilla Helper:
User-Agent: Mozilla/5.0 (X11; U; Linux i586; en-US; rv:1.4.2)
Gecko/20040308

Description of problem:
The BuildRequires is missing flex and bison. Additionally, when you
build the rpm, you have to do it from root which is bad because of the
Makefiles. You should be able to build this package as a normal user.

I will attach 2 patches that fix this.

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

How reproducible:
Always

Steps to Reproduce:
1. rpm -e --nodeps bison flex
2. rpmbuild -bb dhcpv6.spec

Additional info:

Comment 1 Steve Grubb 2004-09-18 14:51:17 UTC
Created attachment 103975 [details]
Patch to fix spec file

Comment 2 Steve Grubb 2004-09-18 14:52:15 UTC
Created attachment 103976 [details]
Patch to fix make file

Comment 3 Jason Vas Dias 2004-09-20 18:34:43 UTC
 This is now fixed :
 There were two problems here:
 1. The spec file lacked 'BuildRequires: flex, bison'
    this is now added.

 2. The build works fine as a none root user with the command:
    'rpmbuild --rebuild dhcpv6*.src.rpm' 
    This correctly produces an rpm with the binary files installed
    correctly, as a non-root user, using the default $RPM_BUILD_ROOT 
    - the  'rpmbuild -bb' would seem not to be using the correct 
    RPM_BUILD_ROOT, for which non-root users do not have permission
    on your system ?


      

Comment 4 Steve Grubb 2004-09-22 12:11:43 UTC
wrt #1, thanks.

Regarding #2, it cannot work correctly for a non-root acct. If you
look at the makefile's install target, you will see that its trying to
set the file owner and group to the bin account. And dhcp6s.sh is
beeing set for root ownership. Only root may do that. FWIW, my build
root is within my build acct's home directory. It has full permissions
there.

The only way to make it work is to patch the makefile.

Do I need to re-open the bug or did the makefile get patched?

Comment 5 Jason Vas Dias 2004-09-22 14:09:58 UTC
I still don't see this problem. 
The Makefile uses commands like:

/usr/bin/install -c -s -o bin -g bin dhcp6s
/var/tmp/dhcpv6-0.10-root/usr/sbin

I've tested /usr/bin/install (both from coreutils-5.2.1-24 & 5.2.1-7)
and it allows non-root users to specify '-o bin -g bin' or even 
'-o root -g root' with no error - it just doesn't set the ownerships /
groups - this is OK, because ownerships / groups are set by the RPM
install.

All our automated builds are done by non-root users and they complete
without errors.

If I patch the Makefile to remove the '-o <user> -g <group>', then 
it then cannot be used for doing an actual install outside the RPM .

I suspect you are using a non-standard /usr/bin/install that returns
an error for '-o <user> -g <group>' by non-root users instead of 
silently ignoring them.
  
I will include the patch in the next RPM as
'dhcpv6-0.10-build-non-root.patch' ,
which can be optionally applied by users,
but I don't think the RPM build should apply it automatically,
as it would break non-RPM builds.
 

Comment 6 Steve Grubb 2004-09-22 14:26:46 UTC
OK. I see what you are trying to solve. I have another way to solve it
that may be better. How about if I re-work the patch so that it uses
shell variables for the accts. Then the shell variables can be
overridden on the make install line in the spec file. 

I've used this trick before and it would solve the problem in a way
that people using makefiles wouldn't notice a difference and people
using the spec file build under a non-privileged acct.

FWIW, the install program that I'm using is the one in rawhide.

Do you want a new patch?

Comment 7 Steve Grubb 2004-09-27 16:01:51 UTC
Created attachment 104380 [details]
Patch for Makefile

The problem still exists in dhcpv6-0.10-7. I have a new patch that addresses
the concern about using the Makefile for non-rpm builds. The %install section
needs to be this:

%install
rm -rf %{buildroot}
make DESTDIR=%{buildroot} BIN_OWNER=`id -nu` ROOT_OWNER=`id -nu` install
mkdir -p %{buildroot}%{_localstatedir}/lib/dhcpv6

This way the override is passed on the make install line. The defaults in the
Makefile use bin & root respectively. This is the same technique used by
SysVinit.spec file if you wanted to double check the validity of this concern.

Thanks.