-
Notifications
You must be signed in to change notification settings - Fork 704
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
Breaking change in importing packages? #8795
Comments
I've included the reproduction as a pull request. |
Here's the code change that changes the behaviour: 0db95ca#diff-8280f05bf3effdec103f73157f07a93ca761fa0b6bf1fbe25c0dcf56fc6abfd1L227-R228 - Nothing -> BS.readFile pci
+ Nothing -> BS.readFile $
+ if isAbsolute pci then pci else takeDirectory source </> pci |
I don't think there's a semantics that resolves the issue resolved by #8686 and also does what is asked here, and I think the semantics there make the most sense. In the given example, I propose closing this. |
In the test for #8686 packages are given as paths to cabal files but packages can also be given as paths to folders. Should these continue to be anchored to the root of the project if using a
|
Could we say more in the docs about where package directory paths are relative to (the file they're in or the project root)?
|
I think the project root relative/absolute issue was addressed in #8454 however i guess the issue is if an included project file should have its packages relative to its own root or to the project root. 🤔 |
Indeed, this seems inconsistent when the imported file is relative one way but the package paths are relative another way. With #8454 all tests have |
can someone summarize the migration from 3.8 to 3.10 for us please? We have chains of cabal.project files which import each other the way paths in import are meant to work is not documented |
This needs to be thought through and documented carefully. That said, I think the difference is as follows: 3.8: Project imports are all relative to whatever directory cabal is invoked from The remaining puzzling bit is not about package imports, but the way that project files resolve relative paths of packages they list, which has not changed over the course of the introduction of project imports, but now that we are looking closely at these semantics, we may also want to clean up. |
No that's not right. In my example if you do I guess moving everything to the top-level is the only option for us; there isn't even a way to do this with 3.10 pinned |
Ah, ok, so what I wrote is the desired semantics for 3.10 and you're saying they still aren't what's implemented, because everything appears to be relative to the initial project file used, rather than each successive project file? |
No, an |
I only ever use |
This comment prompted me to try invoking cabal from somewhere other than the project root directory. With |
Ok let me try to explain what I understand is now the case. I created the following structure.
In cabal 3.10, this works when calling So far, this is what I described prior, and I think the new behavior is superior. Now, in both versions, Finally, in both versions, invoking Does this description of behavior and the two bugs to fix sound correct, or are there other changes that people would like to make (or not make)? (If #8454 were implemented, we might have some workarounds by setting --project-dir explicitly as well, but sadly no such luck) Edit: thanks for bearing with us on this. Imports were largely motivated by bringing in common stanzas, constraints, etc or picking different flags based on oses or compiler versions. It honestly didn't occur to me that people would use them to structure trees of packages, and consequently the design process really dropped the ball on working out carefully the relative path semantics, especially with regards to the interaction with |
Describe the bug
I installed cabal-install from source and noticed a breaking change. I took the test from #8686 and created a similar test that shows the problem.
Stepping through the indirection of imports:
In the reproduction, if I import the packages in 1-hop then we're good but in 2-hops we break (when we didn't before).
To Reproduce
First off with v3.8.1.0 (this works):
Then with v3.9.0.0 (this fails):
From the error report, cabal has repeated the first part of the path.
Expected behavior
I like Dhall's stance on imports. Can we do something like that?
System information
The text was updated successfully, but these errors were encountered: