Subject: pkg/32415: download-vulnerability-list not exiting when no PKGVULNDIR
To: None <pkg-manager@netbsd.org, gnats-admin@netbsd.org,>
From: None <reed@reedmedia.net>
List: pkgsrc-bugs
Date: 12/30/2005 00:15:01
>Number:         32415
>Category:       pkg
>Synopsis:       download-vulnerability-list not exiting when no PKGVULNDIR
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    pkg-manager
>State:          open
>Class:          change-request
>Submitter-Id:   net
>Arrival-Date:   Fri Dec 30 00:15:01 +0000 2005
>Originator:     reed@reedmedia.net
>Release:        NetBSD 2.1
>Organization:
http://bsd.reedmedia.net/
>Environment:
	
	
System: NetBSD rainier.reedmedia.net 2.1 NetBSD 2.1 (GENERIC) #0: Mon Oct 24 22:35:45 UTC 2005 jmc@faith.netbsd.org:/home/builds/ab/netbsd-2-1-RELEASE/i386/200510241747Z-obj/home/builds/ab/netbsd-2-1-RELEASE/src/sys/arch/i386/compile/GENERIC i386
Architecture: i386
Machine: i386
>Description:
I originally emailed about this in May 2005.

Downloaded pkg-vulnerabilities is placed in current directory
if PKGVULNDIR is not properly defined or permissions are wrong.

The code is:

        /bin/mkdir -p ${PKGVULNDIR} || (echo "Can't create ${PKGVULNDIR}"
1>&2; exit 1)

It does not really exit when running bash nor NetBSD sh. It just exits
that ( sub-shell ) .

Using { ...  ; } works for bash and sh.


>How-To-Repeat:
	
>Fix:

 if [ ! -d ${PKGVULNDIR}/. ]; then
+	@MKDIR@ ${PKGVULNDIR} || { echo "Can't create ${PKGVULNDIR}" 1>&2; exit 1; }
 	echo "Creating ${PKGVULNDIR}"
-	@MKDIR@ ${PKGVULNDIR} || (echo "Can't create ${PKGVULNDIR}" 1>&2; exit 1)
 fi
 
And bump version.

>Unformatted: