pkgsrc-Bugs archive

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

pkg/46382: lintpkgsrc may overflow /bin/sh command line length

>Number:         46382
>Category:       pkg
>Synopsis:       lintpkgsrc may overflow /bin/sh command line length
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    pkg-manager
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Thu Apr 26 13:05:00 +0000 2012
>Originator:     Havard Eidnes
>Release:        NetBSD 5.1
System: NetBSD 5.1 NetBSD 5.1 (GRANNY-SMITH) #4: 
Fri Apr 16 16:03:14 CEST 2010
Architecture: powerpc
Machine: macppc
        The old pkgsrc build scripts try to clean out distfiles
        which are no longer referenced, or where the checksum does
        not match.  To do this task, they use lintpkgsrc, like so:

        lintpkgsrc -K /usr/pkgsrc/packages/powerpc \
                -P /usr/pkgsrc \
                -M /usr/pkgsrc/distfiles \
                -o -m -r

        However, in the phase where lintpkgsrc tries to checksum all
        the existing distfiles, the command line may overflow, causing
        this function to fail.  Apparently some use of xargs is required.

        Have lots of old distfiles in a bulk pkgsrc build, watch
        lintpkgsrc bail out when trying to checksum the old distfiles,
        causing the old distfiles never to be cleaned up.
        Here is a draft fix which works, but which uses the "mktemp"
        utility.  It is possible or maybe even probable that this is
        not sufficiently portable, and that we'd instead have to resort
        to something like /tmp/pl-sumfiles.$$, which isn't quite as
        safe.  Suggestions welcome.

RCS file: /cvsroot/pkgsrc/pkgtools/pkglint/files/,v
retrieving revision 1.115
diff -u -p -r1.115
---       22 Nov 2007 09:36:38 -0000      1.115
+++       26 Apr 2012 11:40:14 -0000
@@ -1538,7 +1538,13 @@ sub scan_pkgsrc_distfiles_vs_distinfo($$
-            open( DIGEST, "digest $sum @{$sumfiles{$sum}}|" )
+           my($tmpfile) = `mktemp /tmp/pl-sumfiles.XXXXXXX`;
+           open(SFILES, ">" . $tmpfile);
+           foreach my $f (@{$sumfiles{$sum}}) {
+               printf(SFILES "%s\n", $f);
+           }
+           close(SFILES);
+            open(DIGEST, "cat $tmpfile | xargs digest $sum |" )
               || fail("Run digest: $!");
             while (<DIGEST>) {
                 if (m/^$sum ?\(([^\)]+)\) = (\S+)/) {
@@ -1549,6 +1555,7 @@ sub scan_pkgsrc_distfiles_vs_distinfo($$
+           unlink($tmpfile);
         safe_chdir('/');    # Do not want to stay in $pkgdistdir

Home | Main Index | Thread Index | Old Index