NetBSD Problem Report #42658
From gcw@primenet.com.au Fri Jan 22 06:45:13 2010
Return-Path: <gcw@primenet.com.au>
Received: from mail.netbsd.org (mail.netbsd.org [204.152.190.11])
by www.NetBSD.org (Postfix) with ESMTP id 2B11163C54F
for <gnats-bugs@gnats.NetBSD.org>; Fri, 22 Jan 2010 06:45:13 +0000 (UTC)
Message-Id: <20100122064507.932.qmail@g.primenet.com.au>
Date: 22 Jan 2010 17:45:07 +1100
From: gcw@primenet.com.au
Reply-To: gcw@primenet.com.au
To: gnats-bugs@gnats.NetBSD.org
Subject: make(1) .include not properly handling directories with spaces in name
X-Send-Pr-Version: 3.95
>Number: 42658
>Category: bin
>Synopsis: make in a directory with spaces prints error with .include
>Confidential: no
>Severity: non-critical
>Priority: low
>Responsible: bin-bug-people
>State: closed
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Fri Jan 22 06:50:00 +0000 2010
>Closed-Date: Mon Jan 25 00:44:51 +0000 2010
>Last-Modified: Mon Jan 25 00:45:00 +0000 2010
>Originator: Geoff C. Wing
>Release: NetBSD 5.99.24
>Organization:
>Environment:
System: NetBSD g.primenet.com.au 5.99.24 NetBSD 5.99.24 (G) #2: Fri Jan 22 16:39:24 EST 2010 gcw@g.primenet.com.au:/usr/netbsd/src/sys/arch/i386/compile/G i386
Architecture: i386
Machine: i386
>Description:
make(1) when run with a ".include" directive in a directory
with spaces attempts to cd to a wrong directory.
$ mkdir "/tmp/foo bar"
$ cd "/tmp/foo bar"
$ echo '.include <bsd.own.mk>' | make -f -
cd: can't cd to bar bar
$ mkdir "/tmp/foo bar baz"
$ cd "/tmp/foo bar baz"
$ echo '.include <bsd.own.mk>' | make -f -
cd: can't cd to bar bar baz
>How-To-Repeat:
See up
>Fix:
?
>Release-Note:
>Audit-Trail:
From: David Laight <david@l8s.co.uk>
To: gnats-bugs@NetBSD.org
Cc:
Subject: Re: bin/42658: make(1) .include not properly handling directories with spaces in name
Date: Fri, 22 Jan 2010 22:23:58 +0000
On Fri, Jan 22, 2010 at 06:50:00AM +0000, gcw@primenet.com.au wrote:
> >Number: 42658
> >Category: bin
> >Synopsis: make in a directory with spaces prints error with .include
Due to the way make works (treating a space as a separator, and having
no general method of escaping special characters) it really doesn't like
spaces in any filenames (it won't like $ either).
Athough it might be thought that the $pwd value wouldn't matter that
much, it isn't really surprising that the absolute path gets treated
as space terminated/separated somewhere.
So this is really unlikely to be fixable (or at least you will find
more problems further on).
David
--
David Laight: david@l8s.co.uk
From: Geoff Wing <gcw@pobox.com>
To: gnats-bugs@NetBSD.org
Cc:
Subject: Re: bin/42658: make(1) .include not properly handling directories
with spaces in name
Date: Mon, 25 Jan 2010 11:33:54 +1100
On Friday 2010-01-22 22:25 +0000, David Laight output:
: Due to the way make works (treating a space as a separator, and having
: no general method of escaping special characters) it really doesn't like
: spaces in any filenames (it won't like $ either).
Just my misdiagnosis. The problem was in the included file: bsd.own.mk
The argument to ``cd'' needs quotes.
Regards,
Geoff
--- share/mk/bsd.dep.mk.org 2008-10-27 12:02:50.000000000 +1100
+++ share/mk/bsd.dep.mk 2010-01-25 11:30:53.000000000 +1100
@@ -74,7 +74,7 @@
.if !target(tags)
tags: ${SRCS}
.if defined(SRCS)
- -cd ${.CURDIR}; ctags -f /dev/stdout ${.ALLSRC:N*.h} | \
+ -cd "${.CURDIR}"; ctags -f /dev/stdout ${.ALLSRC:N*.h} | \
${TOOL_SED} "s;\${.CURDIR}/;;" > tags
.endif
.endif
--- share/mk/bsd.kernobj.mk.org 2003-10-12 16:41:01.000000000 +1000
+++ share/mk/bsd.kernobj.mk 2010-01-25 11:30:59.000000000 +1100
@@ -22,5 +22,5 @@
KERNARCHDIR?= arch/${MACHINE}
KERNCONFDIR?= ${KERNSRCDIR}/${KERNARCHDIR}/conf
.if !defined(KERNOBJDIR) && exists(${KERNSRCDIR}/${KERNARCHDIR}/compile)
-KERNOBJDIR!= cd ${KERNSRCDIR}/${KERNARCHDIR}/compile && ${PRINTOBJDIR}
+KERNOBJDIR!= cd "${KERNSRCDIR}/${KERNARCHDIR}/compile" && ${PRINTOBJDIR}
.endif
--- share/mk/bsd.lib.mk.org 2010-01-02 12:36:51.000000000 +1100
+++ share/mk/bsd.lib.mk 2010-01-25 11:31:11.000000000 +1100
@@ -52,7 +52,7 @@
.if defined(LIBDPLIBS) && ${MKPIC} != "no" # {
.for _lib _dir in ${LIBDPLIBS}
.if !defined(LIBDO.${_lib})
-LIBDO.${_lib}!= cd ${_dir} && ${PRINTOBJDIR}
+LIBDO.${_lib}!= cd "${_dir}" && ${PRINTOBJDIR}
.MAKEOVERRIDES+=LIBDO.${_lib}
.endif
LDADD+= -L${LIBDO.${_lib}} -l${_lib}
@@ -84,7 +84,7 @@
.if !defined(NOCHECKVER) && !defined(NOCHECKVER_${LIB}) && \
exists(${NETBSDSRCDIR}/lib/checkver)
checkver:
- @(cd ${.CURDIR} && \
+ @(cd "${.CURDIR}" && \
HOST_SH=${HOST_SH:Q} AWK=${TOOL_AWK:Q} \
${HOST_SH} ${NETBSDSRCDIR}/lib/checkver -v ${SHLIB_VERSION_FILE} \
-d ${DESTDIR}${_LIBSODIR} ${LIB})
--- share/mk/bsd.obj.mk.org 2007-12-12 08:35:01.000000000 +1100
+++ share/mk/bsd.obj.mk 2010-01-25 11:31:21.000000000 +1100
@@ -52,7 +52,7 @@
# In case .CURDIR has been twiddled by a .mk file and is now relative,
# make it absolute again.
.if ${__curdir:M/*} == ""
-__curdir!= cd ${__curdir} && ${PAWD}
+__curdir!= cd "${__curdir}" && ${PAWD}
.endif
__objdir:= ${__objdir}.${HOST_OSTYPE}
@@ -66,7 +66,7 @@
.endif
obj:
- @cd ${__curdir}; \
+ @cd "${__curdir}"; \
here=`${PAWD}`/; subdir=$${here#${BSDSRCDIR}/}; \
if [ "$$here" != "$$subdir" ]; then \
if [ ! -d ${__usrobjdir} ]; then \
--- share/mk/bsd.own.mk.org 2009-12-15 10:05:54.000000000 +1100
+++ share/mk/bsd.own.mk 2010-01-25 11:30:28.000000000 +1100
@@ -81,7 +81,7 @@
# and setting _SRC_TOP_ to the result.
#
.if !defined(_SRC_TOP_) # {
-_SRC_TOP_!= cd ${.CURDIR}; while :; do \
+_SRC_TOP_!= cd "${.CURDIR}"; while :; do \
here=`pwd`; \
[ -f build.sh ] && [ -d tools ] && { echo $$here; break; }; \
case $$here in /) echo ""; break;; esac; \
@@ -100,7 +100,7 @@
NETBSDSRCDIR?= ${_SRC_TOP_}
.if !defined(_SRC_TOP_OBJ_)
-_SRC_TOP_OBJ_!= cd ${_SRC_TOP_} && ${PRINTOBJDIR}
+_SRC_TOP_OBJ_!= cd "${_SRC_TOP_}" && ${PRINTOBJDIR}
.MAKEOVERRIDES+= _SRC_TOP_OBJ_
.endif
@@ -612,7 +612,7 @@
cleandir: clean
dependall: .NOTMAIN realdepend .MAKE
- @cd ${.CURDIR}; ${MAKE} realall
+ @cd "${.CURDIR}"; ${MAKE} realall
.endif
#
@@ -860,7 +860,7 @@
#
.if !defined(X11SRCDIR)
.if exists(${NETBSDSRCDIR}/../xsrc)
-X11SRCDIR!= cd ${NETBSDSRCDIR}/../xsrc && pwd
+X11SRCDIR!= cd "${NETBSDSRCDIR}/../xsrc" && pwd
.else
X11SRCDIR= /usr/xsrc
.endif
@@ -955,7 +955,7 @@
#
.if !defined(EXTSRCSRCDIR)
.if exists(${NETBSDSRCDIR}/../extsrc)
-EXTSRCSRCDIR!= cd ${NETBSDSRCDIR}/../extsrc && pwd
+EXTSRCSRCDIR!= cd "${NETBSDSRCDIR}/../extsrc" && pwd
.else
EXTSRCSRCDIR= /usr/extsrc
.endif
State-Changed-From-To: open->closed
State-Changed-By: christos@NetBSD.org
State-Changed-When: Sun, 24 Jan 2010 19:44:51 -0500
State-Changed-Why:
fixedupatch applied, thanks
From: Christos Zoulas <christos@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc:
Subject: PR/42658 CVS commit: src/share/mk
Date: Sun, 24 Jan 2010 19:43:00 -0500
Module Name: src
Committed By: christos
Date: Mon Jan 25 00:43:00 UTC 2010
Modified Files:
src/share/mk: bsd.dep.mk bsd.kernobj.mk bsd.lib.mk bsd.obj.mk
bsd.own.mk
Log Message:
PR/42658: Geoff Wing: Quote directory variables to deal with spaces in the
source pathname.
To generate a diff of this commit:
cvs rdiff -u -r1.68 -r1.69 src/share/mk/bsd.dep.mk
cvs rdiff -u -r1.12 -r1.13 src/share/mk/bsd.kernobj.mk
cvs rdiff -u -r1.302 -r1.303 src/share/mk/bsd.lib.mk
cvs rdiff -u -r1.48 -r1.49 src/share/mk/bsd.obj.mk
cvs rdiff -u -r1.614 -r1.615 src/share/mk/bsd.own.mk
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
>Unformatted:
(Contact us)
$NetBSD: query-full-pr,v 1.39 2013/11/01 18:47:49 spz Exp $
$NetBSD: gnats_config.sh,v 1.8 2006/05/07 09:23:38 tsutsui Exp $
Copyright © 1994-2007
The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.