pkgsrc-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

pkg/39306: pkg_chk 1.95 conditionals are afflicted by the vagaries of shell scripts when PKGSRCDIR is empty or unset



>Number:         39306
>Category:       pkg
>Synopsis:       pkg_chk 1.95 conditionals are afflicted by the vagaries of 
>shell scripts when PKGSRCDIR is empty or unset
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    pkg-manager
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Thu Aug 07 04:20:00 +0000 2008
>Originator:     Taylor R Campbell <campbell%mumble.net@localhost>
>Release:        NetBSD 4.0_STABLE
>Organization:
>Environment:
System: NetBSD smalltalk 4.0_STABLE NetBSD 4.0_STABLE (RIASTRADH_LAPTOP) #2: 
Fri Jul 18 23:16:51 UTC 2008 
riastradh@smalltalk:/home/riastradh/netbsd/4/obj/sys/arch/i386/compile/RIASTRADH_LAPTOP
 i386
Architecture: i386
Machine: i386
>Description:

        If PKGSRCDIR is not set, pkg_chk will fail with a `test' error
        because of common shell scripting errors, followed by other
        related errors.  There are probably other various vagaries of
        shell scripts scattered throughout, but this one bit me today.

>How-To-Repeat:

        % unset PKGSRCDIR; pkg_chk -a -q
        [: (: unexpected operator
        cd: can't cd to /pkgtools/pkg_chk
        %

>Fix:

        Here's a patch to fix this particular problem (and one closely
        related to it):

--- pkg_chk.~1~ 2008-08-07 03:48:18.000000000 +0000
+++ pkg_chk     2008-08-07 04:03:39.000000000 +0000
@@ -172,7 +172,7 @@
            fi
        done
     fi
-    if [ ! -d $PKGSRCDIR -a \( -z "$opt_b" -o -n "$opt_s" \) ] ; then
+    if [ ! -d "$PKGSRCDIR" -a \( -z "$opt_b" -o -n "$opt_s" \) ] ; then
        fatal "Unable to locate PKGSRCDIR (${PKGSRCDIR:-not set})"
     fi
 
@@ -377,7 +377,7 @@
 
     # Determine list of tags
     #
-    if [ $PKGSRCDIR = NONE ]; then
+    if [ "$PKGSRCDIR" = NONE ]; then
        OPSYS=$(uname -s)
        OS_VERSION=$(uname -r)
        MACHINE_ARCH=$(uname -p)



Home | Main Index | Thread Index | Old Index