Closed EDM115 closed 2 months ago
I don't control the winget package for cloc but the config at https://github.com/microsoft/winget-pkgs/blob/master/manifests/a/AlDanial/Cloc/2.00/AlDanial.Cloc.installer.yaml looks fine.
If you manually download the 2.00 exe from https://github.com/AlDanial/cloc/releases/download/v2.00/cloc-2.00.exe does that work properly for you?
(The 2.02 release is also out; can get it from https://github.com/AlDanial/cloc/releases )
well. downloading and running from the file works :
the issue seems really to be from winget. here's what happens when I try to run it :
the folder %LOCALAPPDATA%\Microsoft\WinGet\Links\
only contains a symlink to the install folder. I tried replacing the exe on this directory with the one downloaded from the releases tab but the same issue occurs.
interestingly, double clicking on the symlink gives a message for 1/60th of a second :
Update : the issue comes from the symlink :
recreating a symlink with New-Item -ItemType SymbolicLink -Path "%LOCALAPPDATA%\Microsoft\WinGet\Links\cloc.exe" -Target "C:\Users\EDM115\AppData\Local\Microsoft\WinGet\Packages\AlDanial.Cloc_Microsoft.Winget.Source_8wekyb3d8bbwe\cloc.exe"
gives reproducibly the same outcome
also :
so ultimately I think that cloc can never be ran through a symlink
Thanks for investigating the issue. However I'm wondering if the problem is associated with your environment rather than with cloc or its winget package? I did the installation myself, and cloc ran fine:
PS C:\Users\al> winget install AlDanial.Cloc
then opened a new PowerShell terminal and got the version number cleanly:
PS C:\Users\al> cloc --version 2.00
Code counts work properly too. Do you have access to other Windows machines on which to try this?
I've just tried use cloc for the first time and opted to winget install AlDanial.Cloc
and am facing this same error.
Next thought: a Windows version issue? I'm running Windows 11 Home version 23H2. @danijam , @EDM115 : what versions do you use?
23H2 too as stated in the original message
I don't have other machines but asked several friends to test this, awaiting their results now
Reproduced. Really weird with this error 😕
v2.00
There's something happened. Outputs from 2 methods are different.
17:39:57 C:\Repository 8ms pwsh> cloc
Usage: C:\Program Files\WinGet\Links\cloc.exe [ -Alib.par ] [ -Idir ] [ -Mmodule ] [ src.par ] [ program.pl ]
C:\Program Files\WinGet\Links\cloc.exe [ -B|-b ] [-Ooutfile] src.par
17:41:37 C:\Repository 57ms 0x00FF pwsh> C:\Applications\AlDanial\Cloc\cloc.exe
cloc -- Count Lines of Code
Usage:
cloc.exe [options] <file(s)/dir(s)/git hash(es)>
Count physical lines of source code and comments in the given files
(may be archives such as compressed tarballs or zip files) and/or
recursively below the given directories or git commit hashes.
Example: cloc src/ include/ main.c
cloc.exe [options] --diff <set1> <set2>
Compute differences of physical lines of source code and comments
between any pairwise combination of directory names, archive
files or git commit hashes.
Example: cloc --diff Python-3.5.tar.xz python-3.6/
cloc.exe --help shows full documentation on the options.
https://github.com/AlDanial/cloc has numerous examples and more information.
17:45:27 C:\Repository 2ms pwsh> ls 'C:\Program Files\WinGet\Links\cloc.exe'
Directory: C:\Program Files\WinGet\Links
Mode LastWriteTime Length Name
---- ------------- ------ ----
la--- 2024/8/24 17:35 0 cloc.exe -> C:\Applications\AlDanial\Cloc\cloc.exe
just booted up a fresh VM, and the issue occurs in the exact same way
@EDM115 : I should have read your initial post more closely, re the OS version, thanks for the reminder.
@Dragon1573 : is there a way to write the winget manifest for cloc without using a symlink?
Is there a way to write the winget manifest for cloc without using a symlink?
This is the designed feature of winget.exe
. All portable executable uses symlink for launching in the console.
Maybe it's caused by pp
command? Can perl2exe
solve this?
Or create an install wizard (by InnoSetup, NullSoft, Burn, WiX, ...) for cloc
? winget.exe
will just launch the wizard with "silent install" switches. The wizard itself will handle everything, including creating shortcuts, writing Windows Registry, uninstall previous versions.
@AlDanial @Dragon1573 @danijam I think I fixed it, will open a PR
This should be 100% resolved now; the latest winget package points to the 2.02 executable which includes @EDM115 's PR #850.
I can still reproduce. How can I check that I'm not somehow still pulling an outdated winget package?
@danijam I guess there was maybe an issue when rebuilding https://github.com/AlDanial/cloc/releases/download/v2.02/cloc-2.02-winget.exe
I provided a working executable here : https://github.com/AlDanial/cloc/pull/850#issuecomment-2308899464, and feel free to build it yourself if you don't trust random files on the internet :)
I'm baffled since PR #850 is in the source I used to build cloc-2.02-winget.exe
. Since I never had a problem with symlinks in the first place I have no way of checking that cloc-2.02-winget.exe
behaves differently from the original cloc-2.02.exe
. For the same reason, @EDM115, I gain nothing from testing your executable.
hmmm…
A possible reason why you never encountered the problem may be because cloc is installed through another way and this installation path is higher in the PATH variables so it takes priority over the WinGet one… tho at this point it's pure speculation. Maybe we're just unlucky with WinGet after all :(
Good thinking, I hadn't tested that til now. I used the output of where cloc
to get the full path to the winget-installed cloc.exe
, entered that full command, and got the same successful result.
Describe the bug When I tried to install cloc through winget, every command I run (even cloc --version) fails with the message :
Can't locate PAR.pm in @INC (you may need to install the PAR module) (@INC contains:) at -e line 592.
. Note that Strawberry Perl is installedcloc; OS; OS version
%LOCALAPPDATA%\Microsoft\WinGet\Packages\AlDanial.Cloc_Microsoft.Winget.Source_8wekyb3d8bbwe
with 2.02 from the releases tab but nothing changedTo Reproduce Install through winget. Note that the npm package works just fine.
Expected result cloc should work out of the box without any extra step
Additional context I tried to install manually PAR and PAR::Packer for Perl, without any success. Restarting didn't changed a thing either