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

cabal list-bin is broken #8664

Closed
athas opened this issue Jan 11, 2023 · 16 comments · Fixed by #8670 or #8691
Closed

cabal list-bin is broken #8664

athas opened this issue Jan 11, 2023 · 16 comments · Fixed by #8670 or #8691
Assignees
Labels
attention: needs-test regression on master Regression that is unreleased and needs to be fixed before release type: bug

Comments

@athas
Copy link
Collaborator

athas commented Jan 11, 2023

Since b2be49c (#8622) cabal list-bin no longer produces any output on any project I try it on. If I change the use of info back to putStrLn, it works again.

Steps to reproduce the behavior: In the cabal repository itself: cabal list-bin cabal

It is also possible that I am holding it wrong (I don't understand this entire info machinery), but I don't see how a command like list-bin can possibly require any complexity or subtle behaviour.

@athas
Copy link
Collaborator Author

athas commented Jan 11, 2023

Changing the flag passed to info to verbose also makes it work, but perhaps someone savvy about this system should weigh in. The info function does nothing if the passed-in verbosity isn't at least verbose, so to me it makes no sense to ever pass it a constant.

@ulysses4ever
Copy link
Collaborator

@athas great catch, thanks! I think, the right way to do it is notice verbosity instead of the current info normal. Could you try that and, if satisfied, submit a patch, please?

@fgaz
Copy link
Member

fgaz commented Jan 12, 2023

I think we shouldn't use logging functions for that. This isn't a log, it's normal output. I'd expect list-bin to print out the path even with -v0.

@fgaz
Copy link
Member

fgaz commented Jan 12, 2023

And we really need a test for list-bin. This isn't the first time it breaks

@ulysses4ever
Copy link
Collaborator

@fgaz that makes sense. If you read the initial ticket by @andreasabel #8400, it seems there was an argument for that had to do with the desire to have some more control than what what a mere putStrLn gives. But perhaps, it's not what we want and indeed, your example with -v0 makes perfect sense.

@andreasabel
Copy link
Member

The intention of #8400 was to make it possible to get a test for list-bin in our current test framework (which catches marked output). In #8622, no test was added; it was a mistake to approve it nevertheless, my apologies.
Maybe the immediate action would be to revert #8622, and reopen #8400, and then fix #8400 properly with test.

Refs:

@andreasabel andreasabel added the regression on master Regression that is unreleased and needs to be fixed before release label Jan 13, 2023
@athas
Copy link
Collaborator Author

athas commented Jan 13, 2023

That sounds like right way to go for now.

@athas
Copy link
Collaborator Author

athas commented Jan 13, 2023

And I suppose an actual solution might just use withOutputMarker directly, but someone familiar with the Verbosity system should probably weigh in.

@andreasabel
Copy link
Member

Turns out we had a test case for list-bin contributed in #7925, but it didn't catch the main output (path to executable) because of #8400. A correct fix of #8400 should have touched the output of this testcase.
There is even another test contributed by @bacchanalia which should also benefit from a proper fix of #8400. I feel like both of these tests have to be revised to actually check that the path to the binary is produced by list-bin (atm, they succeed without checking that).

Ref:

@andreasabel
Copy link
Member

I have an emergency fix at #8668 (revert #8622) and a proper fix at #8670 which makes the emergency fix obsolete if merged quickly enough.

@andreasabel andreasabel self-assigned this Jan 13, 2023
@ulysses4ever
Copy link
Collaborator

I also screwed up with approving the patch. Thank you Andreas for quickly acting on this!

@mergify mergify bot closed this as completed in #8670 Jan 16, 2023
@athas
Copy link
Collaborator Author

athas commented Jan 16, 2023

Lovely! Thanks for the fix. Now my hacky Makefile will work a little while longer.

@Bodigrim
Copy link
Collaborator

Reopening, the fix in #8670 misses a newline character. Depending on your terminal emulator it might look a bit different.

In zsh:

$ cabal-3.8.1.0 list-bin bytestring-tests
/Users/andrew/programs/bytestring/dist-newstyle/build/aarch64-osx/ghc-9.2.5/bytestring-0.11.3.1/t/bytestring-tests/build/bytestring-tests/bytestring-tests

but look at the last character:

$ cabal list-bin bytestring-tests
Warning: this is a debug build of cabal-install with assertions enabled.
/Users/andrew/programs/bytestring/dist-newstyle/build/aarch64-osx/ghc-9.2.5/bytestring-0.11.3.1/t/bytestring-tests/build/bytestring-tests/bytestring-tests%

@Bodigrim Bodigrim reopened this Jan 19, 2023
@Mikolaj
Copy link
Member

Mikolaj commented Jan 20, 2023

We'd also need a new test that checks the newline.

@andreasabel
Copy link
Member

We'd also need a new test that checks the newline.

This isn't directly in the scope of the test framework, since it adds the newline:

withOutputMarker _ xs =
"-----BEGIN CABAL OUTPUT-----\n" ++
withTrailingNewline xs ++
"-----END CABAL OUTPUT-----\n"

@andreasabel
Copy link
Member

andreasabel commented Jan 20, 2023

Reopening, the fix in #8670 misses a newline character.

Since I am assigned to this issue, I will suggest a PR.

@mergify mergify bot closed this as completed in #8691 Jan 22, 2023
mergify bot added a commit that referenced this issue Jan 22, 2023
Fix #8664 redux: add EOL character to list-bin output
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
attention: needs-test regression on master Regression that is unreleased and needs to be fixed before release type: bug
Projects
None yet
7 participants