File tree Expand file tree Collapse file tree
.vscode/cspell.dictionaries Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -102,6 +102,7 @@ multicall
102102nmerge
103103noatime
104104nocache
105+ NOCLDSTOP
105106nocreat
106107noctty
107108noerror
@@ -129,6 +130,7 @@ primality
129130pselect
130131pseudoprime
131132pseudoprimes
133+ pthread
132134quantiles
133135readonly
134136reparse
@@ -144,10 +146,15 @@ setmask
144146setlocale
145147shortcode
146148shortcodes
149+ sigaction
150+ sigaddset
147151siginfo
148152sigmask
149153sigusr
150154sigprocmask
155+ SIGRTMAX
156+ SIGRTMIN
157+ sigset
151158strcasecmp
152159subcommand
153160subexpression
Original file line number Diff line number Diff line change @@ -285,14 +285,17 @@ fn preserve_signal_info(signal: libc::c_int) -> libc::c_int {
285285}
286286
287287#[ cfg( unix) ]
288- #[ allow( clippy:: reversed_empty_ranges) ]
289288fn block_ignored_signals ( ) -> nix:: Result < ( ) > {
290- let mut set = SigSet :: empty ( ) ;
291- let rt_signals = if cfg ! ( target_os = "linux" ) {
289+ # [ cfg ( target_os = "linux" ) ]
290+ fn rt_signals ( ) -> impl Iterator < Item = i32 > {
292291 libc:: SIGRTMIN ( ) ..=libc:: SIGRTMAX ( )
293- } else {
294- 0 ..=( -1 )
295- } ;
292+ }
293+ #[ cfg( not( target_os = "linux" ) ) ]
294+ fn rt_signals ( ) -> impl Iterator < Item = i32 > {
295+ std:: iter:: empty ( )
296+ }
297+
298+ let mut set = SigSet :: empty ( ) ;
296299 for s in Signal :: iterator ( )
297300 . filter_map ( |s| {
298301 if matches ! ( s, Signal :: SIGSTOP | Signal :: SIGKILL | Signal :: SIGTERM ) {
@@ -301,12 +304,12 @@ fn block_ignored_signals() -> nix::Result<()> {
301304 Some ( s as i32 )
302305 }
303306 } )
304- . chain ( rt_signals)
307+ . chain ( rt_signals ( ) )
305308 {
306309 if is_ignored ( s) ? {
307310 // We use raw libc bindings because [`nix`] does not support RT signals.
308311 // SAFETY: SigSet is repr(transparent) over sigset_t.
309- unsafe { libc:: sigaddset ( ( & mut set as * mut SigSet ) . cast ( ) , s) } ;
312+ unsafe { libc:: sigaddset ( ( & raw mut set ) . cast ( ) , s) } ;
310313 }
311314 }
312315 pthread_sigmask ( SigmaskHow :: SIG_BLOCK , Some ( & set) , None )
Original file line number Diff line number Diff line change @@ -164,7 +164,7 @@ ringbuffer = []
164164safe-traversal = [" libc" ]
165165selinux = [" dep:selinux" ]
166166smack = [" xattr" ]
167- signals = []
167+ signals = [" libc " ]
168168sum = [
169169 " digest" ,
170170 " hex" ,
Original file line number Diff line number Diff line change @@ -290,6 +290,9 @@ fn test_cascaded_timeout_with_bash_trap() {
290290}
291291
292292#[ test]
293+ // We have to work around a bug in BSD `sh`. The GNU Test Suite also skips
294+ // this kind of test on the platform for this reason.
295+ #[ cfg( not( any( target_os = "freebsd" , target_os = "openbsd" ) ) ) ]
293296fn test_signal_block_on_ignore ( ) {
294297 let ts = TestScenario :: new ( "timeout" ) ;
295298 let res = ts
@@ -308,6 +311,10 @@ fn test_signal_block_on_ignore() {
308311 . to_string( )
309312 . trim_end_matches( '\n' )
310313 . trim_end_matches( '\r' ) ,
311- "yes: standard output: Broken pipe"
314+ if cfg!( any( target_os = "macos" , target_os = "ios" ) ) {
315+ "yes: stdout: Broken pipe"
316+ } else {
317+ "yes: standard output: Broken pipe"
318+ }
312319 ) ;
313320}
You can’t perform that action at this time.
0 commit comments