Re: Building ports as a regular user fails with PLIST_DB & other permission errors

2016-03-26 Thread Karl O. Pinc
Hi,

Since this thread has moved to the ports list
here is a summary:

In this post 
(http://marc.info/?l=openbsd-bugs=145857291803335=2)
to the bugs list I reported that when building with a read-only
ports tree the ports tree was written to.  At least
when building with a read-only ports tree as a regular
user as I detailed.

I suggested that
  Perhaps BULK_COOKIES_DIR, UPDATE_COOKIES_DIR, and
  PLIST_DB in bsd.port.mk should all be based off of
  PACKAGE_REPOSITORY rather than PORTSDIR...
to fix the problem.

After a couple of exchanges the thread got moved here
as below:

On Tue, 22 Mar 2016 00:25:04 +
Raf Czlonka  wrote:

> On Tue, Mar 22, 2016 at 12:19:37AM GMT, Karl O. Pinc wrote:
> > Hi Raf,
> > 
> > Thanks for the reply.
> > 
> > On Tue, 22 Mar 2016 00:02:58 +
> > Raf Czlonka  wrote:
> >   
> > > On Mon, Mar 21, 2016 at 03:03:15PM GMT, Karl O. Pinc wrote:  
> >   
> > > > OpenBSD 5.8-stable.
> > > > 
> > > > I tried following the instructions in ports(7)
> > > > and the FAQ to build ports as an ordinary user.
> > > > I added to /etc/mk.conf:
> > > > 
> > > > WRKOBJDIR=/usr/obj/ports
> > > > DISTDIR=/usr/distfiles
> > > > PACKAGE_REPOSITORY=/usr/packages
> > > 
> > > If you leave the defaults and don't explicitly set any of the
> > > above, all the relevant directories will be under /usr/ports,
> > > which can make your life easier (see below):
> > > 
> > > PORTSDIR=/usr/ports
> > > DISTDIR=${PORTSDIR}/distfiles
> > > WRKOBJDIR=${PORTSDIR}/pobj
> > > PACKAGE_REPOSITORY=${PORTSDIR}/packages  
> > 
> > But if I do this I have to make /usr/ports writable by my
> > user.   Or parts thereof.  See below.
> >   
> > > > I then tried to build a port with:
> > > > 
> > > > make package LOCKDIR= BULK=Yes
> > > > 
> > > > I got permission errors writing the package list
> > > > since my user does not have permissions to write
> > > > in /usr/ports/.  Apologies, I did not copy the
> > > > exact error.
> > > 
> > > This is not a bug - the FAQ clearly states[0] what you need to
> > > do.  
> > 
> > I followed the FAQ where it says:
> > 
> >  It is possible to use a read-only ports tree by separating
> > directories that are written to during port building:
> > 
> > The working directory of ports. This is controlled by the
> > WRKOBJDIR variable, which specifies the directory which will
> > contain the working directories. The directory containing
> > distribution files. This is controlled by the DISTDIR variable. The
> > directory containing newly built binary packages. This is
> > controlled by the PACKAGE_REPOSITORY variable. 
> > 
> >  For example, you could add the following lines to /etc/mk.conf:
> > 
> > WRKOBJDIR=/usr/obj/ports
> > DISTDIR=/usr/distfiles
> > PACKAGE_REPOSITORY=/usr/packages
> > 
> >  If desired, you can also change the ownership of these directories
> > to your local username and group, so that the ports system can
> > create the underlying working directories as a regular user.
> > 
> > But the above is wrong, since setting PACKAGE_REPOSITORY is not
> > enough. If you follow the above you must be root (unless
> > frobbing the ownership of /usr/ports).  In any case /usr/ports
> > is written to, although not the subdirectories that come in the
> > ports tarball.
> > 
> > Of course it may not be possible to both build ports as an ordinary
> > user and have a read-only /usr/ports/ -- but this is not clear
> > from the FAQ.   Hence my email.
> > 
> > Regards,
> > 
> > Karl 
> > Free Software:  "You don't pay back, you pay forward."
> >  -- Robert A. Heinlein  
> 
> You have included a link which seems you have missed. Read it,
> please.

I've not been able to discern what to read to fix this problem
at my end.  You'll have to point me to some specific text
for me to 

To confirm that the problem is not specific to building
ports as a regular user I built some ports as root,
following the quoted instructions above.  But I mounted /usr/ports/
read-only.  Here's the output for building autoconf
(with "make package LOCKFILE="):

===>  Building package for autoconf-2.13p3
Create /usr/packages/i386/all/autoconf-2.13p3.tgz
checksumming|*|100%\
mkdir /usr/ports/plist: Read-only file system
at /usr/libdata/perl5/OpenBSD/Pkg\ Create.pm line 1390.
*** Error 1 in 2.13 (/usr/ports/infrastructure/mk/bsd.port.mk:1956
'/usr/packag\ es/i386/all/autoconf-2.13p3.tgz')
*** Error 1 in 2.13 (/usr/ports/infrastructure/mk/bsd.port.mk:2508
'_internal-p\ ackage')
===> Exiting devel/autoconf/2.13 with an error
*** Error 1 in /usr/ports/devel/autoconf
(/usr/ports/infrastructure/mk/bsd.port\ .subdir.mk:147 'package')

Hacking /etc/mk.conf (in lieu of changing bsd.port.mk 
per my suggestion for a real fix at top, since /usr/ports/
was read-only) with the following lines fixed the problem.
I could then build autoconf as root with /usr/ports/
mounted read-only 

Re: Building ports as a regular user fails with PLIST_DB & other permission errors

2016-03-21 Thread Raf Czlonka
On Tue, Mar 22, 2016 at 12:19:37AM GMT, Karl O. Pinc wrote:
> Hi Raf,
> 
> Thanks for the reply.
> 
> On Tue, 22 Mar 2016 00:02:58 +
> Raf Czlonka  wrote:
> 
> > On Mon, Mar 21, 2016 at 03:03:15PM GMT, Karl O. Pinc wrote:
> 
> > > OpenBSD 5.8-stable.
> > > 
> > > I tried following the instructions in ports(7)
> > > and the FAQ to build ports as an ordinary user.
> > > I added to /etc/mk.conf:
> > > 
> > > WRKOBJDIR=/usr/obj/ports
> > > DISTDIR=/usr/distfiles
> > > PACKAGE_REPOSITORY=/usr/packages  
> > 
> > If you leave the defaults and don't explicitly set any of the above,
> > all the relevant directories will be under /usr/ports, which can
> > make your life easier (see below):
> > 
> > PORTSDIR=/usr/ports
> > DISTDIR=${PORTSDIR}/distfiles
> > WRKOBJDIR=${PORTSDIR}/pobj
> > PACKAGE_REPOSITORY=${PORTSDIR}/packages
> 
> But if I do this I have to make /usr/ports writable by my
> user.   Or parts thereof.  See below.
> 
> > > I then tried to build a port with:
> > > 
> > > make package LOCKDIR= BULK=Yes
> > > 
> > > I got permission errors writing the package list
> > > since my user does not have permissions to write
> > > in /usr/ports/.  Apologies, I did not copy the
> > > exact error.  
> > 
> > This is not a bug - the FAQ clearly states[0] what you need to do.
> 
> I followed the FAQ where it says:
> 
>  It is possible to use a read-only ports tree by separating directories
>  that are written to during port building:
> 
> The working directory of ports. This is controlled by the WRKOBJDIR
> variable, which specifies the directory which will contain the
> working directories. The directory containing distribution files.
> This is controlled by the DISTDIR variable. The directory
> containing newly built binary packages. This is controlled by the
> PACKAGE_REPOSITORY variable. 
> 
>  For example, you could add the following lines to /etc/mk.conf:
> 
> WRKOBJDIR=/usr/obj/ports
> DISTDIR=/usr/distfiles
> PACKAGE_REPOSITORY=/usr/packages
> 
>  If desired, you can also change the ownership of these directories to
>  your local username and group, so that the ports system can create the
>  underlying working directories as a regular user.
> 
> But the above is wrong, since setting PACKAGE_REPOSITORY is not
> enough. If you follow the above you must be root (unless
> frobbing the ownership of /usr/ports).  In any case /usr/ports
> is written to, although not the subdirectories that come in the
> ports tarball.
> 
> Of course it may not be possible to both build ports as an ordinary
> user and have a read-only /usr/ports/ -- but this is not clear
> from the FAQ.   Hence my email.
> 
> Regards,
> 
> Karl 
> Free Software:  "You don't pay back, you pay forward."
>  -- Robert A. Heinlein

You have included a link which seems you have missed. Read it, please.

Aslo, moving this to ports@

Raf