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

Rollup of 10 pull requests #83573

Merged
merged 20 commits into from
Mar 27, 2021
Merged
Changes from 1 commit
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
11e40ce
ExitStatus: print "exit status: {}" rather than "exit code: {}"
ijackson Mar 25, 2021
229d199
lazily calls some fns
klensy Mar 26, 2021
5b9bac2
format macro argument parsing fix
osa1 Mar 21, 2021
2afa4cc
Use DebugStruct::finish_non_exhaustive() in std.
m-ou-se Mar 27, 2021
d730153
Fix Debug implementation for RwLock{Read,Write}Guard.
m-ou-se Mar 27, 2021
7c01e6c
Derive Debug for io::Chain instead of manually implementing it.
m-ou-se Mar 27, 2021
5402abc
Improve Debug implementations of Mutex and RwLock.
m-ou-se Mar 27, 2021
5495ce0
Use detailed and shorter fs error explaination
pickfire Nov 25, 2020
d5bcdd3
Update rustup cross-compilation docs link
jonjensen Mar 27, 2021
0927580
Add regression tests for #56445
sjakobi Mar 27, 2021
1f33a6a
Rollup merge of #79399 - pickfire:patch-3, r=JohnTitor
JohnTitor Mar 27, 2021
973fb4b
Rollup merge of #83348 - osa1:issue83344, r=jackh726
JohnTitor Mar 27, 2021
3f41fdd
Rollup merge of #83462 - ijackson:exitstatus-message-wording, r=josht…
JohnTitor Mar 27, 2021
fa70398
Rollup merge of #83526 - klensy:lazy-too, r=petrochenkov
JohnTitor Mar 27, 2021
53cc806
Rollup merge of #83558 - m-ou-se:use-finish-non-exhaustive, r=jackh726
JohnTitor Mar 27, 2021
5dc29e1
Rollup merge of #83559 - m-ou-se:rwlock-guard-debug-fix, r=jackh726
JohnTitor Mar 27, 2021
8ad5f21
Rollup merge of #83560 - m-ou-se:io-chain-debug, r=sfackler
JohnTitor Mar 27, 2021
a800d7f
Rollup merge of #83561 - m-ou-se:lock-debug, r=jackh726
JohnTitor Mar 27, 2021
69acaf3
Rollup merge of #83567 - jonjensen:patch-1, r=GuillaumeGomez
JohnTitor Mar 27, 2021
1ad7c52
Rollup merge of #83569 - sjakobi:issue56445-regression-test, r=jackh726
JohnTitor Mar 27, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
ExitStatus: print "exit status: {}" rather than "exit code: {}"
Proper Unix terminology is "exit status" (vs "wait status").  "exit
code" is imprecise on Unix and therefore unclear.  (As far as I can
tell, "exit code" is correct terminology on Windows.)

This new wording is unfortunately inconsistent with the identifier
names in the Rust stdlib.

It is the identifier names that are wrong, as discussed at length in eg
  https://doc.rust-lang.org/nightly/std/process/struct.ExitStatus.html
  https://doc.rust-lang.org/nightly/std/os/unix/process/trait.ExitStatusExt.html

Unfortunately for API stability reasons it would be a lot of work, and
a lot of disruption, to change the names in the stdlib (eg to rename
`std::process::ExitStatus` to `std::process::ChildStatus` or
something), but we should fix the message output.  Many (probably
most) readers of these messages about exit statuses will be users and
system administrators, not programmers, who won't even know that Rust
has this wrong terminology.

So I think the right thing is to fix the documentation (as I have
already done) and, now, the terminology in the implementation.

This is a user-visible change to the behaviour of all Rust programs
which run Unix subprocesses.  Hopefully no-one is matching against the
exit status string, except perhaps in tests.

Signed-off-by: Ian Jackson <[email protected]>
ijackson committed Mar 25, 2021
commit 11e40ce240d884303bee142a727decaeeef43bdb
2 changes: 1 addition & 1 deletion library/std/src/sys/unix/process/process_unix.rs
Original file line number Diff line number Diff line change
@@ -529,7 +529,7 @@ impl From<c_int> for ExitStatus {
impl fmt::Display for ExitStatus {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
if let Some(code) = self.code() {
write!(f, "exit code: {}", code)
write!(f, "exit status: {}", code)
} else if let Some(signal) = self.signal() {
if self.core_dumped() {
write!(f, "signal: {} (core dumped)", signal)
4 changes: 2 additions & 2 deletions library/std/src/sys/unix/process/process_unix/tests.rs
Original file line number Diff line number Diff line change
@@ -9,8 +9,8 @@ fn exitstatus_display_tests() {

t(0x0000f, "signal: 15");
t(0x0008b, "signal: 11 (core dumped)");
t(0x00000, "exit code: 0");
t(0x0ff00, "exit code: 255");
t(0x00000, "exit status: 0");
t(0x0ff00, "exit status: 255");

// On MacOS, 0x0137f is WIFCONTINUED, not WIFSTOPPED. Probably *BSD is similar.
// https://github.com/rust-lang/rust/pull/82749#issuecomment-790525956