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

cabal sdist, file name too long, unhelpful error message #9438

Closed
augustss opened this issue Nov 13, 2023 · 13 comments
Closed

cabal sdist, file name too long, unhelpful error message #9438

augustss opened this issue Nov 13, 2023 · 13 comments

Comments

@augustss
Copy link
Contributor

Describe the bug
cabal complains about a file name being too long without any mention of the file name.

To Reproduce
I'm not sure what causes the problem, I have no overly long file names.

$ cabal sdist

produces

Error: cabal: Error packing sdist: File name too long (cannot split)

Expected behavior
No error message.

System information

  • Ubuntu running in WSL

cabal-install version 3.10.2.0
compiled using version 3.10.2.1 of the Cabal library

@ffaf1
Copy link
Collaborator

ffaf1 commented Nov 13, 2023

Is the repo publicly available?

@ffaf1 ffaf1 changed the title Unhelpful error message cabal sdist, file name too long, unhelpful error message Nov 13, 2023
@ffaf1
Copy link
Collaborator

ffaf1 commented Nov 13, 2023

Relevant cabal code:

case Tar.toTarPath True prefix of
Left err -> liftIO $ dieWithException verbosity $ ErrorPackingSdist err
Right path -> tell [Tar.directoryEntry path]
for_ files $ \file -> do
let fileDir = takeDirectory (prefix </> file)
needsEntry <- gets (Set.notMember fileDir)
when needsEntry $ do
modify (Set.insert fileDir)
case Tar.toTarPath True fileDir of
Left err -> liftIO $ dieWithException verbosity $ ErrorPackingSdist err
Right path -> tell [Tar.directoryEntry path]
contents <- liftIO . fmap BSL.fromStrict . BS.readFile $ dir </> file
case Tar.toTarPath False (prefix </> file) of
Left err -> liftIO $ dieWithException verbosity $ ErrorPackingSdist err
Right path -> tell [(Tar.fileEntry path contents){Tar.entryPermissions = Tar.ordinaryFilePermissions}]

Relevant tar code:

https://github.com/haskell/tar/blob/665c1ebc369b3c8734b43b5d092a26dc36de25a6/Codec/Archive/Tar/Types.hs#L349-L369

@augustss
Copy link
Contributor Author

augustss commented Nov 13, 2023 via email

@ffaf1
Copy link
Collaborator

ffaf1 commented Nov 13, 2023

Cabal HEAD

~/download/MicroHs (master)$ cabal sdist
Warning: this is a debug build of cabal-install with assertions enabled.
Wrote tarball sdist to
/home/f/download/MicroHs/dist-newstyle/sdist/MicroHs-0.5.tar.gz

Same with cabal 3.10.1.0. This has to be Windows shenanigans. @jneira @Kleidukos, could you test on your machines?

git clone  https://github.com/augustss/MicroHs
cd MicroHs
cabal sdist

@augustss
Copy link
Contributor Author

augustss commented Nov 14, 2023 via email

@ffaf1
Copy link
Collaborator

ffaf1 commented Nov 14, 2023

I have opened a PR at haskell/tar#76.

@Kleidukos
Copy link
Member

Yeah it all works well on my Windows by default. haskell/tar#76 will be helpful in debugging this.

@ffaf1
Copy link
Collaborator

ffaf1 commented Nov 14, 2023

The patch was accepted, so strictly speaking this bug report should be closed — when tar maintainers decide to upload a new release to Hackage, that is.

Meanwhile, would you mind using this executable to run cabal sdist in your folder? It should give us the name of the offending filepath.

cabal-lennart.tar.gz

@gbaz
Copy link
Collaborator

gbaz commented Nov 15, 2023

sadly an almost ten year old issue in tar on supporting long file names. (which really means supporting an extension to the tar format in a clean way, which causes a lot of architectural questions) haskell/tar#1 sigh...

@Bodigrim
Copy link
Collaborator

@ffaf1 @gbaz could you test whether haskell/tar#77 works for long file names?

@augustss
Copy link
Contributor Author

augustss commented Nov 15, 2023 via email

@ffaf1
Copy link
Collaborator

ffaf1 commented Nov 16, 2023

Another happy user.

@Bodigrim I tried it with a somewhat long path (558 characters) and it worked. (It should really be a Quickcheck test in the testsuite tho)

@ffaf1 ffaf1 closed this as completed Nov 16, 2023
@Bodigrim
Copy link
Collaborator

@Bodigrim I tried it with a somewhat long path (558 characters) and it worked.

Thanks!

(It should really be a Quickcheck test in the testsuite tho)

Contributing tests would be most welcome. The branch indeed is likely to get stalled again unless someone writes tests; I don't have any personaly interest or expertise in the area.

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

5 participants