NetBSD Problem Report #55257

From  Wed May 13 03:28:27 2020
Return-Path: <>
Received: from ( [])
	(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
	(Client CN "", Issuer " CA" (not verified))
	by (Postfix) with ESMTPS id 936401A9213
	for <>; Wed, 13 May 2020 03:28:27 +0000 (UTC)
Message-Id: <>
Date: Wed, 13 May 2020 03:28:26 +0000 (UTC)
Subject: make and bmake do not work with paths beginning with tildes on variables defined on mk.conf
X-Send-Pr-Version: www-1.0

>Number:         55257
>Category:       toolchain
>Synopsis:       make and bmake do not work with paths beginning with tildes on variables defined on mk.conf
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    toolchain-manager
>State:          open
>Class:          doc-bug
>Submitter-Id:   net
>Arrival-Date:   Wed May 13 03:30:00 +0000 2020
>Originator:     Joćo Paulo Vinha Bittar
>Release:        9.0
home user
NetBSD localhost 9.0 NetBSD 9.0 (GENERIC) #0: Fri Feb 14 00:06:28 UTC 2020 i386
If /etc/mk.conf or ~/pkg/etc/mk.conf have beginning tildes on variables, make and bmake throws a message that the directory could not be written.

For example, if WRKOBJDIR=~/WORK instead of WRKOBJDIR=$HOME/WORK, or if DISTDIR=~/DISTFILES instead of DISTDIR=/home/my_name/DISTFILES, or if PACKAGES=~/PACKAGES instead of PACKAGES=${HOME}/PACKAGES, make and bmake cannot fetch the source files, nor build packages neither store the packages built, as they cannot write to paths begining with tildes.

The manual page at does not say that mk.conf should not have tildes on beginning of paths and the user should use the $HOME or ${HOME} or the full path.
1. On a system with NetBSD and pkgsrc installed, run "/usr/pkgsrc/bootstrap/bootstrap --unprivileged" so bmake can be tested.  Add ~/pkg/bin:~/pkg/sbin to your PATH environment variable.

2. Edit /mk.conf and ~/pkg/etc/mk.conf to define variables as WRKOBJDIR, DISTDIR and PACKAGES to contain paths beginning with tildes, such as WRKOBJDIR=~/WORK, DISTDIR=~/DISTFILES and PACKAGES=~/PACKAGES.

3. Try to build any package as root with make or as non-root with bmake:  They will throw an error they could not write to those paths beginning with tildes.
I do not think there is any need to fix the make and bmake binaries, as we can use $HOME or ${HOME} instead of tildes, as in WRKOBJDIR=$HOME/WORK.

However, the manual page for mk.conf ( should tell the user to not use tildes and use $HOME on mk.conf, be it at /etc/mk.conf or at ~/pkg/etc/mk.conf.

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.46 2020/01/03 16:35:01 leot Exp $
$NetBSD:,v 1.9 2014/08/02 14:16:04 spz Exp $
Copyright © 1994-2020 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.