Closed
Description
I tried this code:
let name = "a".repeat(1024);
thread::Builder::new()
.name(name)
.spawn(|| {
println!("it works!");
})
.unwrap()
.join()
.unwrap();
I expected to see this happen: "it works" is printed
Instead, this happened: the program panicked due to this debug assertion
rust/library/std/src/sys/unix/thread.rs
Lines 176 to 188 in 180dffb
According to the QNX documentation the maximum length a thread name can have is _NTO_THREAD_NAME_MAX
. The NTO implementation of this function should truncate the thread name like, for example, the Linux implementation does. I'll submit a fix.
Meta
I used the x86_64-pc-nto-qnx710
compilation target.
rustc --version --verbose
:
rustc 1.73.0-nightly (180dffba1 2023-08-14)
binary: rustc
commit-hash: 180dffba142c47240ca0d93096ce90b9fd97c8d7
commit-date: 2023-08-14
host: x86_64-unknown-linux-gnu
release: 1.73.0-nightly
LLVM version: 17.0.0
Not including a backtrace because all the reported functions in the backtrace were <unknown>