Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Detect and report package shadowing #58

Closed
Enchufa2 opened this issue Feb 10, 2023 · 1 comment · Fixed by #62
Closed

Detect and report package shadowing #58

Enchufa2 opened this issue Feb 10, 2023 · 1 comment · Fixed by #62
Labels
enhancement New feature or request

Comments

@Enchufa2
Copy link
Member

Initial motivation: eddelbuettel/r2u#30. It would be nice to have a mechanism to detect and report shadowed packages, i.e. packages that are available in several .libPaths(). In this first iteration, I devise:

  1. An exported function, e.g. bspm::shadowed_packages(), which would work as a thin wrapper around installed.packages(). It would filter its output to detect package shadowing and would return a matrix (to follow the same convention) with at least the following columns: Package, LibPath, Version, ShadowPackage, ShadowLibPath, and ShadowVersion or similar naming. Basically, the idea is that each row is a Package that is being shadowed by ShadowPackage in a ShadowLibPath with higher priority.
  2. A non-exported function that takes the output from (1) and generates one message (warning?) per row to alert the user about shadowed packages.
  3. Integration of the alert messages (with shut-off switches via options). Possible places that come to mind:
    • On bspm startup.
    • On package installation, a message/warning for packages that have another one shadowing them. This would be available only for the default slower-but-safer mode, not in the binary-source mode.
    • ...?

@eddelbuettel As always, comments welcome.

@eddelbuettel
Copy link
Contributor

eddelbuettel commented Feb 10, 2023

No comment with code yet, been meaning to write one for my own use (as I believe I mentioned to your prior to eddelbuettel/r2u#30) and would (at least locally) default to sort via data.table. If and when I have something I may drop here.

The need is actually broader than bspm as you and I discussed. It can arise whenever length(.libPaths()) > 1.

@Enchufa2 Enchufa2 added the enhancement New feature or request label Feb 11, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants