Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 30 Jun 2013 11:29:53 -0500
From:      Vincent Stemen <vince.bsd@hightek.org>
To:        freebsd-ports@FreeBSD.ORG
Subject:   Problem building ports in a sandbox/jail using DESTDIR
Message-ID:  <20130630162953.GA23105@quark.hightek.org>

next in thread | raw e-mail | index | archive | help
Hi.  I am trying to compile ports in a sandbox environment on
FreeBSD-9.1-RELEASE using a snapshot of ports from 06/27/2013.

I have a jail file system I setup using my own scripts that I am pointing
$DESTDIR to.  I am using 'zip' as the port for testing.

The problem is, I get an error like this and it immediately aborts.
cd: /tmp/mountpoint.TJizHb/data/freebsd/ports/ports-20130627/archivers/zip: No such file or directory

Below is the output with DESTDIR debugging turned on.
________________________________________________

# realpath .
/data/freebsd/ports/ports-20130627/archivers/zip

# make DESTDIR=/data/freebsd/ports/jail WITH_DESTDIR_DEBUG=1
===>  Creating some important subdirectories
DEBUG: _DESTDIR_MOUNT_LIST= PORTSDIR:/usr/ports:___temp___ DISTDIR:/usr/ports/distfiles:___temp___
DEBUG: Processing PORTSDIR:/usr/ports:___temp___
DEBUG: PORTSDIR:/data/freebsd/ports/ports-20130627:/data/freebsd/ports/jail/___temp___
DEBUG: Creating temporary mount point
DEBUG: Temporary mount point /data/freebsd/ports/jail/tmp/mountpoint.TJizHb created successfully
DEBUG: Directory /data/freebsd/ports/ports-20130627 mounted
DEBUG: Processing DISTDIR:/usr/ports/distfiles:___temp___
DEBUG: DISTDIR:/data/freebsd/ports/distfiles:/data/freebsd/ports/jail/___temp___
DEBUG: Creating temporary mount point
DEBUG: Temporary mount point /data/freebsd/ports/jail/tmp/mountpoint.ZxFnzJ created successfully
DEBUG: Directory /data/freebsd/ports/distfiles mounted
DEBUG: Handling devfs separately
DEBUG: devfs mounted
DEBUG: Things we mounted: /data/freebsd/ports/jail/dev /data/freebsd/ports/jail/tmp/mountpoint.ZxFnzJ /data/freebsd/ports/jail/tmp/mountpoint.TJizHb 
DEBUG: Things we created: /data/freebsd/ports/jail/tmp/mountpoint.ZxFnzJ /data/freebsd/ports/jail/tmp/mountpoint.TJizHb 
DEBUG: _var_path_list:  PORTSDIR=/tmp/mountpoint.TJizHb DISTDIR=/tmp/mountpoint.ZxFnzJ DEVFS=/dev
===>  Starting chrooted make in /data/freebsd/ports/jail...
cd: /tmp/mountpoint.TJizHb/data/freebsd/ports/ports-20130627/archivers/zip: No such file or directory
===>  Chrooted make in /data/freebsd/ports/jail failed
===>  Cleaning up...
*** [do-chroot] Error code 2

Stop in /data/freebsd/ports/ports-20130627/archivers/zip.
________________________________________________

Where it tries to cd to
    /tmp/mountpoint.TJizHb/data/freebsd/ports/ports-20130627/archivers/zip
                          ----------------------------------
the underlined part should not be there.  Ports is mounted directly on
/tmp/mountpoint.TJizHb in the jail by the makefiles and I verified that
/tmp/mountpoint.TJizHb/archivers/zip does exist at this point just prior to
getting the 'cd' error and cleaning up, by stopping the makefile there 
and manually checking.

Makefile code in ports
======================

Mk/bsd.destdir.mk
    ...
    ${ECHO_MSG} "===>  Starting chrooted make in ${DESTDIR}..."; \
    export $${_var_path_list}; \
    ${CHROOT} $${_destdir} ${SH} -c "\
        cd $${PORTSDIR}${.CURDIR:S|^${PORTSDIR}||}; \
        ${SETENV} -i ${DESTDIR_ENV} $${_var_path_list} ${MAKE} ${.TARGETS}" && \
        { status=$$?; ${ECHO_MSG} "===>  Chrooted make in ${DESTDIR} succeeded"; } || \
        { status=$$?; ${ECHO_MSG} "===>  Chrooted make in ${DESTDIR} failed"; }; \
        ${ECHO_MSG} "===>  Cleaning up..."; \
    ...


The problem seems to be with
    cd $${PORTSDIR}${.CURDIR:S|^${PORTSDIR}||};

I don't quite understand the expansion.
$PORTSDIR seems to be set to '/data/freebsd/ports/ports-20130627',
so I don't know how it is getting '/tmp/mountpoint.TJizHb' prepended, or why
the full path to the ports directory outside the jail is being used in this
expansion to cd to it inside the jail.

Could this be a bug in the ports makefile or is it possible that I am
missing something in my jail that can cause this?




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20130630162953.GA23105>