[PATCH] Cygwin: console: Fix issues of apps which open pty.

2022-02-26 Thread Takashi Yano
- After some recent changes for special keys handling break the apps which open pty (such as script command). If the app which opens pty is executed in console, the following issues occur. 1) If the script command was started from non-cygwin shell (such as cmd.exe), another cygwin ap

[PATCH] Cygwin: pty: Stop to send CTRL_C_EVENT if pcon activated.

2022-02-26 Thread Takashi Yano
- The commit "Cygwin: console: Redesign handling of special keys." removes special treatment for pty in with pseudo console activated, however, it is necessary on second thought. This is because sending CTRL_C_EVENT to non-cygwin apps will be done in pseudo console, therefore, sending it in

[PATCH] Cygwin: console: Prevent the order of typeahead input from swapped.

2022-02-26 Thread Takashi Yano
- If a lot of keys are typed very quickly in the app which does not read console, the order of input keys in console input buffer occasionally swapped. Although this extremely rarely happens, is obviously a bug of cons_master_thread. This patch fixes the issue. --- winsup/cygwin/fhandler_c

Re: [PATCH] Cygwin: pty, console: Refactor the code processing special keys.

2022-02-26 Thread Takashi Yano
Hi Johannes, Thank you for the comment. On Fri, 25 Feb 2022 14:37:59 +0100 (CET) Johannes Schindelin wrote: > Hi Takashi, > > On Sun, 20 Feb 2022, Takashi Yano wrote: > > > - This patch commonize the code which processes special keys in pty > > and console to improve maintanancibility. > > I

[PATCH] Cygwin: console: Revert experimental code mixed accidentally.

2022-02-26 Thread Takashi Yano
- The commit "Cygwin: console: Restore CTRL_BREAK_EVENT handling." was accidentally mixed with experimental code in exceptions.cc. Due to this, non-cygwin app receives CTRL_C_EVENT twice in the following scenario. 1) Run 'sleep 10 | ' 2) Hit Ctrl-C. 3) The non-cygwin app receives CTR

[PATCH 0/2] Drop pointless loadlib.h use in utilities

2022-02-26 Thread Jon Turney
The only remaining uses of loadlib.h are in cygcheck and strace, where it's used to load cygwin1.dll in both. Things could be further simplified, but it's probably worth keeping it around in it's present form since it's quite likely that LoadLibrary()/GetProcAddress() might be used again in future

[PATCH 1/2] Cygwin: Drop pointless loadlib.h includes in utilities

2022-02-26 Thread Jon Turney
These utilities used to LoadLibrary()/GetProcAddress(), but don't anymore. --- winsup/utils/cygpath.cc | 1 - winsup/utils/module_info.cc | 1 - winsup/utils/path.cc| 1 - winsup/utils/ps.cc | 1 - 4 files changed, 4 deletions(-) diff --git a/winsup/utils/cygpath.cc b/winsup/

[PATCH 2/2] Cygwin: Drop use of loadlib.h in regtool

2022-02-26 Thread Jon Turney
Link directly with RegDeleteKeyExW(), available since Vista. (It's unclear the LoadLibrary wrapper was ever doing anything useful here, as (i) DLL lookup in PATH was avoided as advapi32 is already loaded into the process, and (ii) advapi32 is a 'known DLL' which is only ever loaded from system dir

[PATCH v2] Cygwin: pinfo: Fix exit code for non-cygwin apps which reads console.

2022-02-26 Thread Takashi Yano
- The recent commit "Cygwin: pinfo: Fix exit code when non-cygwin app exits by Ctrl-C." did not fix enough the issue. If a non-cygwin app is reading the console, it will not return STATUS_CONTROL_C_EXIT even if it is terminated by Ctrl-C. As a result, the previous patch does not take effect

[PATCH] Cygwin: console: Correct the past fix for apps which open pty.

2022-02-26 Thread Takashi Yano
- The commit "Cygwin: console: Fix issues of apps which open pty." did not fix the second problem correctly. That commit looked to fix the issue, but the actual problem was that ctrl_c_handler() should be reregistered *AFTER* FreeConsole()/AttachConsole(). This patch correct that. --- wins