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

fromAbsoluteFilePath: not an absolute path when running cabal update on Windows in Github Actions with built-in ghcup #7939

Open
newhoggy opened this issue Jan 29, 2022 · 7 comments
Labels
attention: pr-welcome platform: windows re: error-message Concerning error messages delivered to the user

Comments

@newhoggy
Copy link

newhoggy commented Jan 29, 2022

Describe the bug
I'm getting the following error when running cabal update in very specific circumstances.

fromAbsoluteFilePath: not an absolute path
CallStack (from HasCallStack):
  error, called at src\\Hackage\\Security\\Util\\Path.hs:297:31 in hackage-secur_-0.6.0.1-aa3b50000d0dcf2987b9cef364fe5c110fa92705:Hackage.Security.Util.Path

To Reproduce
Steps to reproduce the behavior:

For this repository: https://github.com/input-output-hk/cardano-node

Checkout always-use-ghcup. Create a new PR with the latest commit. (You may need to amend the commit to force a build).

I've not seen the error outside of this environment.

Expected behavior
The cabal update command should work.

System information

  • Operating system: Windows on Github Actions
  • cabal-3.6.2.0, ghc-8.10.7 versions

Additional context
Related PRs and tickets:

@hasufell
Copy link
Member

Seems HasCallStack is in fact a rather useless concept if it only prints the end of the callstack.

@hasufell
Copy link
Member

hasufell commented Jan 29, 2022

I tracked down the error by using a patched binary: https://github.com/hasufell/cardano-node/runs/4991673164?check_suite_focus=true

Selected mirror http://objects-us-east-1.dream.io/hackage-mirror/
Downloading root
"C:\Windows\SYSTEM32\curl.exe" "http://objects-us-east-1.dream.io/hackage-mirror/root.json" "--output" "C:\Users\RUNNER~1\AppData\Local\Temp\tra6AE3" "--location" "--write-out" "%{http_code}" "--user-agent" "cabal-install/3.7 (windows; x86_64)" "--silent" "--show-error" "--dump-header" "C:\Users\RUNNER~1\AppData\Local\Temp\cur6AF4.txt"
fromAbsoluteFilePath: not an absolute path: C:Users\runneradmin\.cabal\packages\hackage.haskell.org\roo6AD3.json
CallStack (from HasCallStack):
  error, called at src\\Hackage\\Security\\Util\\Path.hs:297:31 in hackage-security-0.6.2.0-inplace:Hackage.Security.Util.Path
Error: Process completed with exit code 1.

So it fails because of C:Users\runneradmin\.cabal\packages\hackage.haskell.org\roo6AD3.json. First of all, this is a valid (relative) windows path. On windows C:foo means "file foo relative to the current directory on the drive C". I don't think that's what was meant here though, so somewhere along the callstack, something messed up the windows path.

@hasufell
Copy link
Member

hasufell commented Jan 29, 2022

I was able to reproduce the error by adding this to the global cabal.config:

remote-repo-cache: C:/cabal/packages

Instead of C:\cabal\packages (which btw. should be semantically equivalent).

So I'm assuming that this line is causing issues: https://github.com/input-output-hk/cardano-node/pull/3551/files#diff-c09cc8dc973415b1221308559b96942a1c4b872e690bf360fc22d9b42822d519R32

echo "CABAL_DIR=$HOME/.cabal" >> $GITHUB_ENV

I printed the value and it shows /c/Users/runneradmin/.cabal, which is not a native absolute windows path ...it's a cygwin thing. Look here:

Prelude System.FilePath.Windows> isRelative "/c/Users/runneradmin/.cabal"
True

Under windows /c/foo is the relative path c\foo on the current drive.

How all this ends up as C:Users\runneradmin\.cabal is still not entirely clear to me.


So, what should cabal do here? Interpret cygwin style paths? How does it know what is meant?

But for sure the error needs to be improved.

@jneira
Copy link
Member

jneira commented Feb 16, 2022

@newhoggy what do you think about the comments above? maybe fixing the path in the gha config and a better error would be enough?

@jneira jneira added platform: windows re: error-message Concerning error messages delivered to the user labels Feb 16, 2022
@Mikolaj
Copy link
Member

Mikolaj commented Oct 19, 2022

@newhoggy: any news? and comments?

@newhoggy
Copy link
Author

Definitely a better error message will help.

@Mikolaj
Copy link
Member

Mikolaj commented Nov 10, 2022

Right, let's improve the error message; volunteers welcome!

Independently, let's try to code-dive and understand how the path arises and what cabal could do better here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
attention: pr-welcome platform: windows re: error-message Concerning error messages delivered to the user
Projects
None yet
Development

No branches or pull requests

4 participants