[PATCH 0/1] Fix select() regarding SIGWINCH in console

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

[PATCH 0/1] Fix select() regarding SIGWINCH in console

Takashi Yano
In cygwin test release 3.1.0-0.1, script command (from util-linux)
is terminated abnormaly if the window size is changed in the case
that cygwin is running in command prompt. This patch fixes this
issue.  This problem occurs when select() or poll() returns with
EINTR by SIGWINCH even though SIGWINCH is ignored. This patch adds
code so that select() is not interrupted by SIGWINCH when it is
ignored (SIG_IGN or SIG_DFL).

Takashi Yano (1):
  Cygwin: console: Fix the condition to interrupt select() by SIGWINCH

 winsup/cygwin/select.cc | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

--
2.21.0

Reply | Threaded
Open this post in threaded view
|

[PATCH 1/1] Cygwin: console: Fix the condition to interrupt select() by SIGWINCH

Takashi Yano
- Add code so that select() is not interrupted by SIGWINCH if it is
  ignored (SIG_IGN or SIG_DFL).
---
 winsup/cygwin/select.cc | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/winsup/cygwin/select.cc b/winsup/cygwin/select.cc
index 9cf892801..4e9256b9f 100644
--- a/winsup/cygwin/select.cc
+++ b/winsup/cygwin/select.cc
@@ -1045,7 +1045,9 @@ peek_console (select_record *me, bool)
       else if (!PeekConsoleInputW (h, &irec, 1, &events_read) || !events_read)
  break;
       fh->acquire_input_mutex (INFINITE);
-      if (fhandler_console::input_winch == fh->process_input_message ())
+      if (fhandler_console::input_winch == fh->process_input_message ()
+  && global_sigs[SIGWINCH].sa_handler != SIG_IGN
+  && global_sigs[SIGWINCH].sa_handler != SIG_DFL)
  {
   set_sig_errno (EINTR);
   fh->release_input_mutex ();
--
2.21.0

Reply | Threaded
Open this post in threaded view
|

Re: [PATCH 1/1] Cygwin: console: Fix the condition to interrupt select() by SIGWINCH

Corinna Vinschen-2
On Aug 15 14:03, Takashi Yano wrote:

> - Add code so that select() is not interrupted by SIGWINCH if it is
>   ignored (SIG_IGN or SIG_DFL).
> ---
>  winsup/cygwin/select.cc | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/winsup/cygwin/select.cc b/winsup/cygwin/select.cc
> index 9cf892801..4e9256b9f 100644
> --- a/winsup/cygwin/select.cc
> +++ b/winsup/cygwin/select.cc
> @@ -1045,7 +1045,9 @@ peek_console (select_record *me, bool)
>        else if (!PeekConsoleInputW (h, &irec, 1, &events_read) || !events_read)
>   break;
>        fh->acquire_input_mutex (INFINITE);
> -      if (fhandler_console::input_winch == fh->process_input_message ())
> +      if (fhandler_console::input_winch == fh->process_input_message ()
> +  && global_sigs[SIGWINCH].sa_handler != SIG_IGN
> +  && global_sigs[SIGWINCH].sa_handler != SIG_DFL)
>   {
>    set_sig_errno (EINTR);
>    fh->release_input_mutex ();
> --
> 2.21.0
Do you think a similar workaround would help for the signalfd
problem?


Thanks,
Corinna

--
Corinna Vinschen
Cygwin Maintainer

signature.asc (849 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: [PATCH 1/1] Cygwin: console: Fix the condition to interrupt select() by SIGWINCH

Corinna Vinschen-2
In reply to this post by Takashi Yano
On Aug 15 14:03, Takashi Yano wrote:

> - Add code so that select() is not interrupted by SIGWINCH if it is
>   ignored (SIG_IGN or SIG_DFL).
> ---
>  winsup/cygwin/select.cc | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/winsup/cygwin/select.cc b/winsup/cygwin/select.cc
> index 9cf892801..4e9256b9f 100644
> --- a/winsup/cygwin/select.cc
> +++ b/winsup/cygwin/select.cc
> @@ -1045,7 +1045,9 @@ peek_console (select_record *me, bool)
>        else if (!PeekConsoleInputW (h, &irec, 1, &events_read) || !events_read)
>   break;
>        fh->acquire_input_mutex (INFINITE);
> -      if (fhandler_console::input_winch == fh->process_input_message ())
> +      if (fhandler_console::input_winch == fh->process_input_message ()
> +  && global_sigs[SIGWINCH].sa_handler != SIG_IGN
> +  && global_sigs[SIGWINCH].sa_handler != SIG_DFL)
>   {
>    set_sig_errno (EINTR);
>    fh->release_input_mutex ();
> --
> 2.21.0
Pushed.


Thanks,
Corinna

--
Corinna Vinschen
Cygwin Maintainer

signature.asc (849 bytes) Download Attachment