Skip to content

Commit a74ca55

Browse files
committed
fix(stat): fix CI failures
1 parent a58d74b commit a74ca55

4 files changed

Lines changed: 27 additions & 10 deletions

File tree

.vscode/cspell.dictionaries/jargon.wordlist.txt

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,7 @@ multicall
102102
nmerge
103103
noatime
104104
nocache
105+
NOCLDSTOP
105106
nocreat
106107
noctty
107108
noerror
@@ -129,6 +130,7 @@ primality
129130
pselect
130131
pseudoprime
131132
pseudoprimes
133+
pthread
132134
quantiles
133135
readonly
134136
reparse
@@ -144,10 +146,15 @@ setmask
144146
setlocale
145147
shortcode
146148
shortcodes
149+
sigaction
150+
sigaddset
147151
siginfo
148152
sigmask
149153
sigusr
150154
sigprocmask
155+
SIGRTMAX
156+
SIGRTMIN
157+
sigset
151158
strcasecmp
152159
subcommand
153160
subexpression

src/uu/timeout/src/timeout.rs

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff 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)]
289288
fn 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)

src/uucore/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ ringbuffer = []
164164
safe-traversal = ["libc"]
165165
selinux = ["dep:selinux"]
166166
smack = ["xattr"]
167-
signals = []
167+
signals = ["libc"]
168168
sum = [
169169
"digest",
170170
"hex",

tests/by-util/test_timeout.rs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff 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")))]
293296
fn 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
}

0 commit comments

Comments
 (0)