NetBSD Problem Report #45396

From tsutsui@ceres.dti.ne.jp  Fri Sep 23 15:02:38 2011
Return-Path: <tsutsui@ceres.dti.ne.jp>
Received: from mail.netbsd.org (mail.netbsd.org [204.152.190.11])
	by www.NetBSD.org (Postfix) with ESMTP id 850AE63B884
	for <gnats-bugs@gnats.NetBSD.org>; Fri, 23 Sep 2011 15:02:38 +0000 (UTC)
Message-Id: <201109231502.p8NF2YC1006032@mirage.localdomain>
Date: Sat, 24 Sep 2011 00:02:34 +0900 (JST)
From: Izumi Tsutsui <tsutsui@ceres.dti.ne.jp>
Reply-To: tsutsui@ceres.dti.ne.jp
To: gnats-bugs@gnats.NetBSD.org
Cc: tsutsui@ceres.dti.ne.jp
Subject: make clean fails in src/lib/libarch for mips build
X-Send-Pr-Version: 3.95

>Number:         45396
>Category:       toolchain
>Synopsis:       make clean fails in src/lib/libarch for mips build
>Confidential:   no
>Severity:       critical
>Priority:       medium
>Responsible:    toolchain-manager
>State:          closed
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Fri Sep 23 15:05:00 +0000 2011
>Closed-Date:    Sun Sep 25 07:06:18 +0000 2011
>Last-Modified:  Sun Sep 25 07:06:18 +0000 2011
>Originator:     Izumi Tsutsui
>Release:        NetBSD 5.99.55
>Organization:
>Environment:
System: NetBSD 5.99.55 around 20110920
Architecture: host: i386, target: mipsel 
Machine: host: i386, target: pmax
>Description:
pmax (and all mips ports) doesn't build a library src/lib/libarch
and "make clean" fails in src/lib/libarch on pmax, even during
build.sh -m pmax -U build:

---
% pwd
/work/src/lib/libarch
% ../../obj.pmax/tooldir.NetBSD-5.99.55-i386/bin/nbmake-pmax clean
#   clean CLEANFILES
(cd /work/src/lib/libarch && rm -f  ) 
Failed to remove files from /work/src/lib/libarch:
.

*** Failed target:  __doclean
*** Failed command: bad="$(cd /work/src/lib/libarch && ls -d 2>/dev/null)"; if test -n "$bad"; then echo "Failed to remove files from /work/src/lib/libarch:" ; echo "$bad" ; false ; fi 
*** Error code 1

Stop.
nbmake: stopped in /work/src/lib/libarch
% 
---

while "build.sh -m pmax -U -j 1 build" ignores the error (empty arg):
---
% ../../obj.pmax/tooldir.NetBSD-5.99.55-i386/bin/nbmake-pmax -j1 clean
#   clean CLEANFILES
(cd /work/src/lib/libarch && rm -f  ) 
Failed to remove files from /work/src/lib/libarch:
.
*** [__doclean] Error code 1 (ignored)
% 
---
so daily build on releng server works.

>How-To-Repeat:
See above.

>Fix:
Unknown.
Some race in bsd.clean.mk?

---

>Release-Note:

>Audit-Trail:
From: Alan Barrett <apb@cequrux.com>
To: gnats-bugs@NetBSD.org
Cc: 
Subject: Re: toolchain/45396: make clean fails in src/lib/libarch for mips
 build
Date: Fri, 23 Sep 2011 18:10:36 +0200

 On Fri, 23 Sep 2011, Izumi Tsutsui wrote:
 >/work/src/lib/libarch
 >% ../../obj.pmax/tooldir.NetBSD-5.99.55-i386/bin/nbmake-pmax clean
 >#   clean CLEANFILES
 >(cd /work/src/lib/libarch && rm -f  )
 >Failed to remove files from /work/src/lib/libarch:
 >.

 Please try this patch, which will print the value of ${CLEANFILES}.  I
 guess that it contains a space instead of being empty, and I guess that
 can happen if you do this:

 EMPTY =
 CLEANFILES = ${EMPTY}
 CLEANFILES += ${EMPTY}

 --apb (Alan Barrett)

 Index: bsd.clean.mk
 ===================================================================
 --- bsd.clean.mk	10 Sep 2011 19:25:10 -0000	1.2
 +++ bsd.clean.mk	23 Sep 2011 16:03:34 -0000
 @@ -42,7 +42,7 @@ __docleandir:	.PHONY .MADE __cleanuse CL
   #
   __cleanuse: .USE
   	${"${.ALLSRC:@v@${${v}}@}" == "":?@true:${_MKMSG} \
 -		"clean" ${.ALLSRC} }
 +		"clean" ${.ALLSRC} \"${.ALLSRC:@v@${${v}}@:Q}\" }
   .for _d in ${"${.OBJDIR}" == "${.CURDIR}" \
   		:? ${.OBJDIR} \
   		:  ${.OBJDIR} ${.CURDIR} }

From: Alan Barrett <apb@cequrux.com>
To: gnats-bugs@NetBSD.org
Cc: 
Subject: Re: toolchain/45396: make clean fails in src/lib/libarch for mips
 build
