Steve Cohen | 11 Feb 04:46 2005

Victory - built subversion from RH9 source rpm!

Those who have been following the saga of my attempt (did I hear someone 
say quixotic) to build Subversion from the Source RPMs will be happy to 
know that I have finally achieved this goal.

What I learned along the way may be of interest to those who are putting
together Subversion source rpms for Linux systems as well as to those 
who try to build from these RPMs.

Actually, I already had a version of SVN 1.1.3 running, built on my 
Redhat 9 system from David Summers binary RPMs.  Thanks, David.

But I wanted source so I could build JavaHL and put it into subeclipse. 
  I still haven't even gotten to that part yet, I spent the better part 
of a week getting the source RPM to build.  Which is the subject of this 
tale.

For those who haven't been following, the problems came during the
running of the tests that are included in the source rpm.  Yes, I know,
these can be turned off in the spec file, but maybe they're important? 
Someone turned them on for a reason.  What was the reason?  Who am I to 
take them out?  Anyway, that's the sort of guy I am.  I don't like 
taking the easy way out.

The tests that failed were always those following this line:
*** Running regression tests on RA_DAV (HTTP method) layer ***

as follows:

+ killall httpd
+ sleep 1
(Continue reading)

Kenneth Porter | 11 Feb 05:09 2005

Re: Victory - built subversion from RH9 source rpm!

--On Thursday, February 10, 2005 9:46 PM -0600 Steve Cohen 
<scohen <at> javactivity.org> wrote:

> For one thing, the Apache documentation says that the User directive is
> only applicable when running as root - and I was building as root,
> against the advice of more experienced Linux administrative types.  How
> would you handle this if you were not root?  You'd have to modify the
> httpd.conf file.

First, glad you got it working.

This is really the heart of the problem, though. You were building as root, 
and the SRPM was *designed* to be built as a mortal. As a mortal, one would 
not have User/Group directives in the file in the first place. They're only 
needed when running as root, and since you're not supposed to build as 
root, you shouldn't need them.

Perhaps one solution is to fail the build early if trying to build as root 
(ie. `id -u` evaluates to zero). This would at least document the 
assumption made by the test.

BTW, is Apache (package httpd) a BuildPrereq in that SRPM? It should be, 
since it's needed for the test phase. Are there any distros that ship an 
httpd package that does NOT create the user apache? Given that assumption, 
and if the devs desire to add root-building capability to the package, it 
should be reasonable to ship a second Apache config file with User/Group 
directives set appropriately and use it if one is building as root.
Steve Cohen | 11 Feb 06:22 2005

Re: Victory - built subversion from RH9 source rpm!

Kenneth Porter wrote:
> --On Thursday, February 10, 2005 9:46 PM -0600 Steve Cohen 
> <scohen <at> javactivity.org> wrote:
> 
>> For one thing, the Apache documentation says that the User directive is
>> only applicable when running as root - and I was building as root,
>> against the advice of more experienced Linux administrative types.  How
>> would you handle this if you were not root?  You'd have to modify the
>> httpd.conf file.
> 
> 
> First, glad you got it working.
> 
> This is really the heart of the problem, though. You were building as 
> root, and the SRPM was *designed* to be built as a mortal. As a mortal, 
> one would not have User/Group directives in the file in the first place. 
> They're only needed when running as root, and since you're not supposed 
> to build as root, you shouldn't need them.
> 
> Perhaps one solution is to fail the build early if trying to build as 
> root (ie. `id -u` evaluates to zero). This would at least document the 
> assumption made by the test.
> 
> BTW, is Apache (package httpd) a BuildPrereq in that SRPM? It should be, 
> since it's needed for the test phase. Are there any distros that ship an 
> httpd package that does NOT create the user apache? Given that 
> assumption, and if the devs desire to add root-building capability to 
> the package, it should be reasonable to ship a second Apache config file 
> with User/Group directives set appropriately and use it if one is 
> building as root.
(Continue reading)

Kenneth Porter | 11 Feb 07:24 2005

Re: Victory - built subversion from RH9 source rpm!

--On Thursday, February 10, 2005 11:22 PM -0600 Steve Cohen 
<scohen <at> javactivity.org> wrote:

