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

Unrelated withFile error message when renameFile errors #320

Open
brandonchinn178 opened this issue Sep 13, 2024 · 0 comments
Open

Unrelated withFile error message when renameFile errors #320

brandonchinn178 opened this issue Sep 13, 2024 · 0 comments

Comments

@brandonchinn178
Copy link

If I call downloadPackage' to a destination directory I haven't created yet, I get a weird error:

my-exe: /Users/bchinn/.cache/my-exe/package-index/hackage.haskell.org/01-index.tar: withFile: does not exist (No such file or directory)

This is weird because that filepath does exist.

Digging deeper, I found the issue occurs in the renameFile call. Because I didn't create the destination directory yet, renameFile errors with:

renameFile:renamePath:rename '/Users/bchinn/.cache/my-exe/package-index/hackage.haskell.org/Cabal-syntax-3.10.2.0.tar75518-0.gz' to '/Users/bchinn/.cache/my-exe/packages/Cabal-syntax-3.10.2.0': does not exist (No such file or directory)

But this error gets swallowed; presumably there's some clean up step that looks for 01-index.tar and errors before showing the actual error.

A few action items:

  1. Document that downloadPackage requires directory to exist (or create the directory automatically if it doesn't)
  2. Investigate why withFile complains about the file not existing when... it does?
  3. Check if the destination exists beforehand and show a better error message (contingent on how 1 and 2 get resolved)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant