Open jasagredo opened 2 weeks ago
This is not proof that there's something wrong with the shim.
Can you run C:\ghcup\ghc\9.6.6-patched\bin\ghc.exe
without elevated privileges?
Yes I can:
~
➜ /c/ghcup/ghc/9.6.6-patched/bin/ghc.exe
ghc-9.6.6.exe: no input files
Usage: For basic information, try the `--help' option.
Is antivirus off?
Yes, it is off.
I could not reproduce the issue, I tried with zsh too.
I installed the official https://downloads.haskell.org/~ghc/9.6.6/ghc-9.6.6-x86_64-unknown-mingw32.tar.xz with the name "ghc-9.6.6-patched" for testing
Surprisingly that works for me too.
➜ ghcup install ghc -u https://downloads.haskell.org/\~ghc/9.6.6/ghc-9.6.6-x86_64-unknown-mingw32.tar.xz 9.6.6-upstream
[ Info ] downloading: https://raw.githubusercontent.com/haskell/ghcup-metadata/master/ghcup-0.0.8.yaml as file C:\ghcup\cache\ghcup-0.0.8.yaml
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
0 0 0 0 0 0 0 0 --:--:-- 0:00:01 --:--:-- 0
[ Warn ] New ghc version available. If you want to install this latest version, run 'ghcup install ghc 9.10.1'
[ Info ] verifying digest of: gs.exe
[ Info ] downloading: https://downloads.haskell.org/~ghc/9.6.6/ghc-9.6.6-x86_64-unknown-mingw32.tar.xz as file C:\ghcup\tmp\ghcup-e2889c71bc9d3c01\ghc-9.6.6-x86_64-unknown-mingw32.tar.xz
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 309M 100 309M 0 0 35.7M 0 0:00:08 0:00:08 --:--:-- 38.9M
[ Info ] Unpacking: ghc-9.6.6-x86_64-unknown-mingw32.tar.xz to C:\ghcup\tmp\ghcup-ed464af51a8403e2
[ Info ] Installing GHC (this may take a while)
[ Info ] Merging file tree from "C:\ghcup\tmp\ghcup-ed464af51a8403e2\ghc-9.6.6-x86_64-unknown-mingw32" to "C:\ghcup\ghc\9.6.6-upstream"
[ Info ] GHC installation successful
~ took 8m29s
➜ /c/ghcup/bin/ghc-9.6.6-upstream.exe
ghc-9.6.6.exe: no input files
Usage: For basic information, try the `--help' option.
Now I'm quite puzzled on what is going on with the 9.6.6-patched shim. I don't really understand what is going on here, check this:
➜ /c/ghcup/bin/ghc-9.6.6-upstream.exe
ghc-9.6.6.exe: no input files
Usage: For basic information, try the `--help' option.
~
❯ mv /c/ghcup/bin/ghc-9.6.6-patched.exe /c/ghcup/bin/ghc-9.6.6-back.exe
~
➜ cp /c/ghcup/bin/ghc-9.6.6-upstream.exe /c/ghcup/bin/ghc-9.6.6-patched.exe
~
➜ /c/ghcup/bin/ghc-9.6.6-patched.exe
zsh: permission denied: /c/ghcup/bin/ghc-9.6.6-patched.exe
Ok this is something I would not expect. If I get into PowerShell, I can try to execute both ghc-9.6.6-patched.exe
and ghc-9.6.6-upstream.exe
which are the same file as per the above sequence of commands. And I get this:
C:\ghcup\bin
➜ .\ghc-9.6.6-upstream.exe
ghc-9.6.6.exe: no input files
Usage: For basic information, try the `--help' option.
C:\ghcup\bin
➜ .\ghc-9.6.6-patched.exe
And the second one prompts a UAC dialog: Which even if I click Yes, still has no output:
C:\ghcup\bin
➜ .\ghc-9.6.6-patched.exe
C:\ghcup\bin
➜
Ok I think I have an answer and it is not what I was expecting: https://stackoverflow.com/questions/20096706/how-does-windows-decide-whether-to-display-the-uac-prompt
Before a 32 bit process is created, the following attributes are checked to determine whether it is an installer:
- Filename includes keywords like "install," "setup," "update," etc.
And my ghc has patched
on its name. If I change it to ptched
:
C:\ghcup\bin took 22s
➜ mv .\ghc-9.6.6-patched.exe .\ghc-9.6.6-ptched.exe
C:\ghcup\bin
❯ mv .\ghc-9.6.6-patched.shim .\ghc-9.6.6-ptched.shim
C:\ghcup\bin
➜ .\ghc-9.6.6-ptched.exe
ghc-9.6.6.exe: no input files
Usage: For basic information, try the `--help' option.
I guess this can close the issue as mystery solved. The issue is with the name of the file making it being considered an installer.
If we have a more or less comprehensive list of these suffixes/filenames, I think it does make sense on windows to emit a post-install warning (or even pre-install with a 10s sleep timer) about this issue.
This only mentions "install", "setup" and "update", now we know also about "patch".
I have a GHC 9.6.6 with some patches on top that I use daily, named
9.6.6-patched
in GHCup.This GHC was installed via
hadrian binary-dist
, thenghcup install ghc -u file:///<path-to-bindist> 9.6.6-patched
.I can run it from the
ghc.exe
shim:The shim file for this one and
ghc-9.6.6-patched.exe
are the same, and the executables are the same (viadiff
):However, running the
ghc-9.6.6-patched.exe
executable results in a permission error unless we are in an elevated shell:I found this out via the following error when compiling HLS for this GHC:
Note this succeeds in an elevated shell: