ports/184170: fix ports DESTDIR support with FreeBSD 10 make

Dominic Fandrey kamikaze at bsdforen.de
Fri Nov 22 13:00:01 UTC 2013


>Number:         184170
>Category:       ports
>Synopsis:       fix ports DESTDIR support with FreeBSD 10 make
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-ports-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Fri Nov 22 13:00:00 UTC 2013
>Closed-Date:
>Last-Modified:
>Originator:     Dominic Fandrey
>Release:        stable/10
>Organization:
private
>Environment:
FreeBSD mobileKamikaze.norad 10.0-BETA3 FreeBSD 10.0-BETA3 #1 r258147: Thu Nov 14 23:56:36 CET 2013     root at mobileKamikaze.norad:/usr/obj/HP6510b-10/amd64/usr/src/sys/HP6510b-10  amd64
>Description:
# make DESTDIR=/root/tmpdest install
===>  Creating some important subdirectories
realpath: /root/tmpdest/___temp___: No such file or directory

*** Error code 1
Stop.
make: stopped in /usr/ports/ports-mgmt/pkg


The cause for this problem is that bsd.destdir.mk gets a list of mount directories, containing of triplets:
<path variable>:<path>:<mountdir in the chroot>

The list is usually just PORTSDIR and DISTDIR, which is then automatically
completed to a triplet. If the triplet is not predefined ___temp___ is used
as the mount dir, which is handled later in the code to call "mktemp -d"
(line 147).

However before it is handled, the path is accessed by realpath (line 143),
which causes make to fail, because the new BSD make in FreeBSD 10 invokes
/bin/sh with the -e argument by default (see the .SHELL target in the manual
page).

The attached patch prevents shell failure by silencing the error and appending
||: to the realpath call (in case of failure call :, which simply returns 0).

This allows proper handling of the ___temp___ case later in the code.
>How-To-Repeat:
Create a FreeBSD environment:
# cd /usr/src
# make installworld distdribution DESTDIR=/root/tmpdest
# chroot /root/tmpdest
# /etc/rc.d/ldconfig start
# exit

Afterwards try installing something from ports.
# cd /usr/ports/ports-mgmt/pkg
# make DESTDIR=/root/tmpdest install

>Fix:


Patch attached with submission follows:

Index: Mk/bsd.destdir.mk
===================================================================
--- Mk/bsd.destdir.mk	(revision 334509)
+++ Mk/bsd.destdir.mk	(working copy)
@@ -140,7 +140,7 @@
 		_tp=$${_entry#*:}; \
 		_host_path=`${REALPATH} $${_tp%:*}`; \
 		_dest_path=$${_entry##*:}; \
-		_full_dest_path=`${REALPATH} $${_destdir}/$${_dest_path}`; \
+		_full_dest_path=`${REALPATH} -q $${_destdir}/$${_dest_path} ||:`; \
 		_entry_was_created=0; \
 		_entry_should_mount=0; \
 		${DEBUG_MSG} "$${_mount_var}:$${_host_path}:$${_full_dest_path}"; \


>Release-Note:
>Audit-Trail:
>Unformatted:


More information about the freebsd-ports-bugs mailing list