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

Backport #10483: fix cabal install --program-suffix/prefix (fix #10290 and #10476) #10511

Open
wants to merge 1 commit into
base: 3.12
Choose a base branch
from

Conversation

mergify[bot]
Copy link
Contributor

@mergify mergify bot commented Nov 3, 2024

#10290 shows: when checking for existing installations, cabal would not account for an affix (suffix or prefix). So, if you had a hello binary installed, installing a second one with a non-empty affix (a perfectly legal operation) would fail.

The reason seemed to be a typo in 09c04e9, which passed the arguments to the Symlink structure in a wrong order.

#10476 shows: when failing to install a binary because of an existing one, cabal would report suffix-less existing target even if a suffix was set.

This turned out to be a little issue in pretty printing.


I haven't gotten around to adding tests, sadly.


QA notes

Try to check that both #10290 and #10476 don't reproduce with this patch (they both have clear instructions for reproduction).


Template Α: This PR modifies behaviour or interface

Include the following checklist in your PR:

  • Patches conform to the coding conventions.
  • Any changes that could be relevant to users have been recorded in the changelog.
  • The documentation has been updated, if necessary.
  • Manual QA notes have been included.
  • Tests have been added. (Ask for help if you don’t know how to write them! Ask for an exemption if tests are too complex for too little coverage!)

This is an automatic backport of pull request #10483 done by [Mergify](https://mergify.com).

@geekosaur geekosaur force-pushed the mergify/bp/3.12/pr-10483 branch 2 times, most recently from 664ec19 to fd8ee40 Compare November 3, 2024 17:16
…10483)

* fix cabal install --program-suffix/prefix (fix #10290 and #10476)

When checking for existing installations, cabal would not account for
an affix (suffix or prefix). So, if you had a `hello` binary installed, installing a
second one with a non-empty affix (a perfectly legal operation) would
fail.

The reason seemed to be a typo in
09c04e9, which passed the arguments to
the Symlink structure in a wrong order.

When failing to install a binary because of an existing one, cabal would
report suffix-less existing target even if a suffix was set.

* Add regression tests for overwrite policies and porgram-affixes

Add regression tests for the `program-prefix` and `program-suffix` flags
combined with the overwrite-policy.
In short, the overwrite-policy needs to take potential program affixes
into account when deciding whether it will need to overwrite a program
path during installation.

---------

Co-authored-by: Fendor <[email protected]>
(cherry picked from commit ee3c313)
@geekosaur
Copy link
Collaborator

Uh, help? Unexpected output failure on Windows:

Actual output differs from expected:

stderr:
--- "C:\\Users\\RUNNER~1\\AppData\\Local\\Temp\\cabal-testsuite-43424\\overwrite-policy.dist\\overwrite-policy.out.normalized"	2024-11-03 18:43:42.486922500 +0000
+++ "C:\\Users\\RUNNER~1\\AppData\\Local\\Temp\\cabal-testsuite-43424\\overwrite-policy.dist\\overwrite-policy.comp.out.normalized"	2024-11-03 18:43:42.486922500 +0000
@@ -8,7 +8,7 @@
 Preprocessing executable 'p' for p-1.0...
 Building executable 'p' for p-1.0...
 Installing executable p in <PATH>
-Warning: The directory <ROOT>/overwrite-policy.dist/home/.cabal/store/ghc-<GHCVER>/incoming/new-<RAND><ROOT>/overwrite-policy.dist/home/.cabal/store/ghc-<GHCVER>/<PACKAGE>-<HASH>/bin is not in the system search path.
+Warning: The directory <ROOT>/overwrite-policy.dist/home/.cabal/store/ghc-<GHCVER>/incoming/new-8880/Users/RUNNER~1/AppData/Local/Temp/cabal-testsuite-43424/overwrite-policy.dist/home/.cabal/store/ghc-<GHCVER>/p-1.0-d27f9d92c8ddbe440f101be110e20cb3f3383c23/bin is not in the system search path.
 Symlinking 'p' to '<ROOT>/overwrite-policy.dist/usr/bin/p'
 # cabal install
 Wrote tarball sdist to <ROOT>/overwrite-policy.dist/work/./dist/sdist/p-1.0.tar.gz

e.g. https://github.com/haskell/cabal/actions/runs/11653542318/job/32446051232?pr=10511

Something about handling the templates that are supposed to prevent that failure, from the looks of it. I know nothing about that, especially on Windows which is the only platform where it's failing. @philderbeast?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants