guix-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

SIGINT in guix environment


From: Danny Milosavljevic
Subject: SIGINT in guix environment
Date: Sun, 5 Mar 2017 14:23:54 +0100

Hi Leo,

>'test_regrtest_sigint'] failed with exit code 0

>print('pdb %d: %s' % (i, sess._previous_sigint_handler))

That's strange. I've tried to enable Rust tests and there, too, is a problem 
with SIGINT (that's the ONLY failing test remaining for my version of Rust 
(which only patches "/bin/sh" out of all tests)):

Test failure:
    sys::imp::process::process_common::tests::test_process_mask
thread '<unnamed>' panicked at 'assertion failed: ret == 0', 
src/libstd/sys/unix/process/process_common.rs:474

Which is:

    // See #14232 for more information, but it appears that signal delivery to a
    // newly spawned process may just be raced in the OSX, so to prevent this
    // test from being flaky we ignore it on OSX.
    #[test]
    #[cfg_attr(target_os = "macos", ignore)]
    #[cfg_attr(target_os = "nacl", ignore)] // no signals on NaCl.
    fn test_process_mask() {
        unsafe {
            // Test to make sure that a signal mask does not get inherited.
            let mut cmd = Command::new(OsStr::new("cat"));

            let mut set: libc::sigset_t = mem::uninitialized();
            let mut old_set: libc::sigset_t = mem::uninitialized();
            t!(cvt(libc::sigemptyset(&mut set)));
            t!(cvt(sigaddset(&mut set, libc::SIGINT)));
            t!(cvt(libc::pthread_sigmask(libc::SIG_SETMASK, &set, &mut 
old_set)));

            cmd.stdin(Stdio::MakePipe);
            cmd.stdout(Stdio::MakePipe);

            let (mut cat, mut pipes) = t!(cmd.spawn(Stdio::Null, true));
            let stdin_write = pipes.stdin.take().unwrap();
            let stdout_read = pipes.stdout.take().unwrap();

            t!(cvt(libc::pthread_sigmask(libc::SIG_SETMASK, &old_set,
                                         ptr::null_mut())));

            t!(cvt(libc::kill(cat.id() as libc::pid_t, libc::SIGINT))); 
<-----------------
            // We need to wait until SIGINT is definitely delivered. The
            // easiest way is to write something to cat, and try to read it
            // back: if SIGINT is unmasked, it'll get delivered when cat is
            // next scheduled.
            let _ = stdin_write.write(b"Hello");
            drop(stdin_write);

            // Either EOF or failure (EPIPE) is okay.
            let mut buf = [0; 5];
            if let Ok(ret) = stdout_read.read(&mut buf) {
                assert!(ret == 0); <----------------------- fails
            }

            t!(cat.wait());
        }
    }


The "cat" process that had been invoked should have been interrupted and the 
reading from the pipe (at the bottom of the source code above) should have 
failed - but  it didn't fail. ret is the number of bytes read from the pipe. 
(it would have expected 0 but didn't get that)

Huh...



reply via email to

[Prev in Thread] Current Thread [Next in Thread]