# pkg upgrade -v segfaults (wrong option)



## glocke (Feb 20, 2018)

Just upgraded `pkg` to version 1.10.5, ran a `pkg update` followed by a (misstyped) `pkg upgrade -v` (-v for verbose, me thinks, does not work, yes I know), and then a pkg child segfaults:

```
# pkg upgrade -v
Updating FreeBSD repository catalogue...
FreeBSD repository is up to date.
Updating local repository catalogue...
local repository is up to date.
All repositories are up to date.
vulnxml file up-to-date
Child process pid=53420 terminated abnormally: Segmentation fault
```
Needless to say, `pkg upgrade` runs without the segfault, if I omit the -v option. The above error is (at least for me on that machine) reproducible. I tried a `gdb` backtrace, but to no avail:

```
# gdb --core pkg.core
GNU gdb 6.1.1 [FreeBSD]
Copyright 2004 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for details.
This GDB was configured as "amd64-marcel-freebsd".
Core was generated by `pkg upgrade -v'.
Program terminated with signal 11, Segmentation fault.
#0  0x0000000800a3cb25 in ?? ()
(gdb) where
#0  0x0000000800a3cb25 in ?? ()
#1  0x0000000000000000 in ?? ()
```
This is probably just me, but has anybody seen this / can reproduce it? The machine is a 11.1-RELEASE-p4 FreeBSD 11.1-RELEASE-p4 #0: Tue Nov 14 06:12:40 UTC 2017     root@amd64-builder.daemonology.net:/usr/obj/usr/src/sys/GENERIC  amd64


----------



## talsamon (Feb 20, 2018)

Same result. It is a bug.
Edit: But it happens once only. If I tried it a second time, there is no segfault.


----------



## talsamon (Feb 20, 2018)

No, seems randomly.


----------



## talsamon (Feb 20, 2018)

Filed a PR:  PR 226072.


----------



## talsamon (Feb 20, 2018)

Which pkg version, please?


----------



## glocke (Feb 21, 2018)

Thank you talsamon, I replied to your PR.


----------



## talsamon (Feb 21, 2018)

The "new" port ports-mgmt/pkg-provides with the pkg plugin provides seems have a similar error:


```
pkg provides firefox
...

..

"expected normal output"

....

...

Child process pid=20622 terminated abnormally: Segmentation fault
```
segfaults at exit.
(Maintainer informed).


----------



## talsamon (Feb 21, 2018)

`"pkg upgrade -v`" was on my system my damaged database. I restored it again, and now it works without segfault. Pkg-provides still segfaults (seems
another problem).


----------

