chocolatey / choco

Chocolatey - the package manager for Windows
https://chocolatey.org
Other
10.25k stars 899 forks source link

`choco pin remove -n packagename` removes pin for a different package #3196

Closed lebarsfa closed 1 year ago

lebarsfa commented 1 year ago

Checklist

What You Are Seeing?

I think this example is clear enough:

C:\Users\Administrator>choco pin remove -n mingw
Chocolatey v2.0.0
Trying to Remove a pin for mingw
Successfully removed a pin for gstreamer-mingw v1.20.2.

This looks inconsistent and in the end I cannot uninstall mingw since it is still pinned.

What is Expected?

Remove the pin of the correct package and have consistent output in the command.

How Did You Get This To Happen?

To reproduce on a clean Windows (see also output log below):

Set-ExecutionPolicy Bypass -Scope Process -Force; [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072; iex ((New-Object System.Net.WebClient).DownloadString('https://community.chocolatey.org/install.ps1'))
choco install -y mingw
choco pin add -n mingw
choco install -y gstreamer-mingw
choco pin add -n gstreamer-mingw
choco pin remove -n mingw
choco uninstall -y mingw

System Details

Installed Packages

PS C:\Users\1\Downloads> choco list
Chocolatey v2.0.0
chocolatey 2.0.0
gstreamer-mingw 1.22.1
mingw 12.2.0.3042023
3 packages installed.

Output Log

See also https://gist.github.com/lebarsfa/f3073eafbd7713d8c3222dd628ec512b/raw/3d28b4295999bf1bb6427e0af19029e6c313a40b/chocolatey.log

Windows PowerShell
Copyright (C) Microsoft Corporation. All rights reserved.
                                                                                                                Install the latest PowerShell for new features and improvements! https://aka.ms/PSWindows                                                                                                                                       
PS C:\Users\1> cd .\Downloads\                                                                                  
PS C:\Users\1\Downloads> Set-ExecutionPolicy Bypass -Scope Process -Force; [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072; iex ((New-Object System.Net.WebClient).DownloadString('https://community.chocolatey.org/install.ps1'))
Forcing web requests to allow TLS v1.2 (Required for requests to Chocolatey.org)
Getting latest version of the Chocolatey package for download.
Not using proxy.
Getting Chocolatey from https://community.chocolatey.org/api/v2/package/chocolatey/2.0.0.
Downloading https://community.chocolatey.org/api/v2/package/chocolatey/2.0.0 to C:\Users\1\AppData\Local\Temp\chocolatey\chocoInstall\chocolatey.zip
Not using proxy.
Extracting C:\Users\1\AppData\Local\Temp\chocolatey\chocoInstall\chocolatey.zip to C:\Users\1\AppData\Local\Temp\chocolatey\chocoInstall
Installing Chocolatey on the local machine
Creating ChocolateyInstall as an environment variable (targeting 'Machine')
  Setting ChocolateyInstall to 'C:\ProgramData\chocolatey'
WARNING: It's very likely you will need to close and reopen your shell
  before you can use choco.
Restricting write permissions to Administrators
We are setting up the Chocolatey package repository.
The packages themselves go to 'C:\ProgramData\chocolatey\lib'
  (i.e. C:\ProgramData\chocolatey\lib\yourPackageName).
A shim file for the command line goes to 'C:\ProgramData\chocolatey\bin'
  and points to an executable in 'C:\ProgramData\chocolatey\lib\yourPackageName'.

Creating Chocolatey folders if they do not already exist.

chocolatey.nupkg file not installed in lib.
 Attempting to locate it from bootstrapper.
PATH environment variable does not have C:\ProgramData\chocolatey\bin in it. Adding...
WARNING: Not setting tab completion: Profile file does not exist at
'C:\Users\1\Documents\WindowsPowerShell\Microsoft.PowerShell_profile.ps1'.
Chocolatey (choco.exe) is now ready.
You can call choco from anywhere, command line or powershell by typing choco.
Run choco /? for a list of functions.
You may need to shut down and restart powershell and/or consoles
 first prior to using choco.
Ensuring Chocolatey commands are on the path
Ensuring chocolatey.nupkg is in the lib folder
PS C:\Users\1\Downloads> choco install -y mingw
Chocolatey v2.0.0
Installing the following packages:
mingw
By installing, you accept licenses for the packages.
Progress: Downloading mingw 12.2.0.03042023... 100%

mingw v12.2.0.3042023 [Approved]
mingw package files install completed. Performing other installation steps.
Using system proxy server '192.168.1.16:8080'.
Downloading mingw 64 bit
  from 'https://github.com/niXman/mingw-builds-binaries/releases/download/12.2.0-rt_v10-rev2/x86_64-12.2.0-release-posix-seh-ucrt-rt_v10-rev2.7z'
Using system proxy server '192.168.1.16:8080'.
Progress: 100% - Completed download of C:\Users\1\AppData\Local\Temp\chocolatey\mingw\12.2.0.03042023\x86_64-12.2.0-release-posix-seh-ucrt-rt_v10-rev2.7z (68 MB).
Download of x86_64-12.2.0-release-posix-seh-ucrt-rt_v10-rev2.7z (68 MB) completed.
Hashes match.
Extracting C:\Users\1\AppData\Local\Temp\chocolatey\mingw\12.2.0.03042023\x86_64-12.2.0-release-posix-seh-ucrt-rt_v10-rev2.7z to C:\ProgramData\chocolatey\lib\mingw\tools\install...
C:\ProgramData\chocolatey\lib\mingw\tools\install
Testing path: C:\ProgramData\chocolatey\lib\mingw\tools\install\mingw32\bin
Testing path: C:\ProgramData\chocolatey\lib\mingw\tools\install\mingw64\bin
PATH environment variable does not have C:\ProgramData\chocolatey\lib\mingw\tools\install\mingw64\bin in it. Adding...
Environment Vars (like PATH) have changed. Close/reopen your shell to
 see the changes (or in powershell/cmd.exe just type `refreshenv`).
 ShimGen has successfully created a shim for addr2line.exe
 ShimGen has successfully created a shim for ar.exe
 ShimGen has successfully created a shim for as.exe
 ShimGen has successfully created a shim for c++.exe
 ShimGen has successfully created a shim for c++filt.exe
 ShimGen has successfully created a shim for cpp.exe
 ShimGen has successfully created a shim for dlltool.exe
 ShimGen has successfully created a shim for dllwrap.exe
 ShimGen has successfully created a shim for dwp.exe
 ShimGen has successfully created a shim for elfedit.exe
 ShimGen has successfully created a shim for g++.exe
 ShimGen has successfully created a shim for gcc-ar.exe
 ShimGen has successfully created a shim for gcc-nm.exe
 ShimGen has successfully created a shim for gcc-ranlib.exe
 ShimGen has successfully created a shim for gcc.exe
 ShimGen has successfully created a shim for gcov-dump.exe
 ShimGen has successfully created a shim for gcov-tool.exe
 ShimGen has successfully created a shim for gcov.exe
 ShimGen has successfully created a shim for gdb.exe
 ShimGen has successfully created a shim for gdborig.exe
 ShimGen has successfully created a shim for gdbserver.exe
 ShimGen has successfully created a shim for gendef.exe
 ShimGen has successfully created a shim for genidl.exe
 ShimGen has successfully created a shim for genpeimg.exe
 ShimGen has successfully created a shim for gfortran.exe
 ShimGen has successfully created a shim for gprof.exe
 ShimGen has successfully created a shim for ld.bfd.exe
 ShimGen has successfully created a shim for ld.exe
 ShimGen has successfully created a shim for ld.gold.exe
 ShimGen has successfully created a shim for lto-dump.exe
 ShimGen has successfully created a shim for mingw32-make.exe
 ShimGen has successfully created a shim for nm.exe
 ShimGen has successfully created a shim for objcopy.exe
 ShimGen has successfully created a shim for objdump.exe
 ShimGen has successfully created a shim for ranlib.exe
 ShimGen has successfully created a shim for readelf.exe
 ShimGen has successfully created a shim for size.exe
 ShimGen has successfully created a shim for strings.exe
 ShimGen has successfully created a shim for strip.exe
 ShimGen has successfully created a shim for widl.exe
 ShimGen has successfully created a shim for windmc.exe
 ShimGen has successfully created a shim for windres.exe
 ShimGen has successfully created a shim for x86_64-w64-mingw32-c++.exe
 ShimGen has successfully created a shim for x86_64-w64-mingw32-g++.exe
 ShimGen has successfully created a shim for x86_64-w64-mingw32-gcc-12.2.0.exe
 ShimGen has successfully created a shim for x86_64-w64-mingw32-gcc-ar.exe
 ShimGen has successfully created a shim for x86_64-w64-mingw32-gcc-nm.exe
 ShimGen has successfully created a shim for x86_64-w64-mingw32-gcc-ranlib.exe
 ShimGen has successfully created a shim for x86_64-w64-mingw32-gcc.exe
 ShimGen has successfully created a shim for x86_64-w64-mingw32-gfortran.exe
 ShimGen has successfully created a shim for cc1.exe
 ShimGen has successfully created a shim for cc1plus.exe
 ShimGen has successfully created a shim for collect2.exe
 ShimGen has successfully created a shim for f951.exe
 ShimGen has successfully created a shim for g++-mapper-server.exe
 ShimGen has successfully created a shim for lto-wrapper.exe
 ShimGen has successfully created a shim for lto1.exe
 ShimGen has successfully created a shim for fixincl.exe
 ShimGen has successfully created a shim for gdbmtool.exe
 ShimGen has successfully created a shim for gdbm_dump.exe
 ShimGen has successfully created a shim for gdbm_load.exe
 ShimGen has successfully created a shim for python3.9.exe
 ShimGen has successfully created a shim for python3.exe
 ShimGen has successfully created a shim for python3w.exe
 ShimGen has successfully created a shim for x86_64-w64-mingw32-captoinfo.exe
 ShimGen has successfully created a shim for x86_64-w64-mingw32-clear.exe
 ShimGen has successfully created a shim for x86_64-w64-mingw32-infocmp.exe
 ShimGen has successfully created a shim for x86_64-w64-mingw32-infotocap.exe
 ShimGen has successfully created a shim for x86_64-w64-mingw32-reset.exe
 ShimGen has successfully created a shim for x86_64-w64-mingw32-tabs.exe
 ShimGen has successfully created a shim for x86_64-w64-mingw32-tic.exe
 ShimGen has successfully created a shim for x86_64-w64-mingw32-toe.exe
 ShimGen has successfully created a shim for x86_64-w64-mingw32-tput.exe
 ShimGen has successfully created a shim for x86_64-w64-mingw32-tset.exe
 ShimGen has successfully created a shim for python.exe
 ShimGen has successfully created a shim for pythonw.exe
 ShimGen has successfully created a shim for ar.exe
 ShimGen has successfully created a shim for as.exe
 ShimGen has successfully created a shim for dlltool.exe
 ShimGen has successfully created a shim for ld.bfd.exe
 ShimGen has successfully created a shim for ld.exe
 ShimGen has successfully created a shim for ld.gold.exe
 ShimGen has successfully created a shim for nm.exe
 ShimGen has successfully created a shim for objcopy.exe
 ShimGen has successfully created a shim for objdump.exe
 ShimGen has successfully created a shim for ranlib.exe
 ShimGen has successfully created a shim for readelf.exe
 ShimGen has successfully created a shim for strip.exe
 The install of mingw was successful.
  Software installed to 'C:\ProgramData\chocolatey\lib\mingw\tools\install'

Chocolatey installed 1/1 packages.
 See the log for details (C:\ProgramData\chocolatey\logs\chocolatey.log).
PS C:\Users\1\Downloads> choco pin add -n mingw
Chocolatey v2.0.0
Trying to add a pin for mingw
Successfully added a pin for mingw v12.2.0.3042023.
PS C:\Users\1\Downloads> choco install -y gstreamer-mingw
Chocolatey v2.0.0
Installing the following packages:
gstreamer-mingw
By installing, you accept licenses for the packages.
Progress: Downloading gstreamer-mingw 1.22.1... 100%

gstreamer-mingw v1.22.1 [Approved]
gstreamer-mingw package files install completed. Performing other installation steps.
Using system proxy server '192.168.1.16:8080'.
Downloading gstreamer-mingw 64 bit
  from 'https://gstreamer.freedesktop.org/data/pkg/windows/1.22.1/mingw/gstreamer-1.0-mingw-x86_64-1.22.1.msi'
Using system proxy server '192.168.1.16:8080'.
Progress: 100% - Completed download of C:\Users\1\AppData\Local\Temp\chocolatey\gstreamer-mingw\1.22.1\gstreamer-1.0-mingw-x86_64-1.22.1.msi (228.27 MB).
Download of gstreamer-1.0-mingw-x86_64-1.22.1.msi (228.27 MB) completed.
Hashes match.
Installing gstreamer-mingw...
gstreamer-mingw has been installed.

GStreamer installed to C:\gstreamer\1.0\mingw_x86_64\

Checking for PATH entry...
PATH environment variable does not have %GSTREAMER_1_0_ROOT_MINGW_X86_64%\bin in it. Adding...
Confirmed gst-launch-1.0.exe on PATH at C:\gstreamer\1.0\mingw_x86_64\\bin\gst-launch-1.0.exe

  gstreamer-mingw may be able to be automatically uninstalled.
Environment Vars (like PATH) have changed. Close/reopen your shell to
 see the changes (or in powershell/cmd.exe just type `refreshenv`).
 The install of gstreamer-mingw was successful.
  Software installed to 'C:\Program Files (x86)\Microsoft\Edge\Application'

Chocolatey installed 1/1 packages.
 See the log for details (C:\ProgramData\chocolatey\logs\chocolatey.log).
PS C:\Users\1\Downloads> choco pin add -n gstreamer-mingw
Chocolatey v2.0.0
Trying to add a pin for gstreamer-mingw
Successfully added a pin for gstreamer-mingw v1.22.1.
PS C:\Users\1\Downloads> choco pin remove -n mingw
Chocolatey v2.0.0
Trying to Remove a pin for mingw
Successfully removed a pin for gstreamer-mingw v1.22.1.
PS C:\Users\1\Downloads> choco uninstall -y mingw
Chocolatey v2.0.0
Uninstalling the following packages:
mingw
mingw is pinned. Skipping pinned package.

Chocolatey uninstalled 0/1 packages.
 See the log for details (C:\ProgramData\chocolatey\logs\chocolatey.log).

Warnings:
 - mingw - mingw is pinned. Skipping pinned package.
PS C:\Users\1\Downloads>

Additional Context

No response

pauby commented 1 year ago

Can you go back to the above comment and add both a list of installed packages and the log files that cover the issue? If they are long, please add them as a gist and link to them from the above. Please don't add them in a new comment, but edit the above one and add them.

Please also add the OS version being used.

Those are required for us to look at this further.

lebarsfa commented 1 year ago

OK, I added more details to be able to reproduce the problem.

AdmiringWorm commented 1 year ago

@lebarsfa it looks like you have included the output from the console, this is not what we are after. But rather, the contents of the log file will be located here: %ChocolateyInstall%\logs\chocolatey.log (there may be numbered files as well).

Please upload the contents of this file to https://gist.github.com and link to the uploaded content in your initial post.

lebarsfa commented 1 year ago

Sorry, I added it to the top of the Output Log section.

pauby commented 1 year ago

I confirm I was able to reproduce this issue.

image

gep13 commented 1 year ago

A new version of Chocolatey CLI (v2.1.0-alpha-20230608) has been released which aims to address this issue. You can find the release notes here:

https://docs.chocolatey.org/en-us/choco/release-notes#alpha-20230608-june-8-2023

And the package here:

https://community.chocolatey.org/packages/chocolatey/2.1.0-alpha-20230608

You should be able to upgrade to this package version using:

choco upgrade chocolatey --pre

If you could take this for a spin, and verify that the issue is now resolved, that would be very helpful.

lebarsfa commented 1 year ago

Thank you, I confirm the problem seems to be solved.

Gitoo22 commented 1 year ago

I had the seemingly same issue : Choco was mixing neovim with vim, that is, Choco would remove pin for vim, but then still consider it to be pinned. I upgraded Choco with choco upgrade chocolatey --pre . All is fixed now, many thanks. You should push the preview to production version.

gep13 commented 1 year ago

@Gitoo22 said... You should push the preview to production version.

Yes, that is the plan. There is still a couple of open issues in the 2.1.0 milestone that we need to complete before we push a new stable version of Chocolatey CLI.

choco-bot commented 1 year ago

:tada: This issue has been resolved in version 2.1.0 :tada:

The release is available on:

Your GitReleaseManager bot :package::rocket: