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

stdbuf: remove crash macro #5549

Merged
merged 5 commits into from
Nov 20, 2023
Merged

Conversation

cswn
Copy link
Contributor

@cswn cswn commented Nov 16, 2023

This is related to issue: #5487
Removes the crash! macro from stdbuf.

@cswn cswn changed the title Stdbuf remove crash macro stdbuf: remove crash macro Nov 16, 2023
Copy link

GNU testsuite comparison:

GNU test failed: tests/tail/inotify-dir-recreate. tests/tail/inotify-dir-recreate is passing on 'main'. Maybe you have to rebase?
GNU test failed: tests/tail/retry. tests/tail/retry is passing on 'main'. Maybe you have to rebase?

@cakebaker
Copy link
Contributor

Did you see that test_stdbuf_invalid_mode_fails now fails?

@cswn
Copy link
Contributor Author

cswn commented Nov 17, 2023

No, I didn't, will take a look now

Copy link

GNU testsuite comparison:

Congrats! The gnu test tests/tail/symlink is no longer failing!
GNU test failed: tests/tail/inotify-dir-recreate. tests/tail/inotify-dir-recreate is passing on 'main'. Maybe you have to rebase?

Copy link
Member

@tertsdiepraam tertsdiepraam left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice! Just one suggestion

@@ -102,7 +103,10 @@ fn check_option(matches: &ArgMatches, name: &str) -> Result<BufferType, ProgramO
}
}
x => parse_size_u64(x).map_or_else(
|e| crash!(125, "invalid mode {}", e),
|e| {
set_exit_code(125);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this lines should not be necessary. The exit code should be added to the error here:

let options = ProgramOptions::try_from(&matches).map_err(|e| UUsageError::new(125, e.0))?;

It'd be great if you could also verify that this is actually the case by writing a test for it.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, you're right, I've taken that line out. However, the test already asserts that the error code is 125: https://github.com/cswn/coreutils/blob/26df9445fb70152abfd523c0bdb75def6c7d5475/tests/by-util/test_stdbuf.rs#L67C9-L67C9

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cool!

Copy link

GNU testsuite comparison:

GNU test failed: tests/tail/truncate. tests/tail/truncate is passing on 'main'. Maybe you have to rebase?

@cakebaker cakebaker merged commit 58087df into uutils:main Nov 20, 2023
49 of 52 checks passed
@cakebaker
Copy link
Contributor

Thanks!

@cswn cswn deleted the stdbuf-remove-crash-macro branch November 20, 2023 10:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants