From mboxrd@z Thu Jan 1 00:00:00 1970 From: Danny Milosavljevic Subject: SIGINT in guix environment Date: Sun, 5 Mar 2017 14:23:54 +0100 Message-ID: <20170305142354.56784c8d@scratchpost.org> References: <20170304222326.GA17594@jasmine> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:49654) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ckW8q-0005qZ-Di for guix-devel@gnu.org; Sun, 05 Mar 2017 08:24:05 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ckW8n-0001yj-7g for guix-devel@gnu.org; Sun, 05 Mar 2017 08:24:04 -0500 Received: from dd1012.kasserver.com ([85.13.128.8]:50450) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1ckW8n-0001yf-12 for guix-devel@gnu.org; Sun, 05 Mar 2017 08:24:01 -0500 In-Reply-To: <20170304222326.GA17594@jasmine> List-Id: "Development of GNU Guix and the GNU System distribution." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-devel-bounces+gcggd-guix-devel=m.gmane.org@gnu.org Sender: "Guix-devel" To: Leo Famulari Cc: guix-devel@gnu.org 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 '' 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...