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

ghcup run is broken on Windows #1106

Closed
jasagredo opened this issue Jul 18, 2024 · 10 comments
Closed

ghcup run is broken on Windows #1106

jasagredo opened this issue Jul 18, 2024 · 10 comments

Comments

@jasagredo
Copy link

➜ ghcup whereis ghc 8.10.7
C:\ghcup\ghc\8.10.7\bin\ghc.exe%

➜ ghcup run --ghc 8.10.7 -- ghc --version
[ Warn  ] Removing leftover files in C:\ghcup\trash
[ Info  ] verifying digest of: gs.exe
The Glorious Glasgow Haskell Compilation System, version 9.8.2

The system is Windows 11, MSYS2, MINGW64_NT-10.0-22631, in CLANG64 environment, GHCup version 0.1.30.0

@hasufell
Copy link
Member

Yeah, I think we did change something in the PATH handling recently on windows.

@hasufell
Copy link
Member

I can confirm. CCing @fendor since this may likely break VSCode haskell extension for windows users.

@hasufell
Copy link
Member

Notice that this works:

 ghcup run -m --ghc 8.10.7 -- sh -c 'ghc --version'

@hasufell
Copy link
Member

hasufell commented Jul 18, 2024

Also confirmed that this is a regression: 0.1.22.0 works.

@fendor
Copy link
Contributor

fendor commented Jul 18, 2024

Thanks for the ping!

Do you think we should add the provided fix to vscode-haskell or will there be a point release soonish?

@hasufell
Copy link
Member

From what I see we don't use ghcup run that way. We add the temporary bin/ path manually to PATH. So VSCode might not be affected after all:

https://github.com/haskell/vscode-haskell/blob/e582b7655a5201c647ca4bc485d60c46f6b2f9ba/src/hlsBinaries.ts#L391-L419

@hasufell
Copy link
Member

Also found the historical bug: https://gitlab.haskell.org/haskell/ghcup-hs/-/issues/375

lolz

@hasufell
Copy link
Member

Also confirmed that this is a regression: 0.1.22.0 works.

Apparently this was wrong and the comment from the historical issue still applies: https://gitlab.haskell.org/haskell/ghcup-hs/-/issues/375#note_435793

I am not sure why I never fixed it.

@hasufell
Copy link
Member

Regarding the cmd.exe hack, this gives me headache: https://github.com/haskell/process/blob/ead14c27c9bece12bf74ab8e48d29c982c6f99bb/System/Process/Windows.hsc#L424-L430

Copy pasted (see the comment):

commandToProcess
  :: CmdSpec
  -> IO (FilePath, String)
commandToProcess (ShellCommand string) = do
  cmd <- findCommandInterpreter
  return (cmd, translateInternal cmd ++ " /c " ++ string)
        -- We don't want to put the cmd into a single
        -- argument, because cmd.exe will not try to split it up.  Instead,
        -- we just tack the command on the end of the cmd.exe command line,
        -- which partly works.  There seem to be some quoting issues, but
        -- I don't have the energy to find+fix them right now (ToDo). --SDM
        -- (later) Now I don't know what the above comment means.  sigh.
commandToProcess (RawCommand cmd args)
  | map toLower (takeExtension cmd) `elem` [".bat", ".cmd"]
  = return (cmd, translateInternal cmd ++ concatMap ((' ':) . translateCmdExeArg) args)
  | otherwise
  = return (cmd, translateInternal cmd ++ concatMap ((' ':) . translateInternal) args)

hasufell added a commit that referenced this issue Jul 18, 2024
hasufell added a commit that referenced this issue Jul 18, 2024
@hasufell hasufell added this to the 0.1.31.0 milestone Jul 20, 2024
@hasufell
Copy link
Member

merged: #1108

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants