NetBSD Problem Report #55257

From www@netbsd.org  Wed May 13 03:28:27 2020
Return-Path: <www@netbsd.org>
Received: from mail.netbsd.org (mail.netbsd.org [199.233.217.200])
	(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
	(Client CN "mail.NetBSD.org", Issuer "mail.NetBSD.org CA" (not verified))
	by mollari.NetBSD.org (Postfix) with ESMTPS id 936401A9213
	for <gnats-bugs@gnats.NetBSD.org>; Wed, 13 May 2020 03:28:27 +0000 (UTC)
Message-Id: <20200513032826.512791A9218@mollari.NetBSD.org>
Date: Wed, 13 May 2020 03:28:26 +0000 (UTC)
From: joaopaulo1511@hotmail.com
Reply-To: joaopaulo1511@hotmail.com
To: gnats-bugs@NetBSD.org
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
>Organization:
home user
>Environment:
NetBSD localhost 9.0 NetBSD 9.0 (GENERIC) #0: Fri Feb 14 00:06:28 UTC 2020 mkrepro@mkrepro.NetBSD.org:/usr/src/sys/arch/i386/compile/GENERIC i386
>Description:
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 https://netbsd.gw.com/cgi-bin/man-cgi?mk.conf+5+NetBSD-current 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.
>How-To-Repeat:
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.
>Fix:
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 (https://netbsd.gw.com/cgi-bin/man-cgi?mk.conf+5+NetBSD-current) 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: gnats_config.sh,v 1.9 2014/08/02 14:16:04 spz Exp $
Copyright © 1994-2020 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.