pkgsrc-Changes-HG archive

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

[pkgsrc/trunk]: pkgsrc/pkgtools/pkg_install/files pkg_install-20...



details:   https://anonhg.NetBSD.org/pkgsrc/rev/756d9e56bc9e
branches:  trunk
changeset: 306739:756d9e56bc9e
user:      joerg <joerg%pkgsrc.org@localhost>
date:      Wed Apr 25 12:20:53 2018 +0000
description:
pkg_install-20180425: correctly detect package names in PKG_DBDIR

If PKG_DBDIR is /foo and a path like /foobar is given, it is not below
PKG_DBDIR, so don't translate it into a package name look up. The old
logic for giving a path to PKG_DBDIR remains for legacy compat.

diffstat:

 pkgtools/pkg_install/files/info/main.c   |  16 ++++++++++------
 pkgtools/pkg_install/files/lib/version.h |   4 ++--
 2 files changed, 12 insertions(+), 8 deletions(-)

diffs (56 lines):

diff -r f4f5ada7a261 -r 756d9e56bc9e pkgtools/pkg_install/files/info/main.c
--- a/pkgtools/pkg_install/files/info/main.c    Wed Apr 25 12:12:52 2018 +0000
+++ b/pkgtools/pkg_install/files/info/main.c    Wed Apr 25 12:20:53 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: main.c,v 1.31 2012/12/17 04:34:02 agc Exp $    */
+/*     $NetBSD: main.c,v 1.32 2018/04/25 12:20:53 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.31 2012/12/17 04:34:02 agc Exp $");
+__RCSID("$NetBSD: main.c,v 1.32 2018/04/25 12:20:53 joerg Exp $");
 
 /*
  *
@@ -299,12 +299,16 @@
                                        errx(EXIT_FAILURE, "Error during search in pkgdb for %s", *argv);
                                }
                        } else {
-                               const char   *dbdir;
+                               const char *dbdir;
+                               size_t dbdirlen;
 
                                dbdir = pkgdb_get_dir();
-                               if (**argv == '/' && strncmp(*argv, dbdir, strlen(dbdir)) == 0) {
-                                       *argv += strlen(dbdir) + 1;
-                                       if ((*argv)[strlen(*argv) - 1] == '/') {
+                               dbdirlen = strlen(dbdir);
+                               if (**argv == '/' &&
+                                   strncmp(*argv, dbdir, dbdirlen) == 0 &&
+                                   (*argv)[dbdirlen] == '/') {
+                                       *argv += dbdirlen + 1;
+                                       if (**argv && (*argv)[strlen(*argv) - 1] == '/') {
                                                (*argv)[strlen(*argv) - 1] = 0;
                                        }
                                }
diff -r f4f5ada7a261 -r 756d9e56bc9e pkgtools/pkg_install/files/lib/version.h
--- a/pkgtools/pkg_install/files/lib/version.h  Wed Apr 25 12:12:52 2018 +0000
+++ b/pkgtools/pkg_install/files/lib/version.h  Wed Apr 25 12:20:53 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: version.h,v 1.175 2018/04/17 12:52:35 jperkin Exp $    */
+/*     $NetBSD: version.h,v 1.176 2018/04/25 12:20:54 joerg Exp $      */
 
 /*
  * Copyright (c) 2001 Thomas Klausner.  All rights reserved.
@@ -27,6 +27,6 @@
 #ifndef _INST_LIB_VERSION_H_
 #define _INST_LIB_VERSION_H_
 
-#define PKGTOOLS_VERSION 20180417
+#define PKGTOOLS_VERSION 20180425
 
 #endif /* _INST_LIB_VERSION_H_ */



Home | Main Index | Thread Index | Old Index