Subject: pkg/11433: "pkg_info -S" output is wrong
To: None <gnats-bugs@gnats.netbsd.org>
From: Frederick Bruckman <fb@enteract.com>
List: netbsd-bugs
Date: 11/06/2000 19:16:13
>Number: 11433
>Category: pkg
>Synopsis: "pkg_info -S" output is wrong
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: pkg-manager
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Mon Nov 06 19:16:00 PST 2000
>Closed-Date:
>Last-Modified:
>Originator: Frederick Bruckman
>Release: NetBSD-1.5_BETA
>Organization:
Frederick
>Environment:
System: NetBSD fiona.amberites.invalid 1.5_BETA NetBSD 1.5_BETA (FIONA) #12:
Sat Oct 28 15:21:57 CDT 2000 fredb@fiona.amberites.invalid:
/s/src-netbsd-1-5/sys/arch/i386/compile/FIONA i386
>Description:
Consider:
root@fiona-> pkg_info -S gnome
Information for gnome-1.2.1nb1:
Size in bytes including required pkgs: 4763722572
I have "gnome" installed, and I never had 4.7G available on /usr!
The problem is, that the calculation is made at package time
by calling "pkg_info -qS" recursively for explicitly listed DEPENDS.
This may count packages that are depended on implicitly _twice_,
or even more often. This problem doesn't only occur with
meta-pkgs, but also with festvox-* voices, and probably more.
>How-To-Repeat:
As above -- run "pkg_info -S" over any installed package which
has pyramiding dependencies.
>Fix:
Appended is a first attempt at breaking out all the
dependencies, sorting out duplicates, and calling "pkg_info
-s" directly over the component packages. In the patch below,
I've also restored the setting of PKG_PATH to empty (which
was in bsd.pkg.mk at one time, but later reverted), so that
we only get the installed packages, and not whatever binary
packages happen to be in PKG_PATH.
I have a few reservations about the following: 1) It doesn't
quite work -- when making the "gnome" package just now, some
plain text got passed to "dc" which made it blow up. 2) It
takes several minutes on a Pentium to recurse over all the
dependencies (before it blows up). 3) The calculation, even
if done correctly, in not especially useful.
Let me elaborate on "3". The purpose of "pkg_info -S" --
what you really want it to tell you -- is how much disk
space you need to "pkg_add" the package and all its
dependencies. Any build time calculation to this effect is
probably wrong, since the user could have different packages
installed/available than the package was built against.
Worse, it's not useful, because it counts packages _already_
_installed_, and not simply packages needed to be installed.
I suggest that "pkg_info -S" should properly be a _run-time_
calculation, which converges to equivalence to "pkg_info
-s" as all the required dependencies are installed. As such,
it would provide truly useful information. The down-side
is, you could not practically do the calculation with
"pkg_info" over ftp. However, it's not practical to do that
at present, either, and whatever information you do get over
ftp is wrong (implicit dependencies counted twice).
Index: bsd.pkg.mk
===================================================================
RCS file: /cvsroot/pkgsrc/mk/bsd.pkg.mk,v
retrieving revision 1.597
diff -c -r1.597 bsd.pkg.mk
*** bsd.pkg.mk 2000/11/02 12:17:03 1.597
--- bsd.pkg.mk 2000/11/07 02:18:38
***************
*** 639,649 ****
TYPE?= type # Shell builtin
.endif # !SunOS
! PKG_ADD?= PKG_DBDIR=${PKG_DBDIR} ${PKG_TOOLS_BIN}/pkg_add
! PKG_ADMIN?= PKG_DBDIR=${PKG_DBDIR} ${PKG_TOOLS_BIN}/pkg_admin
! PKG_CREATE?= PKG_DBDIR=${PKG_DBDIR} ${PKG_TOOLS_BIN}/pkg_create
! PKG_DELETE?= PKG_DBDIR=${PKG_DBDIR} ${PKG_TOOLS_BIN}/pkg_delete
! PKG_INFO?= PKG_DBDIR=${PKG_DBDIR} ${PKG_TOOLS_BIN}/pkg_info
.if !defined(PKGTOOLS_VERSION)
.if !exists(${IDENT})
--- 639,649 ----
TYPE?= type # Shell builtin
.endif # !SunOS
! PKG_ADD?= PKG_PATH= PKG_DBDIR=${PKG_DBDIR} ${PKG_TOOLS_BIN}/pkg_add
! PKG_ADMIN?= PKG_PATH= PKG_DBDIR=${PKG_DBDIR} ${PKG_TOOLS_BIN}/pkg_admin
! PKG_CREATE?= PKG_PATH= PKG_DBDIR=${PKG_DBDIR} ${PKG_TOOLS_BIN}/pkg_create
! PKG_DELETE?= PKG_PATH= PKG_DBDIR=${PKG_DBDIR} ${PKG_TOOLS_BIN}/pkg_delete
! PKG_INFO?= PKG_PATH= PKG_DBDIR=${PKG_DBDIR} ${PKG_TOOLS_BIN}/pkg_info
.if !defined(PKGTOOLS_VERSION)
.if !exists(${IDENT})
***************
*** 2923,2940 ****
# XXX This is intended to be run before pkg_create is called, so the
# dependencies are all installed
print-pkg-size-depends:
! @${MAKE} ${MAKEFLAGS} print-pkg-size-depends-help \
| ${DC}
- # need this in a make look to prevent the shell clobbering the depends
- # also includes size of depends of depends (XXX)
- print-pkg-size-depends-help:
- @${ECHO} "0"
- .for dep in ${DEPENDS}
- @pkg="${dep:C/:.*//}"; \
- size=`${PKG_INFO} -qS "$$pkg"`; \
- ${TEST} -z "$$size" || ${ECHO} "$$size +"
- .endfor
- @${ECHO} "p"
###
--- 2923,2935 ----
# XXX This is intended to be run before pkg_create is called, so the
# dependencies are all installed
print-pkg-size-depends:
! ${MAKE} ${MAKEFLAGS} PACKAGE_DEPENDS_WITH_PATTERNS=false run-depends-list \
! | sort -u \
! | xargs ${SETENV} ${PKG_INFO} -qs \
! | ${AWK} 'BEGIN { print("0 "); } \
! /^[0-9].*/ { print($$1, " + "); } \
! END { print("p"); }' \
| ${DC}
###
>Release-Note:
>Audit-Trail:
>Unformatted: