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

install/upgrade: Add --no-shim option to allow skipping creation of shims from user side #1670

Open
Badgerati opened this issue Nov 1, 2018 · 9 comments · May be fixed by #2003
Open

install/upgrade: Add --no-shim option to allow skipping creation of shims from user side #1670

Badgerati opened this issue Nov 1, 2018 · 9 comments · May be fixed by #2003

Comments

@Badgerati
Copy link

Is there a possibility of having a new --no-shim option on install and upgrade, to completely skip shimming altogether?

I'm aware that creating a .ignore file will stop an exe from being shimmed, but for massive packages the process of scanning for exes can take quite a long time. It would be nice if there were a CLI option to skip it altogether.

@AndrewGaspar
Copy link

I would also like this - the shims for mingw cause issues with clang --target=x86_64-pc-windows-gnu, since clang cannot find the total MinGW installation from the chocolatey executables.

@ferventcoder
Copy link
Member

@AndrewGaspar might not be a bad idea to provide that feedback to the folks maintaining the MinGW packages so that they can look for an alternate place to set those binaries (and not in the packaging). That way they won't get shimmed.

@Badgerati I like this. I think it would be a good feature add. Sorry I'm just now coming across this issue, my email is a little on the full side.

@AndrewGaspar
Copy link

@ferventcoder Sent an email to the maintainers with a link here. The executables are also in a "bin" folder for the package already - the problem is if clang sees multiple paths to the gnu executables, it doesn't know where to find includes, libs, etc., and it also can't find them from the shim path.

@gep13 gep13 modified the milestones: 0.10.15, 0.10.16 May 31, 2019
@jayvdb
Copy link

jayvdb commented Jun 14, 2019

Seems to be a dup of #1105 , which was closed as feature chocolatey/home#213 is how it was envisaged to be solved.

@Badgerati
Copy link
Author

While I agree that chocolatey/home#213 might be a better way of making this work; it's also been open since 2015 with no progress 🤔 .

A --no-shim flag could also still be nice, as an easier way to completely stop shimming - even on packages we don't control.

@johnstevenson
Copy link

@ferventcoder I'm willing to give this a shot - if no one else is working on it.

johnstevenson added a commit to johnstevenson/choco that referenced this issue Feb 17, 2020
The --noshims and --noshimsglobal options allow the user to stop shims
being created for either the package, or the package and its
dependencies.

In addition to this new behaviour, the implementation handles the
creation and removal of shims more robustly, so that shims from other
packages (or the same package) cannot be unintentionally overwritten or
removed.

The new ShimRegistry class keeps track of the currently installed shims
and their corresponding packages. It does this by examining all the exe
files in the shim directory (note that old-style .bat and unixy shims
are not supported) and extracting the target file from the binary. If
this target path contains the lib folder, then the package name can be
obtained.

ShimRegistry is updated for each package, just before the Powershell
scripts are run, using `ShimGenerationService::take_snapshot`. When
ShimGenerationService installs the package, ShimRegistry provides its
existing shim files (ie. those that were not modified or removed since
the last update) so that they can be deleted prior to installing any
new ones.

To stop shims being added from Install-BinFile, a new environment
variable `chocolateyNoShims` is used when running the Powershell
scripts. If a package sets a shim this way, but then forgets to call
Uninstall-BinFile when uninstalling, the shim will be removed anyway if
its target is in the package folder.
johnstevenson added a commit to johnstevenson/choco that referenced this issue Feb 17, 2020
The --noshims and --noshimsglobal options allow the user to stop shims
being created for either the package, or the package and its
dependencies.

In addition to this new behaviour, the implementation handles the
creation and removal of shims more robustly, so that shims from other
packages (or the same package) cannot be unintentionally overwritten or
removed.

The new ShimRegistry class keeps track of the currently installed shims
and their corresponding packages. It does this by examining all the exe
files in the shim directory (so old-style .bat and unixy shims are not
supported) and extracting the target file from the binary. If this
target path contains the lib folder, then the package name can be
obtained.

ShimRegistry is updated for each package, just before the Powershell
scripts are run, using `ShimGenerationService::take_snapshot`. When
ShimGenerationService installs any shims for the package, ShimRegistry
provides its existing shim files (ie. those that were not modified or
removed since the last update) so that they can be deleted prior to
installing any new ones.

To stop shims being added from Install-BinFile, a new environment
variable `chocolateyNoShims` is used when running the Powershell
scripts. If a package sets a shim this way, but then forgets to call
Uninstall-BinFile when uninstalling, the shim will be removed anyway if
its target is in the package folder.
@ferventcoder
Copy link
Member

Assigned to @johnstevenson as he has provided a PR. Thanks for doing that!

@ferventcoder
Copy link
Member

While I agree that chocolatey/home#213 might be a better way of making this work; it's also been open since 2015 with no progress 🤔 .

@Badgerati We write capture things we want to do here. Dates are a non-issue. 😉

@ferventcoder
Copy link
Member

Hit enter on that last one too fast. We have things we are just getting complete that have been in my head since 2011. I also have hundreds of little things I've captured here, on sticky notes, on a notepad waking up in the middle of the night, so basically we write it all down and let priorities and community help us figure out what is important to implement and at what time. HTH provide more clarity for my comment.

@ferventcoder ferventcoder changed the title no shimming option on install/upgrade for massive packages install/upgrade: Add --no-shim option to allow skipping creation of shims from user side May 16, 2020
@pauby pauby modified the milestones: 0.10.16, 0.10.x May 11, 2021
@gep13 gep13 linked a pull request Oct 15, 2021 that will close this issue
@vexx32 vexx32 modified the milestones: 0.11.x, Future, Future_ Apr 1, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

8 participants