Subject: pkg/37447: pkg_create failure in bulk build leaves truncated .tgz file
To: None <pkg-manager@netbsd.org, gnats-admin@netbsd.org,>
From: Andreas Gustafsson <gson@gson.org>
List: pkgsrc-bugs
Date: 11/29/2007 11:00:01
>Number:         37447
>Category:       pkg
>Synopsis:       pkg_create failure in bulk build leaves truncated .tgz file
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    pkg-manager
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Thu Nov 29 11:00:00 +0000 2007
>Originator:     Andreas Gustafsson
>Release:        NetBSD 4.99.30
>Organization:
>Environment:
System: NetBSD current.araneus.fi 4.99.30 NetBSD 4.99.30 (XEN3_DOMU) #0: root@current.araneus.fi:/usr/build/20070827-1931/obj/sys/arch/i386/compile/XEN3_DOMU i386
Architecture: i386
Machine: i386
>Description:

When pkg_create fails during a bulk pkgsrc build, it will leave a
truncated package .tgz file under /usr/pkgsrc/packages/All.

This is bad because it messes up dependencies.  For example, it causes
the bulk build framework to attempt to build dependent packages only
to have those builds fail due to the truncated .tgz, instead of
properly marking the dependent packages as depending on a failed
package.

>How-To-Repeat:

Do a bulk build of a current pkgsrc under a current NetBSD and watch
the devel/pango build fail as follows:

  2007/11/28 12:13:00  482/596=80.9% devel/pango @ i386> ===> Building binary package for pango-1.18.3
  2007/11/28 12:13:00  482/596=80.9% devel/pango @ i386> pkg_create: can't stat `/usr/pkg/include/pango-1.0/pango/pangocairo.h'
  2007/11/28 12:13:00  482/596=80.9% devel/pango @ i386> pkg_create: can't stat `/usr/pkg/lib/libpangocairo-1.0.la'
  2007/11/28 12:13:00  482/596=80.9% devel/pango @ i386> pkg_create: can't stat `/usr/pkg/lib/pkgconfig/pangocairo.pc'
  2007/11/28 12:13:00  482/596=80.9% devel/pango @ i386> pkg_create: lstat failed for file include/pango-1.0/pango/pangocairo.h: No such file or directory
  2007/11/28 12:13:00  482/596=80.9% devel/pango @ i386> Creating package /usr/pkgsrc/packages/All/pango-1.18.3
  2007/11/28 12:13:00  482/596=80.9% devel/pango @ i386> Using SrcDir value of /usr/pkg
  2007/11/28 12:13:00  482/596=80.9% devel/pango @ i386> *** Error code 2

Find that a package .tgz file was nevertheless created, and that it
is truncated:

  # zcat --test /usr/pkgsrc/packages/All/pango-1.18.3.tgz 
  zcat: /usr/pkgsrc/packages/All/pango-1.18.3.tgz: unexpected end of file
  zcat: /usr/pkgsrc/packages/All/pango-1.18.3.tgz: uncompress failed

>Fix:

Make pkg_create unlink the package .tgz file on failure.