Date: Fri, 23 Sep 2011 18:18:11 +0200

 On Fri, 23 Sep 2011, Izumi Tsutsui wrote:
 >#   clean CLEANFILES
 >(cd /work/src/lib/libarch && rm -f  )
 >Failed to remove files from /work/src/lib/libarch:
 >.

 Please also try this patch, which uses :M* to ignore the difference
 between an empty strig and a string that contains only spaces.

 Index: bsd.clean.mk
 --- bsd.clean.mk	10 Sep 2011 19:25:10 -0000	1.2
 +++ bsd.clean.mk	23 Sep 2011 16:14:35 -0000
 @@ -41,14 +41,14 @@ __docleandir:	.PHONY .MADE __cleanuse CL
   # both .OBJDIR and .SRCDIR.
   #
   __cleanuse: .USE
 -	${"${.ALLSRC:@v@${${v}}@}" == "":?@true:${_MKMSG} \
 -		"clean" ${.ALLSRC} }
 +	${"${.ALLSRC:@v@${${v}:M*}@}" == "":?@true:${_MKMSG} \
 +		"clean" ${.ALLSRC} ${.ALLSRC:@v@\"${${v}:Q}\"@} }
   .for _d in ${"${.OBJDIR}" == "${.CURDIR}" \
   		:? ${.OBJDIR} \
   		:  ${.OBJDIR} ${.CURDIR} }
 -	-${"${.ALLSRC:@v@${${v}}@}" == "":?@true: \
 +	-${"${.ALLSRC:@v@${${v}:M*}@}" == "":?@true: \
   	    (cd ${_d} && rm -f ${.ALLSRC:@v@${${v}}@}) }
 -	@${"${.ALLSRC:@v@${${v}}@}" == "":?true: \
 +	@${"${.ALLSRC:@v@${${v}:M*}@}" == "":?true: \
   	    bad="\$(cd ${_d} && ls -d ${.ALLSRC:@v@${${v}}@} 2>/dev/null)"; \
   	    if test -n "\$bad"; then \
   	        echo "Failed to remove files from ${_d}:" ; \

From: "Alan Barrett" <apb@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/45396 CVS commit: src/share/mk
Date: Fri, 23 Sep 2011 21:13:15 +0000

 Module Name:	src
 Committed By:	apb
 Date:		Fri Sep 23 21:13:14 UTC 2011

 Modified Files:
 	src/share/mk: bsd.clean.mk

 Log Message:
 * use a :M* modifier when testing whether the expanded list of
   files is empty.  Sometimes the variable contains one or more spaces,
   and testing against "" gave the wrong result, but applying the
   :M* modifier discards the spaces.  This should fix PR 45396.
 * Instead of using "-" to ignore the exit status from the rm command,
   use ||true.  This should work around the bug in PR 45356, but that
   bug is not fixed.
 * Suppress the ${MKMSG} command with .if 0.  People who build with
   MAKEVERBOSE=1 don't want to see the message, and people who build
   with MAKEVERBOSE=2 or higher will see the actual rm command.  The
   message may be useful for debugging this makefile itself, so it's
   only disabled, not deleted.


 To generate a diff of this commit:
 cvs rdiff -u -r1.2 -r1.3 src/share/mk/bsd.clean.mk

 Please note that diffs are not public domain; they are subject to the
 copyright notices on the relevant files.

From: Izumi Tsutsui <tsutsui@ceres.dti.ne.jp>
To: gnats-bugs@NetBSD.org
Cc: tsutsui@ceres.dti.ne.jp
Subject: Re: toolchain/45396: make clean fails in src/lib/libarch for mips build
Date: Sun, 25 Sep 2011 07:19:33 +0900

 >  Please try this patch, which will print the value of ${CLEANFILES}.  I
 >  guess that it contains a space instead of being empty, and I guess that
 >  can happen if you do this:
 >  
 >  EMPTY =
 >  CLEANFILES = ${EMPTY}
 >  CLEANFILES += ${EMPTY}

 src/lib/libarch/Makefile has the following lines
 so it could have some spaces:
 ---
 ARCHDIRS= alpha arm i386 m68k sparc x86_64

 .for arch in ${ARCHDIRS}
 .include "${.CURDIR}/${arch}/Makefile.inc"
 .PATH:	${.CURDIR}/${arch}
 .endfor

 OBJS+= ${ASM}
 POBJS+=	${ASM:.o=.po}
 CLEANFILES+= ${ASM} ${POBJS}
 ---

 and bsd.clean.mk rev 1.3 fixes the problem. Thanks.

 ---
 % ../../obj.pmax/tooldir.NetBSD-5.99.55-i386/bin/nbmake-pmax clean
 % ../../obj.pmax/tooldir.NetBSD-5.99.55-i386/bin/nbmake-pmax cleandir
 (cd /r/work/src/lib/libarch && rm -f arm_sync_icache.cat2 arm_drain_writebuf.cat2 i386_get_ldt.cat2 i386_get_mtrr.cat2 i386_iopl.cat2 i386_pmc_info.cat2 i386_vm86.cat2 m68k_sync_icache.cat2 x86_64_get_mtrr.cat2 x86_64_iopl.cat2 arm_sync_icache.html2 arm_drain_writebuf.html2 i386_get_ldt.html2 i386_get_mtrr.html2 i386_iopl.html2 i386_pmc_info.html2 i386_vm86.html2 m68k_sync_icache.html2 x86_64_get_mtrr.html2 x86_64_iopl.html2 || true) 
 % 

 ---
 Izumi Tsutsui

State-Changed-From-To: open->closed
State-Changed-By: apb@NetBSD.org
State-Changed-When: Sun, 25 Sep 2011 07:06:18 +0000
State-Changed-Why:
confirmed fixed


>Unformatted:

NetBSD Home
NetBSD PR Database Search

(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.