-
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
Filter out files that are not ending in .c from c-sources #9200
Filter out files that are not ending in .c from c-sources #9200
Conversation
7e79a16
to
3a5774b
Compare
3a5774b
to
a275708
Compare
@Kleidukos I thought there was somehing like this somewhere. Let's wait until we figure out what changed the behaviour and how it changed. |
@andreabedini I'm not opposed to this for |
😞 I understand. |
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.
Thank you for adding the warning --- that's progress. Also, thank you for resisting the urge to deduplicate at the last moment before the releases. :)
I think the warning should suggest people to use the include or install-include section. And link to the cabal manual where it clearly says headers. |
@@ -710,7 +710,10 @@ buildOrReplLib mReplFlags verbosity numJobs pkg_descr lbi lib clbi = do | |||
let (cSrcs', others) = partition (\filepath -> ".c"`isSuffixOf` filepath) (cSources libBi) | |||
unless (null others) $ do | |||
let files = intercalate ", " others | |||
warn verbosity $ "The following files listed in c-sources will not be used: " <> files | |||
let libraryName = case libName lib of |
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.
We have showLibraryName
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.
The output is unsatisfying. Especially because it is:
"library '" ++ prettyShow name ++ "'"
So the output would be:
"The following files listed in library 'lib2''s c-sources will not be used:
The double single quotes are not a mistake.
And if it's the main library, it only outputs "library", which breaks the flow of the sentence.
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.
Is
libraryNameStanza :: LibraryName -> String
libraryNameStanza LMainLibName = "library"
libraryNameStanza (LSubLibName name) = "library " ++ prettyShow name
any better? Otherwise, it's ok.
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.
Or rephrase as "The following files listed in the c-sources of the library 'lib2' will not be used"
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.
@fgaz I don't understand what this suggestion is addressing, sorry
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.
If you phrase it like that, you can use showLibraryName
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.
But we lose the "main" bit, which is fairly important.
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.
Good point. I wonder if showLibraryName
produces confusing messages elsewhere too. Maybe we should add "main" there too...
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.
Yes indeed, we will have to formalise a bit more the presentation layer for cabal-install.
@@ -29,7 +29,7 @@ tests = testGroup "Distribution.Utils.Structured" | |||
, testCase "GenericPackageDescription" $ | |||
md5Check (Proxy :: Proxy GenericPackageDescription) 0x8d8f340f10a58b8d8a87bf42213dac89 | |||
, testCase "LocalBuildInfo" $ | |||
md5Check (Proxy :: Proxy LocalBuildInfo) 0xbb22c3258d3092f31e992bc093d09170 | |||
md5Check (Proxy :: Proxy LocalBuildInfo) 0x618ab257e99d0b21c617e1f8c39a5a4b |
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.
Why is LocalBuildInfo
changing?
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.
No idea
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.
Try rebasing, it should disappear
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.
🤔
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.
@andreabedini I'm saying that because this appears to be based on an old commit with a different structured hash (0xbb22
... doesn't appear anywhere in HEAD)
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.
@fgaz rebasing on current 3.10 you mean?
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.
Nevermind, I grepped the wrong branch 🙈
@Kleidukos Could you add a test case too? something that has |
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.
I could reproduce with empty files too, if that makes it any easier
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.
Yeah sure let's go with it 👍
@andreabedini would you mind running the |
@Kleidukos I took some liberties, I hope you are ok with it |
This breaks the Also the warning did not work because it is only reached if |
Well, .cc is c++, so this should be under |
haskell#9200 started filtering `.cc` files from `c-sources` and does not always issue a warning (there has to be at least one `.c` file present before it warns you it is ignoring the others). Some packages in hackage (`double-conversion` for instance) rely on the ability to include `C++` source files in `c-sources`. This is not ideal, but we should probably continue to support these packages. This change will relax the filtering, so that only `.h` files are automatically excluded (with a warning). It will also warn if other non `.c` files are present (suggesting the `cxx-sources` since C++ sources are the most likely to be used). The bug that prevented warnings being displayed when no `.c` files were present is fixed.
Confirmed it works as expected on Mingw with cabal-3.10.2.0. I can confirm also that #9285 works on top of this one as expected:
|
Getting a changelog entry on this (retroactively) would maybe be nice, since the warning does not seem to work at all, at least in Setup.hs builds. Just had a fun afternoon debugging this. Also, I feel like in this sort of case, the chance of people accidentally relying on the »incorrect« behavior is big enough not to have this in a minor point release… |
This change caused one of our dependencies to silently fail. It would have been nice if this was a hard fail. |
Fixes NixOS#319365 Build of pdftotext was broken caused by a recent cabal change introduced via haskell/cabal#9200
Fixes NixOS#319365 Build of pdftotext was broken caused by a recent cabal change introduced via haskell/cabal#9200
This poc pre-filters file paths given in c-sources to only keep the ones ending in ".c", and outputs an appropriate message.
QA Notes
https://github.com/jtdaugherty/vty-unix
cabal build -w ghc-9.2.8
echo $?
relates to #9190
@hasufell @mouse07410 @andreabedini @angerman