pkgsrc-Bugs archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
pkg/42213: pkg_install-20090816 introduces a major pointer bug to pkg_add.
>Number: 42213
>Category: pkg
>Synopsis: pkg_install-20090816 introduces a major pointer bug to pkg_add.
>Confidential: no
>Severity: serious
>Priority: high
>Responsible: pkg-manager
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Thu Oct 22 21:45:00 +0000 2009
>Originator: Steven Drake
>Release: Linux 2.6.30
>Environment:
System: Linux idran 2.6.30 #2 PREEMPT Sun Aug 9 18:32:44 NZST 2009 i686
pentium4 i386
Architecture: pentium4
Machine: i686
>Description:
When i starting upgrading to pkgsrc-2009Q3 i had some werd problems after
i upgraded pkg_install,
1:
pkg_add: exec of install script failed: No such file or directory
pkg_add: 1 package addition failed
2: (when trying to upgrade pkgx [just an exapmle package])
pkg_add: Conflicting PLIST with pkgx-2009Q3: bin/pkgx
pkg_add: 1 package addition failed
3:
The file /pkgdb.byfile.db
I've tracked this down to changes in the following code block:
$NetBSD: main.c,v 1.20 2009/08/16 14:26:46 joerg Exp $
@@ -153,6 +155,19 @@ main(int argc, char **argv)
pkg_install_config();
+ if (pkgdb == NULL)
+ pkgdb = _pkgdb_getPKGDB_DIR();
+ PlainPkgdb = xstrdup(pkgdb);
+
+ if (Destdir != NULL) {
+ char *pkgdbdir;
+
+ pkgdbdir = xasprintf("%s/%s", Destdir, pkgdb);
+ _pkgdb_setPKGDB_DIR(pkgdbdir);
+ free(pkgdbdir);
+ } else
+ _pkgdb_setPKGDB_DIR(pkgdb);
+
process_pkg_path();
TAILQ_INIT(&pkgs);
I think the following gdb session snippet will show the problem:
Breakpoint 1, main (argc=1, argv=0xbfd8116c) at main.c:168
168 _pkgdb_setPKGDB_DIR(pkgdb);
1: pkgdb_dir = 0x8091320 "/var/db/pkg"
(gdb) p pkgdb
$1 = 0x8091320 "/var/db/pkg"
(gdb) s
_pkgdb_setPKGDB_DIR (dir=0x8091320 "/var/db/pkg") at pkgdb.c:313
313 (void) snprintf(pkgdb_cache, sizeof(pkgdb_cache), "%s", dir);
1: pkgdb_dir = 0x8091320 "/var/db/pkg"
(gdb) p dir
$2 = 0x8091320 "/var/db/pkg"
(gdb) s
314 pkgdb_dir = pkgdb_cache;
1: pkgdb_dir = 0x8091320 ""
>Fix:
"pkg_add -P / ..." works fine.
or this patch
Index: add/main.c
===================================================================
RCS file: /cvsroot/pkgsrc/pkgtools/pkg_install/files/add/main.c,v
retrieving revision 1.22
diff -u -p -r1.22 main.c
--- add/main.c 7 Oct 2009 12:53:26 -0000 1.22
+++ add/main.c 22 Oct 2009 21:27:41 -0000
@@ -156,6 +156,9 @@ main(int argc, char **argv)
if (pkgdb == NULL)
pkgdb = _pkgdb_getPKGDB_DIR();
+ else
+ _pkgdb_setPKGDB_DIR(pkgdb);
+
PlainPkgdb = xstrdup(pkgdb);
if (Destdir != NULL) {
@@ -164,8 +167,7 @@ main(int argc, char **argv)
pkgdbdir = xasprintf("%s/%s", Destdir, pkgdb);
_pkgdb_setPKGDB_DIR(pkgdbdir);
free(pkgdbdir);
- } else
- _pkgdb_setPKGDB_DIR(pkgdb);
+ }
process_pkg_path();
TAILQ_INIT(&pkgs);
--
Steven
Home |
Main Index |
Thread Index |
Old Index