Source-Changes-HG archive

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

[src/trunk]: src/external/bsd/pkg_install/dist pkg_install-20100421:



details:   https://anonhg.NetBSD.org/src/rev/efba864cc29c
branches:  trunk
changeset: 754219:efba864cc29c
user:      joerg <joerg%NetBSD.org@localhost>
date:      Fri Apr 23 20:54:06 2010 +0000

description:
pkg_install-20100421:
Fix an off-by-one in the check for properly sized pkgdb entries.
It rejected perfectly valid entries.

Extract dependencies of libarchive from the pkgconfig file and thereby
drop knowledge of the needed libraries.

At least some versions of HP-UX are known to not support %zu, add a
workaround. This is using the black list approach for now.

Recognize xz as compression type for pkg_create.

The first time an error is hit while fetching packages, try to reget
from the same position. This works around the server closing the
connection while fetching dependencies.

Try to detect common forms of pkgdb corruption and issue a warning in
that case.

Refactor the pkg_vulnerabilities logic to use the compression support
from libarchive. This reduces the amount zlib/bzip2 interaction to
the linkage.

Add man pages for audit-packages and download-vulnerability-list which
point to pkg_admin and notes that the scripts are obsolete.

diffstat:

 external/bsd/pkg_install/dist/add/perform.c                           |    6 +-
 external/bsd/pkg_install/dist/admin/audit-packages.8                  |   66 +++++
 external/bsd/pkg_install/dist/admin/audit.c                           |   22 +-
 external/bsd/pkg_install/dist/admin/download-vulnerability-list.8     |   54 ++++
 external/bsd/pkg_install/dist/admin/download-vulnerability-list.sh.in |    2 +-
 external/bsd/pkg_install/dist/admin/main.c                            |    8 +-
 external/bsd/pkg_install/dist/create/build.c                          |    6 +-
 external/bsd/pkg_install/dist/create/pkg_create.1                     |    4 +-
 external/bsd/pkg_install/dist/delete/pkg_delete.1                     |   50 ++-
 external/bsd/pkg_install/dist/info/pkg_info.1                         |   14 +-
 external/bsd/pkg_install/dist/lib/config.h.in                         |   18 +
 external/bsd/pkg_install/dist/lib/license.c                           |   20 +-
 external/bsd/pkg_install/dist/lib/pkg_io.c                            |   49 +++-
 external/bsd/pkg_install/dist/lib/pkgdb.c                             |   20 +-
 external/bsd/pkg_install/dist/lib/vulnerabilities-file.c              |  125 +++++++--
 15 files changed, 353 insertions(+), 111 deletions(-)

diffs (truncated from 960 to 300 lines):

diff -r e30b76def267 -r efba864cc29c external/bsd/pkg_install/dist/add/perform.c
--- a/external/bsd/pkg_install/dist/add/perform.c       Fri Apr 23 19:41:02 2010 +0000
+++ b/external/bsd/pkg_install/dist/add/perform.c       Fri Apr 23 20:54:06 2010 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: perform.c,v 1.1.1.15 2010/02/20 04:41:52 joerg Exp $   */
+/*     $NetBSD: perform.c,v 1.1.1.16 2010/04/23 20:54:06 joerg Exp $   */
 #if HAVE_CONFIG_H
 #include "config.h"
 #endif
@@ -6,7 +6,7 @@
 #if HAVE_SYS_CDEFS_H
 #include <sys/cdefs.h>
 #endif
-__RCSID("$NetBSD: perform.c,v 1.1.1.15 2010/02/20 04:41:52 joerg Exp $");
+__RCSID("$NetBSD: perform.c,v 1.1.1.16 2010/04/23 20:54:06 joerg Exp $");
 
 /*-
  * Copyright (c) 2003 Grant Beattie <grant%NetBSD.org@localhost>
@@ -1280,7 +1280,7 @@
        }
 
        if (pv == NULL) {
-               pv = read_pkg_vulnerabilities(pkg_vulnerabilities_file,
+               pv = read_pkg_vulnerabilities_file(pkg_vulnerabilities_file,
                    require_check, 0);
                if (pv == NULL)
                        return require_check;
diff -r e30b76def267 -r efba864cc29c external/bsd/pkg_install/dist/admin/audit-packages.8
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/external/bsd/pkg_install/dist/admin/audit-packages.8      Fri Apr 23 20:54:06 2010 +0000
@@ -0,0 +1,66 @@
+.\" $NetBSD: audit-packages.8,v 1.1.1.1 2010/04/23 20:54:06 joerg Exp $
+.\"
+.\" Copyright (c) 2010 The NetBSD Foundation, Inc.
+.\" All rights reserved.
+.\"
+.\" This code is derived from software contributed to The NetBSD Foundation
+.\" by Thomas Klausner.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\"    notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\"    notice, this list of conditions and the following disclaimer in the
+.\"    documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+.\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+.\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+.\" PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+.\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+.\" POSSIBILITY OF SUCH DAMAGE.
+.\"
+.Dd March 18, 2010
+.Dt AUDIT-PACKAGES 8
+.Os
+.Sh NAME
+.Nm audit-packages
+.Nd report vulnerabilities for the installed packages
+.Sh SYNOPSIS
+.Nm
+.Op Fl deqsVv
+.Op Fl c Ar config_file
+.Op Fl F Ar file
+.Op Fl g Ar file
+.Op Fl h Ar file
+.Op Fl K Ar pkg_dbdir
+.Op Fl n Ar package
+.Op Fl p Ar package
+.Op Fl Q Ar varname
+.Op Fl t Ar type
+.Sh DESCRIPTION
+.Nm
+is deprecated.
+Please use the
+.Cm audit ,
+.Cm audit-pkg ,
+.Cm audit-batch ,
+and
+.Cm fetch-pkg-vulnerabilities
+commands of
+.Xr pkg_admin 1
+instead.
+.Pp
+The
+.Nm
+script is installed for backwards compatibility only and will
+eventually be removed.
+.Sh SEE ALSO
+.Xr pkg_admin 1
diff -r e30b76def267 -r efba864cc29c external/bsd/pkg_install/dist/admin/audit.c
--- a/external/bsd/pkg_install/dist/admin/audit.c       Fri Apr 23 19:41:02 2010 +0000
+++ b/external/bsd/pkg_install/dist/admin/audit.c       Fri Apr 23 20:54:06 2010 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: audit.c,v 1.1.1.6 2009/08/06 16:55:19 joerg Exp $      */
+/*     $NetBSD: audit.c,v 1.1.1.7 2010/04/23 20:54:06 joerg Exp $      */
 
 #if HAVE_CONFIG_H
 #include "config.h"
@@ -7,7 +7,7 @@
 #if HAVE_SYS_CDEFS_H
 #include <sys/cdefs.h>
 #endif
