all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Danny Milosavljevic <dannym@scratchpost.org>
To: Leo Famulari <leo@famulari.name>
Cc: guix-devel@gnu.org
Subject: SIGINT in guix environment
Date: Sun, 5 Mar 2017 14:23:54 +0100	[thread overview]
Message-ID: <20170305142354.56784c8d@scratchpost.org> (raw)
In-Reply-To: <20170304222326.GA17594@jasmine>

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	other threads:[~2017-03-05 13:24 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-03-04 22:20 [PATCH 0/1] WIP Python 3.6.0 upgrade Leo Famulari
2017-03-04 22:20 ` [PATCH 1/1] WIP: python-3: Update to 3.6.0 Leo Famulari
2017-03-04 22:23 ` [PATCH 0/1] WIP Python 3.6.0 upgrade Leo Famulari
2017-03-05 13:23   ` Danny Milosavljevic [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170305142354.56784c8d@scratchpost.org \
    --to=dannym@scratchpost.org \
    --cc=guix-devel@gnu.org \
    --cc=leo@famulari.name \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/guix.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.