> Well, I'm trying it your way now.  I'll let you know how it comes out.
> I've been building SRPMS for years as root without ever knowing that this
> was frowned upon.  In fact, I always assumed I HAD to be root to build
> RPMs, if I even thought about it. Not sure where I got that idea.   Maybe
> because you have to become root to INSTALL packages and I just assumed
> that building them was the same.  I'm not one of those who is always
> root.  Only rarely do I find it necessary to become root but I thought
> this was one of those times.

When I started building SRPMS back in Red Hat 5.2 days, I couldn't imagine 
having to be root to do it, so I asked on the RPM mailing list and found 
the black magic for doing it as a mortal. The only package forcing me to be 
root to build it was the old 2.2 kernel, because the spec file insisted on 
executing mknod to create some device nodes to package. But someone 
invented the fakeroot package to get around even this limitation. And now 
RPM supports creation of device nodes in the %files list, so that kludge is 
no longer necessary.

I tried to complain about the misleading nature of /usr/src/redhat but 
couldn't make any traction:

<https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=143746>
Kenneth Porter | 11 Feb 07:31 2005

Re: Victory - built subversion from RH9 source rpm!

--On Thursday, February 10, 2005 9:46 PM -0600 Steve Cohen 
<scohen <at> javactivity.org> wrote:

>  From there, a simple google quickly brought me to the nub of the issue:
> The User and Group directives in the httpd.conf that comes in the source
> RPM were commented out - and apache can't start without them.

I went back to see what was going on and found this file:

subversion/tests/clients/cmdline/davautocheck.sh

View-CVS link for same:

<http://svn.collab.net/viewcvs/svn/tags/1.1.3/subversion/tests/clients/
cmdline/davautocheck.sh?rev=12740&view=log>

This script runs Apache and then the tests. It appears to create the Apache 
config file, and I don't see how it can do so with commented-out User and 
Group directives. Does the spec file edit the Apache config after running 
this? I don't see anything in the Fedora 3 Updates spec file for 1.1.2 
(latest that I'm running) that does this.
John Peacock | 11 Feb 12:43 2005

Re: Victory - built subversion from RH9 source rpm!

Kenneth Porter wrote:
> Perhaps one solution is to fail the build early if trying to build as 
> root (ie. `id -u` evaluates to zero). 

Except that under Solaris (I believe), root's UID is 1.

> BTW, is Apache (package httpd) a BuildPrereq in that SRPM? It should be, 
> since it's needed for the test phase. Are there any distros that ship an 
> httpd package that does NOT create the user apache? 

Yes, SuSE's Apache user is wwwrun and OS X uses www (if I remeber correctly). 
That's why you usually see a page of RPM's specific to each distro because they 
all do it just a little differently... :-(

John

--

-- 
John Peacock
Director of Information Research and Technology
Rowman & Littlefield Publishing Group
4720 Boston Way
Lanham, MD 20706
301-459-3366 x.5010
fax 301-429-5747
Steve Cohen | 11 Feb 12:59 2005

Re: Victory - built subversion from RH9 source rpm!

Kenneth Porter wrote:
> --On Thursday, February 10, 2005 11:22 PM -0600 Steve Cohen 
> <scohen <at> javactivity.org> wrote:
> 
>> Well, I'm trying it your way now.  I'll let you know how it comes out.

It worked!

>> I've been building SRPMS for years as root without ever knowing that this
>> was frowned upon.  In fact, I always assumed I HAD to be root to build
>> RPMs, if I even thought about it. Not sure where I got that idea.   Maybe
>> because you have to become root to INSTALL packages and I just assumed
>> that building them was the same.  I'm not one of those who is always
>> root.  Only rarely do I find it necessary to become root but I thought
>> this was one of those times.
> 
> 
> When I started building SRPMS back in Red Hat 5.2 days, I couldn't 
> imagine having to be root to do it, so I asked on the RPM mailing list 
> and found the black magic for doing it as a mortal. 

That would be changing the ownership of /usr/src/redhat?  Actually, I 
didn't even have to do that.  I chmodded it to g+w and put myself into 
the root group.  That also did the job.

> 
> I tried to complain about the misleading nature of /usr/src/redhat but 
> couldn't make any traction:
> 
> <https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=143746>
(Continue reading)


Gmane