rust/compiler
bors 8c6ce6b91b Auto merge of #97802 - Enselic:add-no_ignore_sigkill-feature, r=joshtriplett
Support `#[unix_sigpipe = "inherit|sig_dfl"]` on `fn main()` to prevent ignoring `SIGPIPE`

When enabled, programs don't have to explicitly handle `ErrorKind::BrokenPipe` any longer. Currently, the program

```rust
fn main() { loop { println!("hello world"); } }
```

will print an error if used with a short-lived pipe, e.g.

    % ./main | head -n 1
    hello world
    thread 'main' panicked at 'failed printing to stdout: Broken pipe (os error 32)', library/std/src/io/stdio.rs:1016:9
    note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

by enabling `#[unix_sigpipe = "sig_dfl"]` like this

```rust
#![feature(unix_sigpipe)]
#[unix_sigpipe = "sig_dfl"]
fn main() { loop { println!("hello world"); } }
```

there is no error, because `SIGPIPE` will not be ignored and thus the program will be killed appropriately:

    % ./main | head -n 1
    hello world

The current libstd behaviour of ignoring `SIGPIPE` before `fn main()` can be explicitly requested by using `#[unix_sigpipe = "sig_ign"]`.

With `#[unix_sigpipe = "inherit"]`, no change at all is made to `SIGPIPE`, which typically means the behaviour will be the same as `#[unix_sigpipe = "sig_dfl"]`.

See https://github.com/rust-lang/rust/issues/62569 and referenced issues for discussions regarding the `SIGPIPE` problem itself

