diff options
author | krion <krion@FreeBSD.org> | 2005-10-10 12:35:31 +0000 |
---|---|---|
committer | krion <krion@FreeBSD.org> | 2005-10-10 12:35:31 +0000 |
commit | d66abe9463dbca031ad32fb5b1a76d92ab39f69a (patch) | |
tree | 34d92b0203adc1727334b95043a51fd31aec4604 /usr.sbin | |
parent | f24893fc40375ca708e7a0ab08a1dac02ddbe8b8 (diff) | |
download | FreeBSD-src-d66abe9463dbca031ad32fb5b1a76d92ab39f69a.zip FreeBSD-src-d66abe9463dbca031ad32fb5b1a76d92ab39f69a.tar.gz |
* pkg_version(1) exits if INDEX files is not found and -I is not
specified. The result is that the package will be listed with a '?'
as if it was not found within the INDEX file, so fix this behaviour.
* Remove trailing spaces.
PR: bin/87136
Submitted by: Sean Farley <sean-freebsd at farley dot org>
MFC after: 3 days
Diffstat (limited to 'usr.sbin')
-rw-r--r-- | usr.sbin/pkg_install/version/perform.c | 13 | ||||
-rwxr-xr-x | usr.sbin/pkg_install/version/test-pkg_version.sh | 2 |
2 files changed, 10 insertions, 5 deletions
diff --git a/usr.sbin/pkg_install/version/perform.c b/usr.sbin/pkg_install/version/perform.c index 6659328..85976f8 100644 --- a/usr.sbin/pkg_install/version/perform.c +++ b/usr.sbin/pkg_install/version/perform.c @@ -165,6 +165,10 @@ pkg_do(char *pkg) } } if (latest == NULL) { + /* Report package as not found in INDEX if the INDEX is not required. */ + if (IndexFile == NULL && !UseINDEXOnly) + show_version(plist, NULL, plist.origin); + else { /* We only pull in the INDEX once, if needed. */ if (SLIST_EMPTY(&Index)) { if (!IndexFile) @@ -230,6 +234,7 @@ pkg_do(char *pkg) show_version(plist, NULL, NULL); else show_version(plist, latest, "index"); + } } if (latest != NULL) free(latest); @@ -331,13 +336,13 @@ version_match(char *pattern, const char *pkgname) fp = fetchGetURL(pkgname, ""); isTMP = TRUE; matchstream = 1; - if (fp == NULL) + if (fp == NULL) errx(2, "Unable to open %s.", pkgname); } else if (pkgname[0] == '/') { fp = fopen(pkgname, "r"); isTMP = TRUE; matchstream = 1; - if (fp == NULL) + if (fp == NULL) errx(2, "Unable to open %s.", pkgname); } else if (strcmp(pkgname, "-") == 0) { fp = stdin; @@ -346,13 +351,13 @@ version_match(char *pattern, const char *pkgname) fp = fetchGetURL(pattern, ""); isTMP = TRUE; matchstream = -1; - if (fp == NULL) + if (fp == NULL) errx(2, "Unable to open %s.", pattern); } else if (pattern[0] == '/') { fp = fopen(pattern, "r"); isTMP = TRUE; matchstream = -1; - if (fp == NULL) + if (fp == NULL) errx(2, "Unable to open %s.", pattern); } else if (strcmp(pattern, "-") == 0) { fp = stdin; diff --git a/usr.sbin/pkg_install/version/test-pkg_version.sh b/usr.sbin/pkg_install/version/test-pkg_version.sh index 5c3d98d..95486c1 100755 --- a/usr.sbin/pkg_install/version/test-pkg_version.sh +++ b/usr.sbin/pkg_install/version/test-pkg_version.sh @@ -50,7 +50,7 @@ test-pv ( ) { \ test-pv 0.10 "=" 0.10_0 coercion test-pv 0.10 "=" 0.10,0 coercion test-pv 0.10 "=" 0.10_0,0 coercion - + # Test various comparisons test-pv 1.0 "=" 1.0 equality test-pv 2.15a "=" 2.15a equality |