2014年7月28日月曜日

Registering installation for pkg-1.3.1 Child process pid=xxxx terminated abnormally: Segmentation fault: 11

ports-mgmt/pkgを1.2.7_4から1.3.1にアップデートしようとすると以下のようなエラーになりました。
Deinstallation has been requested for the following 1 packages:

    pkg-1.2.7_4

The deinstallation will free 7 MB
[1/1] Deleting pkg-1.2.7_4... done
[Reading data from pkg(8) ... Child process pid=79756 terminated abnormally: Segmentation fault: 11
- 0 packages found - done]
--->  Installing the new version via the port
===>  Installing for pkg-1.3.1
===>   Registering installation for pkg-1.3.1
Child process pid=79837 terminated abnormally: Segmentation fault: 11
*** [fake-pkg] Error code 245
検索エンジンで調べてみると以下のようなWWWページを見つけました。
PKG 3.1.0 update - Segmentation fault: 11
http://www.mail-archive.com/freebsd-ports@freebsd.org/msg59950.html
スレッドを辿っていくと次のような解決策が示されていました。
PKG 3.1.0 update - Segmentation fault: 11
http://www.mail-archive.com/freebsd-ports@freebsd.org/msg59953.html

This is a known one I'm very sorry about but tricky to fix, to solve it, open your /usr/local/etc/pkg.conf you might have a duplicated entrey in alias (probable leaf), remove the second one, that will solve your problem.
/usr/local/etc/pkg.confを見てみると、ALIAS項のleaf行が重複しています。
ALIAS              : {
  all-depends: query %dn-%dv,
  annotations: info -A,
  build-depends: info -qd,
  download: fetch,
  iinfo: info -i -g -x,
  isearch: search -i -g -x,

  leaf: query -e "%a == 0" "%n-%v",
  leaf: query -e "%a == 0" "%n-%v",
  list: info -ql,
  origin: info -qo,
  provided-depends: info -qb,
  raw: info -R,
  required-depends: info -qr,
  shared-depends: info -qB,
  show: info -f -k,
  size: info -sq,
  }
これを1つにしてふたたびportupgrade ports-mgmt/pkgとするとインストールに成功しました。

pkg updatingを確認すると同様な記述がありました。
20140727:
  AFFECTS: users of ports-mgmt/pkg
  AUTHOR: mva@FreeBSD.org

  Before updating ports-mgmt/pkg, please make sure that there are no doubled
  entries in ${LOCALBASE}/etc/pkg.conf (/usr/local/etc/pkg.conf by default).
  Especially a doubled "leaf: " entry in the ALIAS settings of the default
  configuration may cause pkg to break during the update.