Skip to content

Commit 8bc4de7

Browse files
committed
Remove broken test
The test calls libc::getpid() in the pre_exec hook and asserts that the returned value is different from the PID of the parent. However, libc::getpid() returns the wrong value. Before version 2.25, glibc caches the PID of the current process with the goal of avoiding additional syscalls. The cached value is only updated when the wrapper functions for fork or clone are called. In PR rust-lang#81825 we switch to directly using the clone3 syscall. Thus, the cache is not updated and getpid returns the PID of the parent. source: https://man7.org/linux/man-pages/man2/getpid.2.html#NOTES
1 parent 58c1352 commit 8bc4de7

File tree

1 file changed

+0
-18
lines changed

1 file changed

+0
-18
lines changed

src/test/ui/command/command-pre-exec.rs

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -66,24 +66,6 @@ fn main() {
6666
};
6767
assert_eq!(output.raw_os_error(), Some(102));
6868

69-
let pid = unsafe { libc::getpid() };
70-
assert!(pid >= 0);
71-
let output = unsafe {
72-
Command::new(&me)
73-
.arg("empty")
74-
.pre_exec(move || {
75-
let child = libc::getpid();
76-
assert!(child >= 0);
77-
assert!(pid != child);
78-
Ok(())
79-
})
80-
.output()
81-
.unwrap()
82-
};
83-
assert!(output.status.success());
84-
assert!(output.stderr.is_empty());
85-
assert!(output.stdout.is_empty());
86-
8769
let mem = Arc::new(AtomicUsize::new(0));
8870
let mem2 = mem.clone();
8971
let output = unsafe {

0 commit comments

Comments
 (0)