Bug 193890 - On FreeBSD 10.1-BETA2 amd64, pkg 1.3.8 segfaults
Summary: On FreeBSD 10.1-BETA2 amd64, pkg 1.3.8 segfaults
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Many People
Assignee: Bryan Drewery
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-09-24 13:03 UTC by Nikolai Lifanov
Modified: 2014-09-24 18:36 UTC (History)
1 user (show)

See Also:


Attachments
problem repo config (783 bytes, application/gzip)
2014-09-24 18:08 UTC, Nikolai Lifanov
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Nikolai Lifanov 2014-09-24 13:03:06 UTC
I'm running FreeBSD 10.1-BETA2 amd64 and just got a pkg 1.3.8 update from new_xorg repo. Running pkg or pkg-static with any arguments produces a segfault:
 Child process pid=31293 terminated abnormally: Segmentation fault

I tried compiling 1.3.8 from ports, but I can't pass a version check because pkg-static (as well as the newly-created pkg-static) segfaults as well.

I'm able to restore a system to a working state by pulling pkg-static 1.3.7 from a backup and doing "./pkg-static install -f pkg-1.3.7". Then everything works.
Comment 1 Nikolai Lifanov 2014-09-24 15:28:04 UTC
I'm not able to reproduce it with a freshly-installed 10.1-BETA2, but I was able to use it to create a non-stripped version to install on the problem system. 
Backtrace:

#0  0x000000080063c571 in r_debug_state () from /libexec/ld-elf.so.1
(gdb) bt
#0  0x000000080063c571 in r_debug_state () from /libexec/ld-elf.so.1
#1  0x0000000800655548 in ?? ()
#2  0x0000000800000001 in ?? ()
#3  0x0000000200000000 in ?? ()
#4  0x0000000802876218 in ?? () from /lib/libc.so.7
#5  0x00007fffffffdb38 in ?? ()
#6  0x00007fff00000002 in ?? ()
#7  0x00007fffffffdab8 in ?? ()
#8  0x00007fffffffdab8 in ?? ()
#9  0x00007fffffffda50 in ?? ()
#10 0x0000000800656400 in ?? ()
#11 0x00007fffffffd970 in ?? ()
#12 0x000000080063f7bc in _rtld_get_stack_prot () from /libexec/ld-elf.so.1
Previous frame inner to this frame (corrupt stack?)
Comment 2 Nikolai Lifanov 2014-09-24 15:43:04 UTC
Better backtrace here. Removing /usr/local/etc/pkg/repos/FreeBSD.conf makes pkg work again. I also created a github issue #1024 about it. I always get the best numbers!

Core was generated by `pkg'.
Program terminated with signal 11, Segmentation fault.
Reading symbols from /usr/local/lib/libpkg.so.3...done.
Loaded symbols for /usr/local/lib/libpkg.so.3
Reading symbols from /usr/lib/libelf.so.1...done.
Loaded symbols for /usr/lib/libelf.so.1
Reading symbols from /usr/lib/libexecinfo.so.1...done.
Loaded symbols for /usr/lib/libexecinfo.so.1
Reading symbols from /usr/lib/libfetch.so.6...done.
Loaded symbols for /usr/lib/libfetch.so.6
Reading symbols from /lib/libutil.so.9...done.
Loaded symbols for /lib/libutil.so.9
Reading symbols from /usr/lib/libssl.so.7...done.
Loaded symbols for /usr/lib/libssl.so.7
Reading symbols from /lib/libcrypto.so.7...done.
Loaded symbols for /lib/libcrypto.so.7
Reading symbols from /lib/libm.so.5...done.
Loaded symbols for /lib/libm.so.5
Reading symbols from /lib/libjail.so.1...done.
Loaded symbols for /lib/libjail.so.1
Reading symbols from /usr/lib/libarchive.so.6...done.
Loaded symbols for /usr/lib/libarchive.so.6
Reading symbols from /lib/libz.so.6...done.
Loaded symbols for /lib/libz.so.6
Reading symbols from /usr/lib/libbz2.so.4...done.
Loaded symbols for /usr/lib/libbz2.so.4
Reading symbols from /usr/lib/liblzma.so.5...done.
Loaded symbols for /usr/lib/liblzma.so.5
Reading symbols from /lib/libc.so.7...done.
Loaded symbols for /lib/libc.so.7
Reading symbols from /lib/libgcc_s.so.1...done.
Loaded symbols for /lib/libgcc_s.so.1
Reading symbols from /lib/libbsdxml.so.4...done.
Loaded symbols for /lib/libbsdxml.so.4
Reading symbols from /libexec/ld-elf.so.1...done.
Loaded symbols for /libexec/ld-elf.so.1
#0  0x00000008029a8f8b in strlen () from /lib/libc.so.7
(gdb) bt
#0  0x00000008029a8f8b in strlen () from /lib/libc.so.7
#1  0x00000008028f7f42 in strdup () from /lib/libc.so.7
#2  0x00000008008968df in pkg_repo_overwrite (r=0x80384d0c0, 
    name=0x803835290 "FreeBSD", url=0x0, type=0x0) at pkg_config.c:1070
#3  0x00000008008958d7 in add_repo (obj=0x803836e00, r=0x80384d0c0, 
    rname=0x803835290 "FreeBSD", flags=0) at pkg_config.c:533
#4  0x000000080089513b in walk_repo_obj (obj=0x803836dc0, 
    file=0x7fffffffde60 "/usr/local/etc/pkg/repos/FreeBSD.conf", flags=0)
    at pkg_config.c:595
#5  0x000000080089506c in load_repo_file (
    repofile=0x7fffffffde60 "/usr/local/etc/pkg/repos/FreeBSD.conf", flags=0)
    at pkg_config.c:648
#6  0x0000000800894ea4 in load_repo_files (
    repodir=0x803828200 "/usr/local/etc/pkg/repos/", flags=0)
    at pkg_config.c:675
#7  0x0000000800894077 in load_repositories (repodir=0x0, flags=0)
    at pkg_config.c:694
#8  0x0000000800893bed in pkg_ini (path=0x800a5d21e "/usr/local/etc/pkg.conf", 
    reposdir=0x0, flags=0) at pkg_config.c:1009
#9  0x00000000004169b7 in main (argc=1, argv=0x7fffffffe958) at main.c:705
Comment 3 Nikolai Lifanov 2014-09-24 18:08:50 UTC
Created attachment 147638 [details]
problem repo config

Please have repos necessary to reproduce the problem when installed into a fresh system.
Comment 4 commit-hook freebsd_committer 2014-09-24 18:36:06 UTC
A commit references this bug:

Author: bdrewery
Date: Wed Sep 24 18:35:28 UTC 2014
New revision: 369194
URL: http://svnweb.freebsd.org/changeset/ports/369194

Log:
  - Fix crash when overriding repo configs.

  PR:		193890
  Reported by:	Nikolai Lifanov
  With hat:	portmgr
  Pointyhat to:	bdrewery

Changes:
  head/ports-mgmt/pkg/Makefile
  head/ports-mgmt/pkg/files/patch-libpkg__pkg_config.c