Bug 132871 - dhcpv6 does not build from unprivileged acct
Summary: dhcpv6 does not build from unprivileged acct
Alias: None
Product: Fedora
Classification: Fedora
Component: dhcpv6
Version: rawhide
Hardware: All
OS: Linux
Target Milestone: ---
Assignee: Jason Vas Dias
QA Contact:
Depends On:
Blocks: FC3Target FC4Target
TreeView+ depends on / blocked
Reported: 2004-09-18 14:50 UTC by Steve Grubb
Modified: 2007-11-30 22:10 UTC (History)
1 user (show)

Fixed In Version: dhcpv6-0.10-13
Doc Type: Bug Fix
Doc Text:
Clone Of:
Last Closed: 2005-05-17 22:26:24 UTC

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

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)

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):

How reproducible:

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

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

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

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:

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.


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