Bug 198898

Summary: ports-mgmt/pkg: No syntax warning from pkg version
Product: Ports & Packages Reporter: elofu17
Component: Individual Port(s)Assignee: freebsd-pkg (Nobody) <pkg>
Status: New ---    
Severity: Affects Some People CC: bapt, pkg, w.schwarzenfeld
Priority: --- Flags: bugzilla: maintainer-feedback? (pkg)
Version: Latest   
Hardware: Any   
OS: Any   

Description elofu17 2015-03-25 13:48:58 UTC
If you mistakenly add a word after the command 'pkg version', like 'pkg version foobargazonk', you don't get any syntax/usage error.
Instead the command takes a _long_ time to execute. I get between 1 to 10 seconds between each line of output.

# pkg version foobargazonk
GeoIP-1.6.5                        >
ImageMagick-,1             >
ORBit2-2.14.19_1                   =
adns-1.5.0                         >

Without the word "foobargazonk", the output quick.

I guess you should show an error/usage warning and then bail if the index "foobargazonk" does not exist instead of repeatedly trying to find it (or whatever is the cause of the slowness).

PS. On another machine (with only one repo and no DNS resolving), the command executes swiftly, so perhaps the delay only happen on machines with multiple repos?

The machine uses two repos:
# cat /usr/local/etc/pkg/repos/FreeBSD.conf 
FreeBSD: { enabled: yes, priority: 1 }

# cat /usr/local/etc/pkg/repos/foo.conf 
foo: {
    url:         "pkg+http://blahblah/93amd64-default/",
    mirror_type: "srv",
    enabled:     yes,
    priority:    15

# cat /usr/local/etc/pkg.conf
PKG_DBDIR: /var/db/pkg
PKG_CACHEDIR: /var/cache/pkg
PORTSDIR: /usr/ports
PKG_ENV: { http_proxy: "", }

Comment 1 elofu17 2015-06-30 15:26:28 UTC
Just an update:

pkg v1.5.4 still behave like this.

'pkg version' give rapid results.
'pkg version -R' give rapid results.
'pkg version foobargazonk' give no warning and takes some time for each line of output.
Comment 2 Walter Schwarzenfeld freebsd_triage 2018-01-12 06:49:37 UTC
Maintainer feedback, please (resp. close if outdated).