Skip to content

Fix pkg_deps_explain() for local package paths (#470) - #919

Open
taekop wants to merge 1 commit into
r-lib:mainfrom
taekop:fix-deps-explain-local
Open

taekop wants to merge 1 commit into
r-lib:mainfrom
taekop:fix-deps-explain-local

Conversation

@taekop

@taekop taekop commented Oct 5, 2026

Copy link
Copy Markdown
Contributor

pkg_deps_explain(".", "foobar") fails in the subprocess:

Caused by error in `adjlist[[wpkg]] <- deps1`:
! attempt to select more than one element in integerOneIndex

pkg_deps_explain_internal() finds the requested package with match(pkg, data$ref), but for a local path the solution's ref is local::., not .. match() returns NA, and adjlist[[NA]] <- ... is the error. The local::. spelling worked, which is the workaround in the issue.

When there is no exact match it now uses the row marked direct in the solution. If pkg matches ref as before, nothing changes.

The new tests/testthat/test-deps-explain.R uses two local packages and checks that "." gives the same paths as "local::.". It fails on main and passes here. I also compared 18 pkg_deps_explain() calls on main and on this branch (., ./, an absolute path, local::., upgrade = FALSE, dependencies = FALSE, repeated and self deps, and CRAN, cran::, standard::, versioned and GitHub refs). Everything that worked before gives the same output; the local path calls that errored now work. The full suite has the same failures on both builds (keyring, PPM SSO), minus the new test.

Closes #470

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Bug in pak::pkg_deps_explain(".", "foobar")

1 participant