From owner-freebsd-ports@FreeBSD.ORG Sun Jun 30 16:29:54 2013 Return-Path: Delivered-To: freebsd-ports@FreeBSD.ORG Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 30858D64 for ; Sun, 30 Jun 2013 16:29:54 +0000 (UTC) (envelope-from vince@hightek.org) Received: from mail.ngtek.org (unknown [IPv6:2607:f740:100::f2f]) by mx1.freebsd.org (Postfix) with ESMTP id 0EEFF132A for ; Sun, 30 Jun 2013 16:29:54 +0000 (UTC) Received: from ip68-227-100-211.ok.ok.cox.net ([68.227.100.211] helo=hightek.org) by mail.ngtek.org with esmtpa (Exim 4.77 (FreeBSD)) (envelope-from ) id 1UtKVd-0001YD-O6 for freebsd-ports@FreeBSD.ORG; Sun, 30 Jun 2013 11:29:53 -0500 Received: from localhost ([127.0.0.1] helo=quark.hightek.org) by hightek.org with esmtp (Exim 4.80 (FreeBSD)) (envelope-from ) id 1UtKVd-00061k-EA for freebsd-ports@FreeBSD.ORG; Sun, 30 Jun 2013 11:29:53 -0500 Received: (from vince@localhost) by quark.hightek.org (8.14.5/8.14.5/Submit) id r5UGTrrT023171 for freebsd-ports@FreeBSD.ORG; Sun, 30 Jun 2013 11:29:53 -0500 (CDT) (envelope-from vince) Date: Sun, 30 Jun 2013 11:29:53 -0500 From: Vincent Stemen To: freebsd-ports@FreeBSD.ORG Subject: Problem building ports in a sandbox/jail using DESTDIR Message-ID: <20130630162953.GA23105@quark.hightek.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.5.21 (2010-09-15) X-BeenThere: freebsd-ports@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Porting software to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 30 Jun 2013 16:29:54 -0000 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?