This service will be undergoing maintenance at 00:00 UTC, 2016-08-01. It is expected to last about 1 hours
Bug 132871 - dhcpv6 does not build from unprivileged acct
dhcpv6 does not build from unprivileged acct
Status: CLOSED CURRENTRELEASE
Product: Fedora
Classification: Fedora
Component: dhcpv6 (Show other bugs)
rawhide
All Linux
medium Severity medium
: ---
: ---
Assigned To: Jason Vas Dias
:
Depends On:
Blocks: FC3Target FC4Target
  Show dependency treegraph
 
Reported: 2004-09-18 10:50 EDT by Steve Grubb
Modified: 2007-11-30 17:10 EST (History)
1 user (show)

See Also:
Fixed In Version: dhcpv6-0.10-13
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2005-05-17 18:26:24 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:


Attachments (Terms of Use)
Patch to fix spec file (629 bytes, patch)
2004-09-18 10:51 EDT, Steve Grubb
no flags Details | Diff
Patch to fix make file (1.74 KB, patch)
2004-09-18 10:52 EDT, Steve Grubb
no flags Details | Diff
Patch for Makefile (2.20 KB, patch)
2004-09-27 12:01 EDT, Steve Grubb
no flags Details | Diff

  None (edit)
Description Steve Grubb 2004-09-18 10:50:07 EDT
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 10:51:17 EDT
Created attachment 103975 [details]
Patch to fix spec file
Comment 2 Steve Grubb 2004-09-18 10:52:15 EDT
Created attachment 103976 [details]
Patch to fix make file
Comment 3 Jason Vas Dias 2004-09-20 14:34:43 EDT
 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 08:11:43 EDT
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 10:09:58 EDT
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 10:26:46 EDT
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 12:01:51 EDT
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.

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