chocolatey / chocolatey-licensed-issues

Issues for Licensed Editions of Chocolatey
19 stars 13 forks source link

PowerShell - Get-ChocolateyUnZip works in FOSS but not Licensed for languagetool package #342

Closed sync-by-unito[bot] closed 1 year ago

sync-by-unito[bot] commented 1 year ago

Description

The installation or upgrade of the languagetool package works fine with FOSS of Chocolatey CLI, but throws an error using a Business license. The issue seems to be around Install-ChocolateyZipPackage which finds files to extract (and extracts them) with the FOSS version.

92 [INFO ] - Extracting C:\Users\Paul\AppData\Local\Temp\chocolatey\languagetool\6.0\LanguageTool-6.0.zip to C:\tools...
2023-01-16 15:46:08,293 11592 [DEBUG] - 7zip found at 'C:\ProgramData\chocolatey\tools\7z.exe'
2023-01-16 15:46:08,299 11592 [DEBUG] - Executing command ['C:\ProgramData\chocolatey\tools\7z.exe' x -aoa -bd -bb1 -o"C:\tools" -y "C:\Users\Paul\AppData\Local\Temp\chocolatey\languagetool\6.0\LanguageTool-6.0.zip" "languagetool-6.0"]
2023-01-16 15:46:14,456 11592 [INFO ] - VERBOSE: Scanning the drive for archives:
2023-01-16 15:46:14,458 11592 [INFO ] - VERBOSE: 
2023-01-16 15:46:14,460 11592 [INFO ] - VERBOSE: 
2023-01-16 15:46:14,461 11592 [INFO ] - VERBOSE: Extracting archive: C:\Users\Paul\AppData\Local\Temp\chocolatey\languagetool\6.0\LanguageTool-6.0.zip
2023-01-16 15:46:14,462 11592 [INFO ] - VERBOSE: 7-Zip 21.07 (x86) : Copyright (c) 1999-2021 Igor Pavlov : 2021-12-26
2023-01-16 15:46:14,463 11592 [INFO ] - VERBOSE: 
2023-01-16 15:46:14,465 11592 [INFO ] - VERBOSE: 1 file, 230713837 bytes (221 MiB)
2023-01-16 15:46:14,466 11592 [INFO ] - VERBOSE: --
2023-01-16 15:46:14,467 11592 [INFO ] - VERBOSE: Path = C:\Users\Paul\AppData\Local\Temp\chocolatey\languagetool\6.0\LanguageTool-6.0.zip
2023-01-16 15:46:14,469 11592 [INFO ] - VERBOSE: Type = zip
2023-01-16 15:46:14,470 11592 [INFO ] - VERBOSE: Physical Size = 230713837

But does not find any files with the Licensed version:

00 [DEBUG] - Running licensed 'Get-ChocolateyUnzip' with FileFullPath:'C:\Users\Paul\AppData\Local\Temp\chocolatey\languagetool\6.0\LanguageTool-6.0.zip', Destination:'C:\tools', SpecificFolder:'languagetool-6.0', PackageName:'languagetool', FileFullPath64:'', DisableLogging: 'False'.
2023-01-16 15:47:57,077 11200 [DEBUG] - 7zip found at 'C:\ProgramData\chocolatey\tools\7z.exe'
2023-01-16 15:47:57,078 11200 [INFO ] - Extracting LanguageTool-6.0.zip to C:\tools...
2023-01-16 15:47:57,082 11200 [DEBUG] - Executing command ['C:\ProgramData\chocolatey\tools\7z.exe' x -aoa -bd -bb1 -o"C:\tools" -y "C:\Users\Paul\AppData\Local\Temp\chocolatey\languagetool\6.0\LanguageTool-6.0.zip" `"languagetool-6.0`"]
2023-01-16 15:47:57,083 11200 [DEBUG] - Calling command ['"C:\ProgramData\chocolatey\tools\7z.exe" x -aoa -bd -bb1 -o"C:\tools" -y "C:\Users\Paul\AppData\Local\Temp\chocolatey\languagetool\6.0\LanguageTool-6.0.zip" `"languagetool-6.0`"']
2023-01-16 15:47:57,360 11200 [DEBUG] - 7-Zip 21.07 (x86) : Copyright (c) 1999-2021 Igor Pavlov : 2021-12-26
2023-01-16 15:47:57,361 11200 [DEBUG] - Scanning the drive for archives:
2023-01-16 15:47:57,362 11200 [DEBUG] - 1 file, 230713837 bytes (221 MiB)
2023-01-16 15:47:57,363 11200 [DEBUG] - Extracting archive: C:\Users\Paul\AppData\Local\Temp\chocolatey\languagetool\6.0\LanguageTool-6.0.zip
2023-01-16 15:47:57,365 11200 [DEBUG] - --
2023-01-16 15:47:57,366 11200 [DEBUG] - Path = C:\Users\Paul\AppData\Local\Temp\chocolatey\languagetool\6.0\LanguageTool-6.0.zip
2023-01-16 15:47:57,367 11200 [DEBUG] - Type = zip
2023-01-16 15:47:57,368 11200 [DEBUG] - Physical Size = 230713837
2023-01-16 15:47:57,369 11200 [DEBUG] - No files to process
2023-01-16 15:47:57,370 11200 [DEBUG] - Everything is Ok
2023-01-16 15:47:57,371 11200 [DEBUG] - Files: 0
2023-01-16 15:47:57,372 11200 [DEBUG] - Size:       0
2023-01-16 15:47:57,374 11200 [DEBUG] - Compressed: 230713837There is a very subtle difference in the 7Zip command that is running (and this may NOT be the issue):

FOSS:

Executing command ['C:\ProgramData\chocolatey\tools\7z.exe' x -aoa -bd -bb1 -o"C:\tools" -y "C:\Users\Paul\AppData\Local\Temp\chocolatey\languagetool\6.0\LanguageTool-6.0.zip" "languagetool-6.0"]

Licensed:

Executing command ['C:\ProgramData\chocolatey\tools\7z.exe' x -aoa -bd -bb1 -o"C:\tools" -y "C:\Users\Paul\AppData\Local\Temp\chocolatey\languagetool\6.0\LanguageTool-6.0.zip" `"languagetool-6.0`"]Note the backticks in the folder name to extract in the Licensed version:

`"languagetool-6.0`"But not the FOSS version:
"languagetool-6.0".

I ran both of those command directly on the command line and they both worked as expected. However, I don't know the context these cmdlets run in so that backtick difference may matter to them and not to running it directly. As I said, this may not be the issue, I just wanted to highlight the difference I noticed.

Steps To Reproduce

  1. With a business Licensed version of Chocolatey CLI, run choco install languagetool and see it fail.
  2. With a FOSS version of Chocolatey CLI, run choco install languagetool and see the package installed.

Output Log

oss-install-languagetool.loglicensed-install-languagetool.log

Workarounds

None that I am aware of.

Proposed Solution

Change the 7Zip command that runs as part of the Licensed Get-ChocolateyUnzip PowerShell helper to not have backticks when specifying a specificFolder.

Related Issues and Tickets

None.

Done Checklist

┆Issue is synchronized with this Gitlab issue by Unito ┆Milestone: 6.0.0