-
Notifications
You must be signed in to change notification settings - Fork 697
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
Warn early that overwrite-policy is needed before build #9268
Conversation
To test, unpack a package from hackage that you've previously installed and try installing it without an
|
@Mikolaj the check failures don't seem related to changes I've made. Is there anything I need to do to move these along? |
I "fixed" precisely that one yesterday in another PR by clearing a part of the CI cache. Let me restart your CI and if it doesn't help, I'd clear some other parts of the cache. |
Great contribution! I'll try to review properly as soon as I'm free from some pressing stuff. Hope someone beats me to it though. |
7edf99d
to
d5fc1f8
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
At a first glance this looks very good! I'll review it in more detail tomorrow; in the meantime it needs tests
d5fc1f8
to
8ddf0b4
Compare
1b9793a
to
6c69db7
Compare
I see tests and dismiss my request for changes. I didn't have the bandwidth to look at this unfortuntately.
cabal-testsuite/PackageTests/LinkerOptions/NonignoredConfigs/cabal.test.hs
Outdated
Show resolved
Hide resolved
Could I please be allowed to add labels? I would like to mark this as a WIP. I'm finding that adding the test is harder than making the fix and don't want to bother reviewers with something half done. |
@philderbeast there is a “Still in progress? convert to draft” button on the right bar of the UI. Would that do? |
6c69db7
to
0c8a53f
Compare
c39a8ec
to
b74fcad
Compare
It looks like the normalization of the test output doesn't give the same result when running on Windows for CI run Actual output differs from expected:
stderr:
--- "D:\\a\\cabal\\cabal\\cabal-testsuite\\PackageTests\\WarnEarlyOverwrite\\clean-install-by-copy.dist\\clean-install-by-copy.out.normalized" 2023-10-30 22:50:07.370377400 +0000
+++ "D:\\a\\cabal\\cabal\\cabal-testsuite\\PackageTests\\WarnEarlyOverwrite\\clean-install-by-copy.dist\\clean-install-by-copy.comp.out.normalized" 2023-10-30 22:50:07.370377400 +0000
@@ -8,5 +8,5 @@
Preprocessing executable 'warn-early-overwrite' for WarnEarlyOverwrite-0.1.0.0...
Building executable 'warn-early-overwrite' for WarnEarlyOverwrite-0.1.0.0...
Installing executable warn-early-overwrite in <PATH>
-Warning: The directory <GBLTMPDIR>/ghc-<GHCVER>/incoming/new-<RAND><GBLTMPDIR>/ghc-<GHCVER>/<PACKAGE>-<HASH>/bin is not in the system search path.
-Copying 'warn-early-overwrite' to '<GBLTMPDIR>/warn-early-overwrite'
+Warning: The directory <GBLTMPDIR><GHCVER>/incoming/new-2448/Users/RUNNER~1/AppData/Local/Temp/cabal-test-store-28260/ghc-<GHCVER>/WarnEarlyOver_-0.1.0.0-4c19059e06a32b93b2812983631117e77a2d3833/bin is not in the system search path.
+Copying 'warn-early-overwrite' to '<GBLTMPDIR>'
*** Exception: ExitFailure 1 |
440ef73
to
221041b
Compare
060c327
to
9203e28
Compare
* Add symlinkableBinary * Extract installExesPrep * Add data InstallExe and data Symlink * Replace symlinkable with symlink taking InstallExe * Replace symlink/copy as symlink or copy * Improve a haddock, from check to try and stop * Get rid of duplication between install*Exes * Add InstallCfg * Drop the cfg prefix * Make errorMessage a where nested local * Add haddocks to InstallCheck
* Add project to avoid solver errors * SkipIfWindows for warn early overwrite tests * Windows does not natively include a touch command * Skip symlink install on windows * Add install by copy test and skip symlink install for Windows
9203e28
to
e8aa842
Compare
Thanks @mpickering. I've squashed commits and rejigged the changes to minimize differences. @ulysses4ever you may want to take another look. |
Is there no way to have two separate commits, one for refactoring and one for the behavioral change? It's fine if not, just asking. |
It's possible but a pain, especially if the code changes are interleaved (which means you can't use git's ability to pick individual diff chunks). By far the easiest way to do it is to discard all changes (possibly stashing them for reference) and start over, doing and committing the refactoring first. |
@ulysses4ever can you please point me at which parts you consider refactorings? I take a closer look then to see if those were necessary. |
@Mikolaj should I add the |
I have looked at this for a little bit but the diff is just too hard for me to read and understand without putting more effort in. I found it hard to work out what the functional changes were, what the refactoring was or what was an artifact introduced by formatting so I won't be able to review this one. |
@philderbeast: yes please, as soon as you are satisfied with the process. Beyond 2 reviews it's your call whether to ask for more. |
@mpickering I read that as a negative review. Overall, I found adding tests for this fix was a lot more time and work than doing the fix. The docs on how to write tests helped. When I first put this up for review, I'd moved some functions to top level by need so that I could use them in two places. I had not placed these strategically to reduce the diff count. On request, I squashed commits but also moved lines back closer to where they'd been to minimize diffs (some diffs I couldn't minimize because the formatter would change the layout again, mostly indentation changes). Sorry I didn't think to minimize diffs before asking for review. What could count as a refactoring is collecting repeated series of function arguments into records, |
To run the test locally:
|
I thought I'd also test with
No difference with
diff --git a/cabal-testsuite/PackageTests/WarnEarlyOverwrite/dirty-install.out b/cabal-testsuite/PackageTests/WarnEarlyOverwrite/dirty-install.out
index 3a813eebf..34d3ad6eb 100644
--- a/cabal-testsuite/PackageTests/WarnEarlyOverwrite/dirty-install.out
+++ b/cabal-testsuite/PackageTests/WarnEarlyOverwrite/dirty-install.out
@@ -1,5 +1,6 @@
# cabal v2-install
Wrote tarball sdist to <ROOT>/dirty-install.dist/work/./dist/sdist/WarnEarlyOverwrite-0.1.0.0.tar.gz
+Warning: Unknown/unsupported 'ghc' version detected (Cabal 3.11.0.0 supports 'ghc' version < 9.8): /.../.ghcup/bin/ghc is version <GHCVER>
Resolving dependencies...
Build profile: -w ghc-<GHCVER> -O1
In order, the following will be built:
@@ -8,6 +9,7 @@ Error: [Cabal-7149]
Path '<GBLTMPDIR>/warn-early-overwrite' already exists. Use --overwrite-policy=always to overwrite.
# cabal v2-install
Wrote tarball sdist to <ROOT>/dirty-install.dist/work/./dist/sdist/WarnEarlyOverwrite-0.1.0.0.tar.gz
+Warning: Unknown/unsupported 'ghc' version detected (Cabal 3.11.0.0 supports 'ghc' version < 9.8): /.../.ghcup/bin/ghc is version <GHCVER>
Resolving dependencies...
Build profile: -w ghc-<GHCVER> -O1
In order, the following will be built: |
Label |
definitely refractoring.
Same. Would be helpful for potential reviewers, I think, to have these in a separate commit. But that's okay. Thank you for the contribution! |
Closed in favour of #9506. |
See #5993.
Bonus points for added automated tests!