Subject: pkg/25777: pkg_info shows error message when "bmake install" on Interix
To: None <gnats-bugs@gnats.NetBSD.org>
From: None <hiramatu@boreas.dti.ne.jp>
List: pkgsrc-bugs
Date: 06/02/2004 00:28:48
>Number:         25777
>Category:       pkg
>Synopsis:       pkg_info shows error message when "bmake install" on Interix
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    pkg-manager
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Tue Jun 01 15:29:00 UTC 2004
>Closed-Date:
>Last-Modified:
>Originator:     Hiramatsu Yoshifumi
>Release:        NetBSD 2.0E
>Organization:
	
>Environment:
Interix nile 3.5 SP-8.0.1969.1 x86 AMD Athlon/Duron
>Description:
When executing "bmake install" for a package which doesn't have DEPENDS
(i.e., devel/patch), following message is displayed.

pkg_info: missing package name(s)
usage: pkg_info [-BbcDdFfIikLmNnpqRrSsVvh] [-e package] [-l prefix]
                pkg-name [pkg-name ...]
       pkg_info -a [flags]
       pkg_info -Q variable pkg-name [pkg-name ...]

This is caused by the different behavior of xargs command. Interix's xargs
executes the command that is given as arguments even when standard input
is empty.

>How-To-Repeat:
cd /usr/pkgsrc/devel/patch
bmake install

>Fix:
This is a patch for bsd.bsd.mk.

--- bsd.pkg.mk.orig	Sat May 29 21:38:48 2004
+++ bsd.pkg.mk	Sun May 30 15:06:24 2004
@@ -4550,14 +4550,19 @@
 # dependencies are all installed.
 .PHONY: print-pkg-size-depends
 print-pkg-size-depends:
-	@${MAKE} ${MAKEFLAGS} run-depends-list				\
-	| ${XARGS} -n 1 ${SETENV} ${PKG_BEST_EXISTS}			\
-	| ${SORT} -u							\
+	@pkglist=`${MAKE} ${MAKEFLAGS} run-depends-list | sort -u`;	\
+	if [ "$${pkglist}" != "" ]; then				\
+		for i in $${pkglist}; do				\
+			${SETENV} ${PKG_BEST_EXISTS} $$i;		\
+		done							\
 	| ${XARGS} -n 256 ${SETENV} ${PKG_INFO} -qs			\
 	| ${AWK} -- 'BEGIN { print("0 "); }				\
 		/^[0-9]+$$/ { print($$1, " + "); }			\
 		END { print("p"); }'					\
-	| ${DC}
+		| ${DC};						\
+	else								\
+		echo "0";						\
+	fi								
 
 
 ###
>Release-Note:
>Audit-Trail:
>Unformatted: