mirror of
https://github.com/RGBCube/uutils-coreutils
synced 2025-07-27 19:17:43 +00:00
id: Handle NULL pointer gracefully within cstr2cow
macro (#7810)
* id: Handle NULL pointer gracefully within `cstr2cow` macro > getlogin() returns a pointer to a string containing the name of the user logged in on the controlling terminal of the process, or a NULL pointer if this information cannot be determined. Ref: https://linux.die.net/man/3/getlogin * id: Remove redundant std::ffi:: prefix from CStr * id: Add comment for the null check Co-authored-by: Sylvestre Ledru <sylvestre@debian.org> * id: Remove skip for test that should not segfault anymore Segfault fixed by 292fb9242342d47412a789f4d0002b811568bd41 --------- Co-authored-by: Sylvestre Ledru <sylvestre@debian.org>
This commit is contained in:
parent
a4230410c8
commit
6ac444a9c6
2 changed files with 12 additions and 15 deletions
|
@ -152,19 +152,8 @@ fn test_id_real() {
|
|||
fn test_id_pretty_print() {
|
||||
// `-p` is BSD only and not supported on GNU's `id`
|
||||
let username = whoami();
|
||||
|
||||
let result = new_ucmd!().arg("-p").run();
|
||||
if result.stdout_str().trim().is_empty() {
|
||||
// this fails only on: "MinRustV (ubuntu-latest, feat_os_unix)"
|
||||
// `rustc 1.40.0 (73528e339 2019-12-16)`
|
||||
// run: /home/runner/work/coreutils/coreutils/target/debug/coreutils id -p
|
||||
// thread 'test_id::test_id_pretty_print' panicked at 'Command was expected to succeed.
|
||||
// stdout =
|
||||
// stderr = ', tests/common/util.rs:157:13
|
||||
println!("test skipped:");
|
||||
} else {
|
||||
result.success().stdout_contains(username);
|
||||
}
|
||||
result.success().stdout_contains(username);
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue