Subject: misc/33096: build.sh -n: releasekernel() bug
To: None <misc-bug-people@netbsd.org, gnats-admin@netbsd.org,>
From: None <j+nbsd@2006.salmi.ch>
List: netbsd-bugs
Date: 03/17/2006 22:30:00
>Number:         33096
>Category:       misc
>Synopsis:       build.sh -n: releasekernel() bug
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    misc-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Fri Mar 17 22:30:00 +0000 2006
>Originator:     Jukka Salmi
>Release:        NetBSD 3.99.17
>Environment:
System: NetBSD moray.salmi.ch 3.99.17 NetBSD 3.99.17 (GENERIC.APM) #0: Thu Mar 16 13:53:31 CET 2006 build@moray.salmi.ch:/build/nbsd/i386/sys/arch/i386/compile/GENERIC.APM i386
Architecture: i386
Machine: i386
>Description:
The releasekernel() function from src/build.sh doesn't behave correctly
when build.sh is invoked with the -n switch (setting runcmd='echo').
>How-To-Repeat:
$ cd /usr/src
$ ./build.sh tools kernel=GENERIC
$ ./build.sh -n releasekernel=GENERIC
[...]
echo ===> Kernel copy: [...]/binary/kernel/netbsd-GENERIC.gz
./build.sh: cannot create [...]/binary/kernel/netbsd-GENERIC.gz: directory nonexistent
[...]
>Fix:
Index: build.sh
===================================================================
RCS file: /cvsroot/src/build.sh,v
retrieving revision 1.146
diff -u -p -r1.146 build.sh
--- build.sh	3 Feb 2006 12:29:41 -0000	1.146
+++ build.sh	17 Mar 2006 22:10:17 -0000
@@ -994,7 +994,11 @@ releasekernel()
 		[ -f "${builtkern}" ] || continue
 		releasekern="${kernelreldir}/${kern}-${kernelconfname}.gz"
 		statusmsg "Kernel copy:      ${releasekern}"
-		${runcmd} gzip -c -9 < "${builtkern}" > "${releasekern}"
+		if [ "${runcmd}" = "echo" ]; then
+			echo "gzip -c -9 < ${builtkern} > ${releasekern}"
+		else
+			gzip -c -9 < "${builtkern}" > "${releasekern}"
+		fi
 	done
 }