From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 7868) id 059BF3858D1E; Thu, 22 Dec 2022 11:51:13 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 059BF3858D1E DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1671709873; bh=m4Ue9GJT4242IhZc5yH2RfdznYQ35dagTtuyAYagYm4=; h=From:To:Subject:Date:From; b=m/o4swTTumxDMFQ1idznbFLfTV5s3gkWjhVWBLtZFLX1A85jgAv1Qs0cchhQLHyPU V8H+CzffC2/Q3Kt23hhBUNZTYgvbnBQk3zgxhooWF+DSyDR1RkGcsJz2vJfIalBHLi ePuQiiWygwLYC4KzMuHm6O4edhUTtZl9tHyHy2eg= Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable From: Takashi Yano To: cygwin-cvs@sourceware.org Subject: [newlib-cygwin/cygwin-3_4-branch] Cygwin: console: Fix hangup of less on quit after the window is resized. X-Act-Checkin: newlib-cygwin X-Git-Author: Takashi Yano X-Git-Refname: refs/heads/cygwin-3_4-branch X-Git-Oldrev: aad4a9484ad2cb2d3d496cf9ddd04c8cc4811935 X-Git-Newrev: 76e1edeb27a573a955ebf3ae5a7a7fd1a75b290f Message-Id: <20221222115113.059BF3858D1E@sourceware.org> Date: Thu, 22 Dec 2022 11:51:13 +0000 (GMT) List-Id: https://sourceware.org/git/gitweb.cgi?p=3Dnewlib-cygwin.git;h=3D76e1edeb27a= 573a955ebf3ae5a7a7fd1a75b290f commit 76e1edeb27a573a955ebf3ae5a7a7fd1a75b290f Author: Takashi Yano Date: Thu Dec 22 20:25:22 2022 +0900 Cygwin: console: Fix hangup of less on quit after the window is resized. =20 https://cygwin.com/pipermail/cygwin/2022-December/252737.html =20 If the less is started from non-cygwin shell and window size is changed, it will hang-up when quitting. The cause of the proglem is that less uses longjump() in signal handler. If the signal handler is called while cygwin is acquiring the mutex, cygwin loses the chance to release mutex. With this patch, the mutex is released just before calling kill_pgrp() and re-acquired when kill_pgrp() returns. =20 Reported-by: Gregory Mason Signed-off-by: Takashi Yano Diff: --- winsup/cygwin/fhandler/console.cc | 4 ++++ winsup/cygwin/release/3.4.4 | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/winsup/cygwin/fhandler/console.cc b/winsup/cygwin/fhandler/con= sole.cc index a4a367005..bfcdb84b3 100644 --- a/winsup/cygwin/fhandler/console.cc +++ b/winsup/cygwin/fhandler/console.cc @@ -939,7 +939,11 @@ fhandler_console::send_winch_maybe () if (wincap.has_con_24bit_colors () && !con_is_legacy && wincap.has_con_broken_tabs ()) fix_tab_position (get_output_handle ()); + /* longjmp() may be called in the signal handler like less, + so release input_mutex temporarily before kill_pgrp(). */ + release_input_mutex (); get_ttyp ()->kill_pgrp (SIGWINCH); + acquire_input_mutex (mutex_timeout); return true; } return false; diff --git a/winsup/cygwin/release/3.4.4 b/winsup/cygwin/release/3.4.4 index 6ac702375..3331b3166 100644 --- a/winsup/cygwin/release/3.4.4 +++ b/winsup/cygwin/release/3.4.4 @@ -3,3 +3,7 @@ Bug Fixes =20 - Fix an uninitialized variable having weird side-effects in path handling. Addresses: https://cygwin.com/pipermail/cygwin/2022-December/252734.html + +- Fix hang-up of less on quit which occurs when it is started from non-cyg= win + shell and window is resized. + Addresses: https://cygwin.com/pipermail/cygwin/2022-December/252737.html