Skip to content

Commit

Permalink
Route all candidate packages via find_pkg_match().
Browse files Browse the repository at this point in the history
Previously any package that wasn't considered a glob was passed right
though, but due to some later exact_pkgfmt checks could result in
questionable results.

For example, given the following available packages:

  tex-pst-2dplot-1.5   PSTricks package for drawing 2D curves
  tex-pst-2dplot-doc-1.5  Documentation for tex-pst-2dplot

Running "pkgin install tex-pst-2d" would result in an install attempt
for tex-pst-2dplot-doc, due to "-2" being handled as a version match,
which differs from regular package match behaviour.

Passing all package requests through find_pkg_match() first ensures we
now get the correct:

  tex-pst-2d is not available in the repository

even if it is slightly more expensive.
  • Loading branch information
Jonathan Perkin committed May 26, 2020
1 parent f80e1e5 commit ac6911e
Showing 1 changed file with 6 additions and 10 deletions.
16 changes: 6 additions & 10 deletions pkg_str.c
Original file line number Diff line number Diff line change
Expand Up @@ -330,16 +330,12 @@ glob_to_pkgarg(char **globpkg, int *rc)
for (i = 0, count = 0; globpkg[i] != NULL; i++, count++) {
pkgargs = xrealloc(pkgargs, (count + 2) * sizeof(char *));

if (strpbrk(globpkg[i], GLOBCHARS) == NULL)
pkgargs[count] = xstrdup(globpkg[i]);
else {
if ((plist = find_pkg_match(&r_plisthead,
globpkg[i])) == NULL) {
fprintf(stderr, MSG_PKG_NOT_AVAIL, globpkg[i]);
count--;
*rc = EXIT_FAILURE;
} else
pkgargs[count] = xstrdup(plist->full);
if ((plist = find_pkg_match(&r_plisthead, globpkg[i]))) {
pkgargs[count] = xstrdup(plist->full);
} else {
fprintf(stderr, MSG_PKG_NOT_AVAIL, globpkg[i]);
count--;
*rc = EXIT_FAILURE;
}
}

Expand Down

0 comments on commit ac6911e

Please sign in to comment.