See the [this](https://rust-lang.zulipchat.com/#narrow/stream/219381-t-libs/topic/Proposal.3A.20First.20step.20towards.20solving.20the.20SIGPIPE.20problem) Zulip topic for more discussions, including about this PR.

Tracking issue: https://github.com/rust-lang/rust/issues/97889
2022-09-02 21:08:08 +00:00
..
rustc
rustc_apfloat
rustc_arena
rustc_ast Always import all tracing macros for the entire crate instead of piecemeal by module 2022-09-01 14:54:27 +00:00
rustc_ast_lowering Always import all tracing macros for the entire crate instead of piecemeal by module 2022-09-01 14:54:27 +00:00
rustc_ast_passes Always import all tracing macros for the entire crate instead of piecemeal by module 2022-09-01 14:54:27 +00:00
rustc_ast_pretty
rustc_attr Also replace the version placeholder in rustc_attr 2022-09-02 01:47:01 +02:00
rustc_borrowck Rollup merge of #101285 - TaKO8Ki:do-not-suggest-adding-move-when-closure-is-already-marked-as-move, r=oli-obk 2022-09-01 21:37:21 +02:00
rustc_builtin_macros Always import all tracing macros for the entire crate instead of piecemeal by module 2022-09-01 14:54:27 +00:00
rustc_codegen_cranelift Auto merge of #97802 - Enselic:add-no_ignore_sigkill-feature, r=joshtriplett 2022-09-02 21:08:08 +00:00
rustc_codegen_gcc
rustc_codegen_llvm Always import all tracing macros for the entire crate instead of piecemeal by module 2022-09-01 14:54:27 +00:00
rustc_codegen_ssa Auto merge of #97802 - Enselic:add-no_ignore_sigkill-feature, r=joshtriplett 2022-09-02 21:08:08 +00:00
rustc_const_eval Rollup merge of #100121 - Nilstrieb:mir-validator-param-env, r=oli-obk 2022-09-02 18:21:58 +02:00
rustc_data_structures Auto merge of #100869 - nnethercote:replace-ThinVec, r=spastorino 2022-09-01 08:01:06 +00:00
rustc_driver tracing::instrument cleanup 2022-09-01 14:54:27 +00:00
rustc_error_codes
rustc_error_messages Rollup merge of #100814 - gabrielBusta:port_trait_selection_diagnostics, r=davidtwco 2022-09-02 18:22:00 +02:00
rustc_errors Always import all tracing macros for the entire crate instead of piecemeal by module 2022-09-01 14:54:27 +00:00
rustc_expand Always import all tracing macros for the entire crate instead of piecemeal by module 2022-09-01 14:54:27 +00:00
rustc_feature Auto merge of #97802 - Enselic:add-no_ignore_sigkill-feature, r=joshtriplett 2022-09-02 21:08:08 +00:00
rustc_fs_util
rustc_graphviz
rustc_hir Always import all tracing macros for the entire crate instead of piecemeal by module 2022-09-01 14:54:27 +00:00
rustc_hir_pretty
rustc_incremental
rustc_index
rustc_infer tracing::instrument cleanup 2022-09-01 14:54:27 +00:00
rustc_interface Rollup merge of #100552 - petrochenkov:flavorcompat, r=lqd 2022-09-02 11:34:49 +02:00
rustc_lexer
rustc_lint Rollup merge of #97739 - a2aaron:let_underscore, r=estebank 2022-09-02 11:34:45 +02:00
rustc_lint_defs
rustc_llvm
rustc_log
rustc_macros Allow deriving multiple subdiagnostics using one SessionSubdiagnostic 2022-09-01 21:18:01 +02:00
rustc_metadata Auto merge of #98960 - cjgillot:entry-kind, r=estebank 2022-09-01 19:31:14 +00:00
rustc_middle Rollup merge of #100814 - gabrielBusta:port_trait_selection_diagnostics, r=davidtwco 2022-09-02 18:22:00 +02:00
rustc_mir_build tracing::instrument cleanup 2022-09-01 14:54:27 +00:00
rustc_mir_dataflow
rustc_mir_transform
rustc_monomorphize Auto merge of #97802 - Enselic:add-no_ignore_sigkill-feature, r=joshtriplett 2022-09-02 21:08:08 +00:00
rustc_parse Always import all tracing macros for the entire crate instead of piecemeal by module 2022-09-01 14:54:27 +00:00
rustc_parse_format
rustc_passes Auto merge of #97802 - Enselic:add-no_ignore_sigkill-feature, r=joshtriplett 2022-09-02 21:08:08 +00:00
rustc_plugin_impl
rustc_privacy Rollup merge of #100147 - Bryanskiy:private-in-public, r=petrochenkov 2022-09-02 11:34:48 +02:00
rustc_query_impl Don't create two new closures for each query 2022-09-01 18:47:54 -05:00
rustc_query_system Don't create two new closures for each query 2022-09-01 18:47:54 -05:00
rustc_resolve Rollup merge of #100147 - Bryanskiy:private-in-public, r=petrochenkov 2022-09-02 11:34:48 +02:00
rustc_save_analysis Always import all tracing macros for the entire crate instead of piecemeal by module 2022-09-01 14:54:27 +00:00
rustc_serialize
rustc_session Auto merge of #97802 - Enselic:add-no_ignore_sigkill-feature, r=joshtriplett 2022-09-02 21:08:08 +00:00
rustc_smir
rustc_span Auto merge of #97802 - Enselic:add-no_ignore_sigkill-feature, r=joshtriplett 2022-09-02 21:08:08 +00:00
rustc_symbol_mangling Always import all tracing macros for the entire crate instead of piecemeal by module 2022-09-01 14:54:27 +00:00
rustc_target rustc_target: Refactor internal linker flavors slightly 2022-09-01 16:54:52 +03:00
rustc_trait_selection Rollup merge of #100814 - gabrielBusta:port_trait_selection_diagnostics, r=davidtwco 2022-09-02 18:22:00 +02:00
rustc_traits
rustc_transmute Always import all tracing macros for the entire crate instead of piecemeal by module 2022-09-01 14:54:27 +00:00
rustc_ty_utils tracing::instrument cleanup 2022-09-01 14:54:27 +00:00
rustc_type_ir
rustc_typeck Auto merge of #97802 - Enselic:add-no_ignore_sigkill-feature, r=joshtriplett 2022-09-02 21:08:08 +00:00