-
Notifications
You must be signed in to change notification settings - Fork 841
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
InvalidAbsDir "./stack-setupXXXXX" from Path.IO.listDirectory #1017
Comments
configLocalPrograms seems to be well canonicalized, here, so it must not be the input to It's very surprising that there'd be a bug in Lets test out chris's thought - does this fix it? diff --git a/src/Path/IO.hs b/src/Path/IO.hs
index ca1bed9..79e6d39 100644
--- a/src/Path/IO.hs
+++ b/src/Path/IO.hs
@@ -170,8 +170,9 @@ listDirectory dir =
do entriesFP <- liftIO (D.getDirectoryContents dirFP)
maybeEntries <-
forM (map (dirFP ++) entriesFP)
- (\entryFP ->
- do isDir <- liftIO (D.doesDirectoryExist entryFP)
+ (\entryFP' ->
+ do entryFP <- liftIO (D.canonicalizePath entryFP')
+ isDir <- liftIO (D.doesDirectoryExist entryFP)
if isDir
then case parseAbsDir entryFP of
Nothing -> return Nothing |
The calls to |
@robstewart57 Can you offer some extra details so that we can reproduce this? |
… Stack.Setup The System.IO.Temp withSystemTempDirectory function from System.IO.Temp used in Stack.Setup returns a non-canonicalised path. However, the parseAbsDir function in the Path module of the path library expects canonicalised paths. The change is applied to stack setup, `sanityCheck` and stack upgrade in Stack.Setup . Fixes commercialhaskell#1017
In fact, I wasn't reading the stack trace in the right way. It turns out that the issue was with Stack.Setup whenever withSystemTempDirectory "stack-setup" $ \root' -> do
root <- parseAbsDir root' At least for me, the withSystemTempDirectory was not returning a canonicalised path, which is why I propose a PR that applies a fix to stack setup, sanityCheck and stack upgrade |
Hang off accepting this PR actually, this same problem is causing a problem elsewhere. More anon... |
… Stack.Build.Execute Relates to 7be7843 , which fixes the same instances of this pattern, in Stack.Setup . This does appear to fix commercialhaskell#1017 .
Closing so that we follow up on the PR (#1019). |
When the $TMPDIR environment variable is set, the directory paths provided by `withSystemTempDirectory` and `withTempDirectory` from System.IO.Temp provided by the temporary library are not canonicalised. This commit wraps these functions into canonicalized versions. See an earlier PR for discussion commercialhaskell#1019 Fixes commercialhaskell#1017
When the $TMPDIR environment variable is set, the directory paths provided by `withSystemTempDirectory` and `withTempDirectory` from System.IO.Temp provided by the temporary library are not canonicalised. This commit wraps these functions into canonicalized versions. See an earlier PR for discussion commercialhaskell#1019 Fixes commercialhaskell#1017
When I execute
stack setup
I'm getting this error:This is thrown by Path.parseAbsDir in the path package (see line 79). I've modified Path.IO.listDirectory to print the filepath it is calling
parseAbsDir
on, so that the file path is printed each time and also so that I can get the stack trace up to that point.This is the printed file paths and the stack trace:
I've raised this question with @chrisdone who believes that stack should canonicalize paths before calling
parseAbsDir
.The text was updated successfully, but these errors were encountered: