Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 25 Sep 2014 17:49:07 +0000
From:      bugzilla-noreply@freebsd.org
To:        freebsd-ports-bugs@FreeBSD.org
Subject:   [Bug 193928] New: pkg2ng always immediately seg faults on converting old package database
Message-ID:  <bug-193928-13@https.bugs.freebsd.org/bugzilla/>

next in thread | raw e-mail | index | archive | help
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=193928

            Bug ID: 193928
           Summary: pkg2ng always immediately seg faults on converting old
                    package database
           Product: Ports Tree
           Version: Latest
          Hardware: Any
                OS: Any
            Status: Needs Triage
          Severity: Affects Some People
          Priority: Normal
         Component: Individual Port(s)
          Assignee: freebsd-ports-bugs@FreeBSD.org
          Reporter: freebsd@spatula.net

Updating from an older 8.2-Stable to 8.4-Stable, after running
/usr/local/sbin/pkg2ng,  pkg immediately seg faults:
Converting packages from /var/db/pkg
Converting en-freebsd-doc-20110110...
Child process pid=21252 terminated abnormally: Segmentation fault: 11

After building again with debug symbols, gdb provides the following stack
trace:
#0  0x000000080175412a in strlcpy () from /lib/libc.so.7
#1  0x00000008006df44b in plist_new (pkg=0x801a9c800, stage=0x0) at
pkg_ports.c:1083
#2  0x00000008006dfd14 in ports_parse_plist (pkg=0x801a9c800,
    plist=0x7fffffffdec0 "/var/db/pkg/en-freebsd-doc-20110110/+CONTENTS",
stage=0x0) at pkg_ports.c:1140
#3  0x000000080070cd34 in pkg_old_load_from_path (pkg=0x801a9c800,
path=0x7fffffffe380 "/var/db/pkg/en-freebsd-doc-20110110")
    at pkg_old.c:72
#4  0x000000000040e20d in convert_from_old (pkg_add_dbdir=0x425b3d
"/var/db/pkg", dry_run=false) at convert.c:308
#5  0x000000000040e471 in exec_convert (argc=0, argv=0x7fffffffeaf8) at
convert.c:368
#6  0x00000000004144d9 in main (argc=1, argv=0x7fffffffeaf0) at main.c:822

In frame 1:
1083            strlcpy(p->prefix, prefix, sizeof(p->prefix));

prefix is a null pointer, so the strlcpy seg faults.  This suggests that the
previous line:
        pkg_get(pkg, PKG_PREFIX, &prefix);
Set &prefix to a null pointer, which was unchecked before the strlcpy.  As a
result no errors are provided, no warnings
offered, no workarounds are performed, and the program crashes instead of
handling whatever problem exists gracefully.

It appears to be trying to work with
"/var/db/pkg/en-freebsd-doc-20110110/+CONTENTS" at the time of the crash.

How-To-Repeat:
Have an older ports db. Try to upgrade.

Fix:
Not known at this time.

-- 
You are receiving this mail because:
You are the assignee for the bug.



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?bug-193928-13>