public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
From: Takashi Yano <takashi.yano@nifty.ne.jp>
To: cygwin@cygwin.com
Subject: Re: [ANNOUNCEMENT] TEST: Cygwin 3.1.0-0.1
Date: Mon, 12 Aug 2019 13:44:00 -0000	[thread overview]
Message-ID: <20190812224403.37e4ccfdcfb7046ed70fef16@nifty.ne.jp> (raw)
In-Reply-To: <announce.20190809185338.GZ11632@calimero.vinschen.de>

[-- Attachment #1: Type: text/plain, Size: 1343 bytes --]

Hi Corinna,

On Fri, 9 Aug 2019 20:53:38 +0200
Corinna Vinschen <corinna-cygwin@cygwin.com> wrote:

> Hi folks,
> 
> 
> I uploaded a new Cygwin test release 3.1.0-0.1
> 
> This release comes with a couple of new features and quite a few
> bug fixes.
> 
> The most interesting change, courtesy Ken Brown, is a revamp of the
> old FIFO code.  It should now be possible to open FIFOs multiple times
> for writing, something the old code failed on.
> 
> 
> Please test.

I tested this test release, and found a few problems.

(1) The cursor position is not restored correctly after screen
    alternation in the case of xterm compatible mode is enabled.
(2) fork() on console ocasionally falls into deadlock.
(3) Horizontal tab setting on console is broken after resizing
    console window if xterm compatible mode is enabled.
(4) Segmentation fault occurs in some cases regarding signalfd.

I will propose patches for (1),(2) and (3) in the other posts.

However, I can not find out the cause of problem (4). This seems
to affect only 32bit version of cygwin.

To reproduce (4), use a simple test case attached (signalfd-chk.c).
Compile it and execute, then type 'q' or '^C' to stop it.
This causes segmentation fault.

I am not sure why, but, the patch attached (signalfd-segfault.diff)
resolves the problem (4).

Could you please have a look?

[-- Attachment #2: signalfd-chk.c --]
[-- Type: text/x-csrc, Size: 1298 bytes --]

#include <stdio.h>
#include <unistd.h>
#include <poll.h>
#include <termios.h>
#include <sys/signalfd.h>
#include <sys/wait.h>

int run()
{
	struct termios tt;
	sigset_t sigset;
	pid_t pid;
	struct pollfd pfd[2];
	int running = 1;

	tcgetattr(STDIN_FILENO, &tt);
	tt.c_lflag &= ~(ECHO|ICANON|ISIG);
	tcsetattr(STDIN_FILENO, TCSANOW, &tt);

	pid = fork();
	if (pid == 0) {
		/* Child */
		usleep(100000);
		return 0;
	}
	printf("Start: %d\n", pid);

	sigemptyset(&sigset);
	sigaddset(&sigset, SIGCHLD);
	sigprocmask(SIG_BLOCK, &sigset, NULL);

	pfd[0].fd = STDIN_FILENO;
	pfd[0].events = POLLIN;
	pfd[1].fd = signalfd(-1, &sigset, 0);
	pfd[1].events = POLLIN;

	do {
		poll(pfd, 2, -1);
		if (pfd[0].revents & POLLIN) {
			char c;
			int ret = read(pfd[0].fd, &c, 1);
			if (ret == 0 || c == 'q' || c == '\003') {
				running = 0;
				break;
			}
		}
		if (pfd[1].revents & POLLIN) {
			struct signalfd_siginfo info;
			int ret = read(pfd[1].fd, &info, sizeof(info));
			if (ret) printf("Signal: %d\r\n", info.ssi_signo);
			if (info.ssi_signo == SIGCHLD) break;
		}
	} while (1);
	waitpid(pid, NULL, 0);
	printf("End: %d\n", pid);

	tcgetattr(STDIN_FILENO, &tt);
	tt.c_lflag |= ECHO|ICANON|ISIG;
	tcsetattr(STDIN_FILENO, TCSANOW, &tt);

	return running;
}

int main()
{
	while (run());
	return 0;
}

[-- Attachment #3: signalfd-segfault.diff --]
[-- Type: text/plain, Size: 408 bytes --]

diff --git a/winsup/cygwin/select.cc b/winsup/cygwin/select.cc
index 1bb143a23..91c0bcc53 100644
--- a/winsup/cygwin/select.cc
+++ b/winsup/cygwin/select.cc
@@ -1887,7 +1887,7 @@ thread_signalfd (void *arg)
       switch (WaitForSingleObject (si->evt, INFINITE))
 	{
 	case WAIT_OBJECT_0:
-	  tls->signalfd_select_wait = NULL;
+	  //tls->signalfd_select_wait = NULL;
 	  event = true;
 	  break;
 	default:


[-- Attachment #4: Type: text/plain, Size: 219 bytes --]


--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

  parent reply	other threads:[~2019-08-12 13:44 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-08-09 18:55 Corinna Vinschen
2019-08-11  7:28 ` Thorsten Kampe
2019-08-12 13:01   ` Corinna Vinschen
2019-08-12 19:44     ` Takashi Yano
2019-08-13 22:27       ` Thorsten Kampe
2019-08-13 21:45     ` Thorsten Kampe
2019-08-13 21:51       ` Thorsten Kampe
2019-08-14  7:23         ` Takashi Yano
2019-08-12 13:44 ` Takashi Yano [this message]
2019-08-12 15:36   ` Corinna Vinschen
2019-08-13 10:48     ` Corinna Vinschen
2019-08-14 11:41       ` Takashi Yano
2019-08-14 11:47         ` Takashi Yano
2019-08-14 13:49           ` Corinna Vinschen
2019-08-14 19:21             ` Takashi Yano
2019-08-15  7:49               ` Corinna Vinschen
2019-08-15 10:36                 ` Corinna Vinschen
2019-08-15 15:04                   ` Corinna Vinschen
2019-08-15 15:09                     ` Corinna Vinschen
2019-08-16 14:58                       ` Corinna Vinschen
2019-08-17 16:59                         ` Takashi Yano
2019-08-18 12:07                           ` Corinna Vinschen
2019-08-18 12:08 ` Achim Gratz
2019-08-18 14:29   ` Corinna Vinschen
2019-08-18 14:51     ` Achim Gratz
2019-08-19  8:56       ` Corinna Vinschen

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=20190812224403.37e4ccfdcfb7046ed70fef16@nifty.ne.jp \
    --to=takashi.yano@nifty.ne.jp \
    --cc=cygwin@cygwin.com \
    /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.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).