Skip to content

Assertion failure causes wrong exit status #4547

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

Closed
alexcrichton opened this issue Jan 20, 2013 · 6 comments
Closed

Assertion failure causes wrong exit status #4547

alexcrichton opened this issue Jan 20, 2013 · 6 comments
Labels
E-easy Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue. E-needs-test Call for participation: An issue has been fixed and does not reproduce, but no test has been added.

Comments

@alexcrichton
Copy link
Member

fn main() {
  os::args();
  assert!(false);
}

Causes the program to return with exit status 0. Thankfully removing os::args() makes it return with nonzero, but it appears that at any point after the invocation of os::args() an assertion failure will cause an exit status of 0.

I ran this against a compiler built at e51ec26

@alexcrichton
Copy link
Member Author

I don't know of the implications, but removing the else from this line (so both if blocks are always evaluated) seems to fix at least my problem. I don't know how much else it breaks, though.

@brson
Copy link
Contributor

brson commented Mar 14, 2013

Previous pull request with discussion of solutions #5054

@nikomatsakis
Copy link
Contributor

Not critical for 0.6; removing milestone

alexcrichton added a commit to alexcrichton/rust that referenced this issue May 26, 2013
@alexcrichton
Copy link
Member Author

I'm happy to say that with RUST_NEWRT=1 this failure does not occur. Seeing how we're probably going to be switching over to the new runtime in the near future, I'm going to close this issue.

Otherwise it'd just stay open until then because it doesn't look like it's going to be fixed in the meantime.

@alexcrichton
Copy link
Member Author

Reopening, this should have a test.

@alexcrichton
Copy link
Member Author

Closed in #7923

bors pushed a commit to rust-lang-ci/rust that referenced this issue May 15, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
E-easy Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue. E-needs-test Call for participation: An issue has been fixed and does not reproduce, but no test has been added.
Projects
None yet
Development

No branches or pull requests

3 participants