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

Windows can't handle symlinks in the repository very well, especially broken ones #10442

Open
wz1000 opened this issue Oct 10, 2024 · 0 comments

Comments

@wz1000
Copy link

wz1000 commented Oct 10, 2024

While working on packaging Cabal 3.14 with GHC 9.12.1, I noticed that 4f01b76 added a broken symlink to the repository.

This broke GHC's source distribution because we use tar --dereference to construct the source archive which instructs tar to "follow symlinks; archive and dump the files they point to."

However, when the directory to be archived contains a broken symlink, this results in:

/usr/bin/tar: ghc-9.13.20241009/libraries/Cabal/cabal-install/tests/fixtures/project-root/cabal.project.symlink.broken: File removed before we read it

I believe the reason we do this is because Windows itself doesn't have very usable or consistent handling of symlinks in archives.

For instance, extracting a zip archive (such as https:/haskell/cabal/archive/refs/heads/master.zip) on windows using windows explorer results in symlink files being replaced by regular files whose content is the path to the target of the symlink.

On the other hand, extracting a tar archive with symlinks using the Mingw tar utility shipped with GHC itself, we get the contents of the symlink target "inlined" into the symlink itself, but this results in an error when the target of the symlink doesn't exist.

This can cause breakage in the testsuite depending on how you extract the files. For instance, if you extract a source zip of cabal using windows explorer, the contents of cabal-testsuite/PackageTests/ReexportedModules/p-fail-other/Private.hs would be the literal string ../p/Private.hs which would cause tests to fail I imagine.


I think we will just exclude this broken symlink from the source archive we distribute with GHC, so fixing this isn't time critical, but I imagine this problem might also create headaches for source distributions of Cabal itself.

hubot pushed a commit to ghc/ghc that referenced this issue Oct 10, 2024
Cabal 3.14 introduced a broken symlink in its testsuite. Unfortunately,
this broke our source distribution as we use use `tar --dereference` to avoid
issues with symlink compatibility on windows, and `tar --dereference` chokes
when it encounters any broken symlinks.

We can't get rid of `--dereference` because symlinks are generally broken on
windows, so the only option is to exclude this file from source archives.

see also haskell/cabal#10442
hubot pushed a commit to ghc/ghc that referenced this issue Oct 10, 2024
Cabal 3.14 introduced a broken symlink in its testsuite. Unfortunately,
this broke our source distribution as we use use `tar --dereference` to avoid
issues with symlink compatibility on windows, and `tar --dereference` chokes
when it encounters any broken symlinks.

We can't get rid of `--dereference` because symlinks are generally broken on
windows, so the only option is to exclude this file from source archives.

see also haskell/cabal#10442
hubot pushed a commit to ghc/ghc that referenced this issue Oct 11, 2024
Cabal 3.14 introduced a broken symlink in its testsuite. Unfortunately,
this broke our source distribution as we use use `tar --dereference` to avoid
issues with symlink compatibility on windows, and `tar --dereference` chokes
when it encounters any broken symlinks.

We can't get rid of `--dereference` because symlinks are generally broken on
windows, so the only option is to exclude this file from source archives.

see also haskell/cabal#10442
hubot pushed a commit to ghc/ghc that referenced this issue Oct 11, 2024
Cabal 3.14 introduced a broken symlink in its testsuite. Unfortunately,
this broke our source distribution as we use use `tar --dereference` to avoid
issues with symlink compatibility on windows, and `tar --dereference` chokes
when it encounters any broken symlinks.

We can't get rid of `--dereference` because symlinks are generally broken on
windows, so the only option is to exclude this file from source archives.

see also haskell/cabal#10442
hubot pushed a commit to ghc/ghc that referenced this issue Oct 12, 2024
Cabal 3.14 introduced a broken symlink in its testsuite. Unfortunately,
this broke our source distribution as we use use `tar --dereference` to avoid
issues with symlink compatibility on windows, and `tar --dereference` chokes
when it encounters any broken symlinks.

We can't get rid of `--dereference` because symlinks are generally broken on
windows, so the only option is to exclude this file from source archives.

see also haskell/cabal#10442
hubot pushed a commit to ghc/ghc that referenced this issue Oct 12, 2024
Cabal 3.14 introduced a broken symlink in its testsuite. Unfortunately,
this broke our source distribution as we use use `tar --dereference` to avoid
issues with symlink compatibility on windows, and `tar --dereference` chokes
when it encounters any broken symlinks.

We can't get rid of `--dereference` because symlinks are generally broken on
windows, so the only option is to exclude this file from source archives.

see also haskell/cabal#10442
hubot pushed a commit to ghc/ghc that referenced this issue Oct 13, 2024
Cabal 3.14 introduced a broken symlink in its testsuite. Unfortunately,
this broke our source distribution as we use use `tar --dereference` to avoid
issues with symlink compatibility on windows, and `tar --dereference` chokes
when it encounters any broken symlinks.

We can't get rid of `--dereference` because symlinks are generally broken on
windows, so the only option is to exclude this file from source archives.

see also haskell/cabal#10442

(cherry picked from commit 16f9766)
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

1 participant