-__RCSID("$NetBSD: audit.c,v 1.1.1.6 2009/08/06 16:55:19 joerg Exp $");
+__RCSID("$NetBSD: audit.c,v 1.1.1.7 2010/04/23 20:54:06 joerg Exp $");
 
 /*-
  * Copyright (c) 2008 Joerg Sonnenberger <joerg%NetBSD.org@localhost>.
@@ -209,7 +209,7 @@
                            (long)(now / 86400), now / 86400 == 1 ? "" : "s");
        }
 
-       pv = read_pkg_vulnerabilities(pkg_vulnerabilities_file, 0, check_signature);
+       pv = read_pkg_vulnerabilities_file(pkg_vulnerabilities_file, 0, check_signature);
 }
 
 void
@@ -282,7 +282,7 @@
        if (argc != optind + 1)
                usage();
 
-       pv = read_pkg_vulnerabilities(argv[optind], 0, check_signature);
+       pv = read_pkg_vulnerabilities_file(argv[optind], 0, check_signature);
        free_pkg_vulnerabilities(pv);
 }
 
@@ -290,8 +290,8 @@
 fetch_pkg_vulnerabilities(int argc, char **argv)
 {
        struct pkg_vulnerabilities *pv_check;
-       char *buf, *decompressed_input;
-       size_t buf_len, buf_fetched, decompressed_len;
+       char *buf;
+       size_t buf_len, buf_fetched;
        ssize_t cur_fetched;
        struct url *url;
        struct url_stat st;
@@ -363,15 +363,7 @@
        
        buf[buf_len] = '\0';
 
-       if (decompress_buffer(buf, buf_len, &decompressed_input,
-           &decompressed_len)) {
-               pv_check = parse_pkg_vulnerabilities(decompressed_input,
-                   decompressed_len, check_signature);
-               free(decompressed_input);
-       } else {
-               pv_check = parse_pkg_vulnerabilities(buf, buf_len,
-                   check_signature);
-       }
+       pv_check = read_pkg_vulnerabilities_memory(buf, buf_len, check_signature);
        free_pkg_vulnerabilities(pv_check);
 
        fd = open(pkg_vulnerabilities_file, O_WRONLY | O_CREAT | O_TRUNC, 0644);
diff -r e30b76def267 -r efba864cc29c external/bsd/pkg_install/dist/admin/download-vulnerability-list.8
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/external/bsd/pkg_install/dist/admin/download-vulnerability-list.8 Fri Apr 23 20:54:06 2010 +0000
@@ -0,0 +1,54 @@
+.\" $NetBSD: download-vulnerability-list.8,v 1.1.1.1 2010/04/23 20:54:06 joerg Exp $
+.\"
+.\" Copyright (c) 2010 The NetBSD Foundation, Inc.
+.\" All rights reserved.
+.\"
+.\" This code is derived from software contributed to The NetBSD Foundation
+.\" by Thomas Klausner.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\"    notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\"    notice, this list of conditions and the following disclaimer in the
+.\"    documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+.\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+.\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+.\" PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+.\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+.\" POSSIBILITY OF SUCH DAMAGE.
+.\"
+.Dd March 18, 2010
+.Dt DOWNLOAD-VULNERABILITY-LIST 8
+.Os
+.Sh NAME
+.Nm download-vulnerability-list
+.Nd download vulnerability list used for checking installed packages
+.Sh SYNOPSIS
+.Nm
+.Op Fl hs
+.Op Fl c Ar config_file
+.Sh DESCRIPTION
+.Nm
+is deprecated.
+Please use the
+.Cm fetch-pkg-vulnerabilities
+command of
+.Xr pkg_admin 1
+instead.
+.Pp
+The
+.Nm
+script is installed for backwards compatibility only and will
+eventually be removed.
+.Sh SEE ALSO
+.Xr pkg_admin 1
diff -r e30b76def267 -r efba864cc29c external/bsd/pkg_install/dist/admin/download-vulnerability-list.sh.in
--- a/external/bsd/pkg_install/dist/admin/download-vulnerability-list.sh.in     Fri Apr 23 19:41:02 2010 +0000
+++ b/external/bsd/pkg_install/dist/admin/download-vulnerability-list.sh.in     Fri Apr 23 20:54:06 2010 +0000
@@ -3,7 +3,7 @@
 pkg_admin=@PKG_ADMIN@
 
 usage() {
-       echo 'Usage: download-vulnerability-list -hs [-c config_file]' >& $2
+       echo 'Usage: download-vulnerability-list [-hs] [-c config_file]' >& $2
        echo "Please use \`\`pkg_admin fetch-pkg-vulnerabilities'' instead." >& $2
        exit $1
 }
diff -r e30b76def267 -r efba864cc29c external/bsd/pkg_install/dist/admin/main.c
--- a/external/bsd/pkg_install/dist/admin/main.c        Fri Apr 23 19:41:02 2010 +0000
+++ b/external/bsd/pkg_install/dist/admin/main.c        Fri Apr 23 20:54:06 2010 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: main.c,v 1.1.1.14 2010/02/20 04:41:53 joerg Exp $      */
+/*     $NetBSD: main.c,v 1.1.1.15 2010/04/23 20:54:07 joerg Exp $      */
 
 #if HAVE_CONFIG_H
 #include "config.h"
@@ -7,7 +7,7 @@
 #if HAVE_SYS_CDEFS_H
 #include <sys/cdefs.h>
 #endif
-__RCSID("$NetBSD: main.c,v 1.1.1.14 2010/02/20 04:41:53 joerg Exp $");
+__RCSID("$NetBSD: main.c,v 1.1.1.15 2010/04/23 20:54:07 joerg Exp $");
 
 /*-
  * Copyright (c) 1999-2009 The NetBSD Foundation, Inc.
@@ -248,8 +248,8 @@
        iterate_pkg_db(add_pkg, &count);
 
        printf("\n");
-       printf("Stored %zu file%s and %zu explicit director%s"
-           " from %zu package%s in %s.\n",
+       printf("Stored %" PRIzu " file%s and %zu explicit director%s"
+           " from %"PRIzu " package%s in %s.\n",
            count.files, count.files == 1 ? "" : "s",
            count.directories, count.directories == 1 ? "y" : "ies",
            count.packages, count.packages == 1 ? "" : "s",
diff -r e30b76def267 -r efba864cc29c external/bsd/pkg_install/dist/create/build.c
--- a/external/bsd/pkg_install/dist/create/build.c      Fri Apr 23 19:41:02 2010 +0000
+++ b/external/bsd/pkg_install/dist/create/build.c      Fri Apr 23 20:54:06 2010 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: build.c,v 1.1.1.7 2009/11/05 18:39:02 joerg Exp $      */
+/*     $NetBSD: build.c,v 1.1.1.8 2010/04/23 20:54:07 joerg Exp $      */
 
 #if HAVE_CONFIG_H
 #include "config.h"
@@ -7,7 +7,7 @@
 #if HAVE_SYS_CDEFS_H
 #include <sys/cdefs.h>
 #endif
-__RCSID("$NetBSD: build.c,v 1.1.1.7 2009/11/05 18:39:02 joerg Exp $");
+__RCSID("$NetBSD: build.c,v 1.1.1.8 2010/04/23 20:54:07 joerg Exp $");
 
 /*-
  * Copyright (c) 2007 Joerg Sonnenberger <joerg%NetBSD.org@localhost>.
@@ -254,6 +254,8 @@
                archive_write_set_compression_bzip2(archive);
        else if (strcmp(CompressionType, "gzip") == 0)
                archive_write_set_compression_gzip(archive);
+       else if (strcmp(CompressionType, "xz") == 0)
+               archive_write_set_compression_xz(archive);
        else if (strcmp(CompressionType, "none") == 0)
                archive_write_set_compression_none(archive);
        else
diff -r e30b76def267 -r efba864cc29c external/bsd/pkg_install/dist/create/pkg_create.1
--- a/external/bsd/pkg_install/dist/create/pkg_create.1 Fri Apr 23 19:41:02 2010 +0000
+++ b/external/bsd/pkg_install/dist/create/pkg_create.1 Fri Apr 23 20:54:06 2010 +0000
@@ -1,4 +1,4 @@
-.\" $NetBSD: pkg_create.1,v 1.1.1.7 2010/01/30 21:33:32 joerg Exp $
+.\" $NetBSD: pkg_create.1,v 1.1.1.8 2010/04/23 20:54:08 joerg Exp $
 .\"
 .\" FreeBSD install - a package for the installation and maintenance
 .\" of non-core utilities.
@@ -166,7 +166,7 @@
 as compression algorithm.
 This overrides the heuristic to guess the compression type from the
 output name.



Home | Main Index | Thread Index | Old Index