Bug 198898 - ports-mgmt/pkg: No syntax warning from pkg version
Summary: ports-mgmt/pkg: No syntax warning from pkg version
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Some People
Assignee: freebsd-pkg (Nobody)
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-03-25 13:48 UTC by elofu17
Modified: 2021-08-17 16:26 UTC (History)
3 users (show)

See Also:
bugzilla: maintainer-feedback? (pkg)


Attachments

Note You need to log in before you can comment on or make changes to this bug.
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.

Example:
# pkg version foobargazonk
<1s>
GeoIP-1.6.5                        >
<2s>
ImageMagick-6.9.0.10,1             >
<10s>
ORBit2-2.14.19_1                   =
<2s>
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: "http://10.10.10.10:8080", }
CONSERVATIVE_UPGRADE: YES

/Elof
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).
Comment 3 Baptiste Daroussin freebsd_committer freebsd_triage 2021-08-17 16:26:14 UTC
fix in the git, will be in the next release, thank you for reporting
https://github.com/freebsd/pkg/commit/38c0a4af62a8ebfdf108d8df6c8dadb21512e137