ports/106608: Perl 5.8 port does not respect environment variables (custom paths) and thus fails installation as non-root user

Steffen Boelaars boelaars at flatrock.eu
Mon Dec 11 16:47:21 UTC 2006


>Number:         106608
>Category:       ports
>Synopsis:       Perl 5.8 port does not respect environment variables (custom paths) and thus fails installation as non-root user
>Confidential:   no
>Severity:       serious
>Priority:       high
>Responsible:    freebsd-ports-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Mon Dec 11 16:40:13 GMT 2006
>Closed-Date:
>Last-Modified:
>Originator:     Steffen Boelaars
>Release:        6.0-RELEASE
>Organization:
Flat Rock ICT Services
>Environment:
FreeBSD hidden.hidden 6.0-RELEASE FreeBSD 6.0-RELEASE #0: Mon Dec 12 23:29:47 CET 2005     hidden at hidden.hidden:/usr/obj/usr/src/sys/GENERIC  i386
>Description:
At some point during the lang/perl5.8 installation the system uses hardcoded references to update files in /etc. Because of this, installation as a non-root user fails, since they don't have write permission in /etc. The installation should respect the different invironment variables set for paths (f.e. $PREFIX), but it doesn't even look at them.

A log snippet from where it goes wrong (Note that the first lines are still correct, with the custom PKG_PREFIX specified):

===== LOG SNIPPET START =====
/bin/mkdir -p /home/users/whiter/apps/lib/perl5/5.8.8/BSDPAN/ExtUtils
install  -o whiter -g users -m 444  /home/users/whiter/tmp/BSDPAN-5.8.8/ExtUtils/Packlist.pm /home/users/whiter/apps/lib/perl5/5.8.8/BSDPAN/ExtUtils/Packlist.pm
PKG_PREFIX=/home/users/whiter/apps /bin/sh /home/users/whiter/tmp/pkg-install perl-5.8.8 POST-INSTALL
Removing stale symlinks from /usr/bin...
    Removing /usr/bin/perl
rm: /usr/bin/perl: Permission denied
    Removing /usr/bin/perl5
rm: /usr/bin/perl5: Permission denied
Done.
Creating various symlinks in /usr/bin...
    Backing up /usr/bin/perl as /usr/bin/perl.freebsd
mv: rename /usr/bin/perl to /usr/bin/perl.freebsd: Permission denied
    *** /usr/bin/perl is still there, which should not happen
    Backing up /usr/bin/perl5 as /usr/bin/perl5.freebsd
mv: rename /usr/bin/perl5 to /usr/bin/perl5.freebsd: Permission denied
    *** /usr/bin/perl5 is still there, which should not happen
Done.
Cleaning up /home/users/whiter/apps/etc/make.conf... Done.
Spamming /home/users/whiter/apps/etc/make.conf... Done.
Cleaning up /etc/manpath.config.../home/users/whiter/tmp/pkg-install: cannot create /etc/manpath.config.new: Permission denied
override rw-r--r--  root/wheel for /etc/manpath.config.bak? (y/n [n])
not overwritten
mv: /etc/manpath.config.new: No such file or directory
 Done.
Spamming /etc/manpath.config.../home/users/whiter/tmp/pkg-install: cannot create /etc/manpath.config: Permission denied
*** Error code 2

Stop in /usr/ports/lang/perl5.8.
===== LOG SNIPPET END =====

>How-To-Repeat:
Set your env to contain everything as pasted below, and do a make install in the lang/perl5.8 ports folder. (For more information read the article on ports as non root on my website at http://www.white-russian.nl/?page=/blog/2006/07/installing_free.html )

# Set the main path to include the apps in our homedir
PATH=${HOME}/apps/bin:${HOME}/apps/sbin:/sbin:/bin:/usr/sbin:/usr/bin:/usr/games:/usr/local/sbin:/usr/local/bin:/usr/X11R6/bin; export PATH;

# Set the different variables that define where packages are installed
LOCALBASE=${HOME}/apps
X11BASE=${LOCALBASE}
PREFIX=${LOCALBASE}

# Set the paths to the folders the ports mechanism works in:
WRKDIR=${HOME}/tmp
PKG_DBDIR=${LOCALBASE}/var/db/pkg
PORT_DBDIR=${LOCALBASE}/var/db/ports
DISTDIR=${HOME}/distfiles

# Set user and group variables to ourself
BINOWN=`whoami`
BINGRP=`id -G -n ${BINOWN}`
SHAREOWN=${BINOWN}
SHAREGRP=${BINGRP}
MANOWN=${BINOWN}
MANGRP=${BINGRP}

# Make sure we don't really try to become root, but just execute everything as ourselves
SU_CMD="sh -c"

# Make sure that the main ports folder is checked for distfiles first, saving on download time
CD_MOUNTPTS=/usr

# If distfile found in $CD_MOUNTPTS, symlink to it, instead of copy
FETCH_SYMLINK_DISTFILES=YES

# Make sure the systemdefault make.conf is not read
__MAKE_CONF=${LOCALBASE}/etc/make.conf

# Do not try to chown files to root or other users
INSTALL_AS_USER=true

# Keep our own version of ldconfig hints
LDCONFIG="/sbin/ldconfig -i -f ${LOCALBASE}/var/run/ld-elf.so.hints"

# Set application specific variables to make sure it doesn't pick up things from the main system
APXS=${LOCALBASE}/sbin/apxs
PERL=${LOCALBASE}/bin/perl
PERL5=${PERL}
SITE_PERL=${LOCALBASE}/lib/perl5/site_perl/5.8.8
SITE_PERL5=${SITE_PERL}
PERL_VERSION=5.8.8
PERL_VER=${PERL_VERSION}

>Fix:
The fatal error at the end is being caused by the manpath functions in lang/perl5.8/files/use.perl. Those functions should be ammended to use the apropriate environment variables.
I do not know if the non-fatal problems shown in the log just before that are a serious problem too, or how to fix them. (About renaming/creating symlinks to perl in /usr/bin)
>Release-Note:
>Audit-Trail:
>Unformatted:



More information about the freebsd-ports-bugs mailing list