aboutsummaryrefslogtreecommitdiff
AgeCommit message (Collapse)AuthorFilesLines
2022-08-12newlocale: fix crash when trying to write to __C_localecygwin-3_3_6-releaseCorinna Vinschen2-1/+5
This simple testcase: locale_t st = newlocale(LC_ALL_MASK, "C", (locale_t)0); locale_t st2 = newlocale(LC_CTYPE_MASK, "en_US.UTF-8", st); is sufficient to reproduce a crash in _newlocale_r. After the first call to newlocale, `st' points to __C_locale, which is const. When using `st' as locale base in the second call, _newlocale_r tries to set pointers inside base to NULL. This is bad if base is __C_locale, obviously. Add a test to avoid trying to overwrite pointer values inside base if base is __C_locale. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2022-08-10Cygwin: fix return value of symlink_info::checkKen Brown2-13/+13
Currently it is possible for symlink_info::check to return -1 in case we're searching for foo and find foo.lnk that is not a Cygwin symlink. This contradicts the new meaning attached to a negative return value in commit 19d59ce75d. Fix this by setting "res" to 0 at the beginning of the main loop and not seting it to -1 later. Also fix the commentary preceding the function definition to reflect the current behavior. Addresses: https://cygwin.com/pipermail/cygwin/2022-August/252030.html
2022-08-05Cygwin: pty: Fix a small bug in is_console_app().Takashi Yano1-1/+1
- Previsouly, there was potential risk of buffer over run in is_console_app(). This patch fixes the issue.
2022-08-03Cygwin: path: Make some symlinks to /cygdrive/* work.Takashi Yano2-1/+9
- Previously, some symbolic links to /cygdrive/* (e.g. /cygdrive/C, /cygdrive/./c, /cygdrive//c, etc.) did not work. This patch fixes the issue. Addresses: https://cygwin.com/pipermail/cygwin/2022-July/251994.html
2022-08-02Cygwin: console: Modify ConEmu cygwin connector hook.Takashi Yano1-15/+6
- Previously, LoadLibraryA() is hooked for ConEmu cygwin connector. With this patch, GetProcAddress() for "RequestTermConnector" is hooked instead which is more essential for ConEmu cygwin connector.
2022-07-31Cygwin: pty: Treat *.bat and *.cmd as a non-cygwin console app.Takashi Yano2-1/+11
- If *.bat or *.cmd is executed directly from cygwin shell, pty failed to switch I/O pipe to that for native apps. This patch fixes the issue.
2022-07-29Cygwin: console: Avoid accessing NULL pointer via cygheap->ctty.Takashi Yano2-9/+15
- Recent commit "Cygwin: console: Add missing input_mutex guard." has a problem that causes NULL pointer access if cygheap->ctty is NULL. This patch fixes the issue.
2022-07-28Cygwin: console: Add workaround for ConEmu cygwin connector.Takashi Yano1-0/+33
- ConEmu cygwin connector conflicts with cons_master_thread since it does not use read() to read console input. With this patch, cons_master_thread is disabled in ConEmu cygwin connector.
2022-07-28Cygwin: console: Add missing input_mutex guard.Takashi Yano2-6/+18
- Setting con.disable_master_thread flag should be guarded by input_mutex, however, it was not. This patch fixes that.
2022-07-09Cygwin: clipboard: Add workaround for setting clipboard failure.Takashi Yano1-13/+34
- OpenClipboard() just after CloseClipboard() sometimes fails. Due to this, /dev/clipboard sometimes fails to set CF_UNICODETEXT data. This patch add a workaround for this issue.
2022-07-09Cygwin: console: Fix an issue which causes when realloc() fails.Takashi Yano1-5/+13
2022-07-05Cygwin: console: Fix issue of pasting very long text input again.Takashi Yano1-22/+65
- The recent commit "Cygwin: console: Allow pasting very long text input." did not fix the issue enough. This patch adds fixes for that.
2022-07-03Cygwin: console: Fix new bugs in cons_master_thread().Takashi Yano1-8/+9
- The previous commit for console introduced new bugs in error handling in cons_master_thread(). This patch fixes that.
2022-07-02Cygwin: console: Allow pasting very long text input.Takashi Yano5-27/+112
- Currently, if the text longer than 1024 byte is pasted in console, some of the text is discarded. This patch fixes the issue. Addresses: https://cygwin.com/pipermail/cygwin/2022-June/251764.html
2022-06-27Cygwin: poll: Fix a bug on inquiring same fd with different events.Takashi Yano2-3/+10
- poll() has a bug that it returns event which is not inquired if events are inquired in multiple pollfd entries on the same fd at the same time. This patch fixes the issue. Addresses: https://cygwin.com/pipermail/cygwin/2022-June/251732.html
2022-06-19Cygwin: console: Handle setting very long window title correctly.Takashi Yano2-24/+69
- Previously, the console code could not handle escape sequence setting window title longer than 256 byte correctly. This patch fixes the issue. Addresses: https://cygwin.com/pipermail/cygwin/2022-June/251662.html
2022-06-14Cygwin: console: Retain ENABLE_VIRTUAL_TERMIANL_PROCESSING flag.Takashi Yano2-0/+5
- Currently, ENABLE_VIRTUAL_TERMINAL_PROCESSING flag is disabled unconditionally when exiting from cygwin. This causes ANSI escape sequence disabled in Windows Terminal where it is enables by default. This patch retains that flag if it is originally enabled.
2022-05-29Cygwin: document last bug fixKen Brown1-0/+4
2022-05-28Cygwin: cygheap: Fix the issue of cygwin1.dll in the root directory.Takashi Yano1-0/+5
- After the commit 6d898f43, cygwin fails to start if cygwin1.dll is placed in the root directory. This patch fixes the issue. Addresses: https://cygwin.com/pipermail/cygwin/2022-May/251548.html
2022-05-25Cygwin: fix mknod (64-bit only)Ken Brown2-0/+7
The current definition of mknod in syscalls.cc has a third argument of type __dev16_t instead of dev_t. Fix this on 64-bit Cygwin by making the existing mknod 32-bit only and then exporting mknod as an alias for mknod32. (No fix is needed on 32-bit because mknod is redirected to mknod32 via NEW_FUNCTIONS in Makefile.am.) Addresses: https://cygwin.com/pipermail/cygwin-developers/2022-May/012589.html
2022-05-19Cygwin: make sure exec'ed process exists early in process listCorinna Vinschen3-9/+16
killpg(pgid, 0) (or kill_pgrp(pgid, si_signo=0), in signal.cc) fails (returns -1) even when there is a process in the process group pgid, if the process is in the middle of spawnve(), see https://cygwin.com/pipermail/cygwin/2022-May/251479.html When exec'ing a process the assumption is that the exec'ed process creates its own symlink (in pinfo::thisproc() in pinfo.cc). If the exec'ing process calls NtClose on it's own winpid symlink, but the exec'ed process didn't progress enough into initialization, there's a slim chance that neither the exec'ing process, nor the exec'ed process has a winpid symlink attached. Always create the winpid symlink in spawn.cc, even for exec'ed Cygwin processes. Make sure to dup the handle into the new process, and stop creating the winpid symlink in exec'ed processes. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2022-05-16Cygwin: add 3.3.6 release notesTakashi Yano1-0/+5
2022-05-16Cygwin: belatedly, bump DLL version to 3.3.6Corinna Vinschen1-1/+1
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2022-05-15Cygwin: pty: Fix script command crash on console in Win7.Takashi Yano6-4/+91
- Previously, the command "cmd /c script -c cmd" in console of Win7 crashes. This seems to be due to a bug (?) of AttachConsole(). This patch adds workaround for this issue. Currently, pty reattaches to the console of the process which is predetermined by ConsoleProcessList() after temporarily attaching to another console. After that, the console output handle opened with the name "CONOUT$" may not be accessible in Win7 or Vista. This seems to happen when the attached process does not have the same handle even if the console attached is the same. With this patch, cygwin-console-helper which is started when pty master is opened in console, is utilized to be a target process to which pty reattaches if the OS is Win7 or Vista.
2022-05-09Cygwin: pty: Avoid script command crash in console.cygwin-3_3_5-releaseTakashi Yano1-4/+2
- Previously, script command sometimes crashes by Ctrl-C in Win 7 if it is running in console, and non-cygwin app is foreground. This patch fixes the issue.
2022-05-09Cygwin: pty: Not to change code page of parent console.Takashi Yano1-1/+1
- The recent commit "Cygwin: pty: Fix timing of creating invisible console." breaks the feature added by commit 72770148, which prevents pty from changing code page of parent console. This patch restores that.
2022-05-09Cygwin: pty: Add missing attach_mutex guard.Takashi Yano1-0/+2
2022-05-09Cygwin: pty: Avoid deadlock when pcon is started on console.Takashi Yano3-10/+14
- Previously, "env SHELL=cmd script" command in console caused deadlock when starting cmd.exe. This patch fixes the issue.
2022-05-08Cygwin: pty: Change the condition to send Ctrl-C event.Takashi Yano1-6/+3
- Previously, non-cygwin app started by "script -c <non-cygwin app>" receives Ctrl-C twice. This patch fixes the issue.
2022-05-08Cygwin: pty: Fix timing of creating invisible console.Takashi Yano1-1/+2
- Previously, invisible console was created in fixup_after_exec(). However, actually this should be done in fixup_after_fork(). this patch fixes the issue.
2022-05-08Cygwin: pty: Fix acquiring attach_mutex timing.Takashi Yano2-7/+7
- When temporarily attaching a console, the timing of acquiring attach_mutex was not appropriate. This sometimes caused master forwarding thread to crash on Ctrl-C in Windows 7. This patch fixes the issue.
2022-05-05Cygwin: sigproc: Avoid segfault caused by signal just after fork().Takashi Yano1-2/+2
- The commit "Cygwin: always add sigmask to child info" also tries to fix this issue, however, did not fix enough. This patch fixes that.
2022-05-05Cygwin: always add sigmask to child infoCorinna Vinschen3-7/+18
Even after fork, we might need the parent sigmask without having access to the real _main_tls. There's a short time at process startup, when _main_tls points to the system-allocated stack, but wait_sig is already running. If we can't lock _main_tls, because find_tls can't find it yet, we now access the parent's sigmask via child_info. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2022-04-28Cygwin: Fix typo KERB_S4U_LOGON_FLAG_IDENTITY -> IDENTIFYJon Turney1-2/+2
(cherry picked from commit 01c734b0d7c1ce0f848f7efc091856c58a6ef55e)
2022-04-28Cygwin: Fix build with w32api 10.0.0Jon Turney1-2/+5
> ../../../../src/winsup/cygwin/sec_auth.cc:1240:16: error: redefinition of ‘struct _MSV1_0_S4U_LOGON’ > 1240 | typedef struct _MSV1_0_S4U_LOGON > | ^~~~~~~~~~~~~~~~~ > In file included from ../../../../src/winsup/cygwin/ntsecapi.h:10, > from ../../../../src/winsup/cygwin/sec_auth.cc:13: > /usr/include/w32api/ntsecapi.h:1425:18: note: previous definition of ‘struct _MSV1_0_S4U_LOGON’ > 1425 | typedef struct _MSV1_0_S4U_LOGON { > | ^~~~~~~~~~~~~~~~~ > ../../../../src/winsup/cygwin/sec_auth.cc:1246:3: error: conflicting declaration ‘typedef int MSV1_0_S4U_LOGON’ > 1246 | } MSV1_0_S4U_LOGON, *PMSV1_0_S4U_LOGON; > | ^~~~~~~~~~~~~~~~ > In file included from ../../../../src/winsup/cygwin/ntsecapi.h:10, > from ../../../../src/winsup/cygwin/sec_auth.cc:13: > /usr/include/w32api/ntsecapi.h:1430:5: note: previous declaration as ‘typedef struct _MSV1_0_S4U_LOGON MSV1_0_S4U_LOGON’ > 1430 | } MSV1_0_S4U_LOGON, *PMSV1_0_S4U_LOGON; > | ^~~~~~~~~~~~~~~~ > ../../../../src/winsup/cygwin/sec_auth.cc:1246:22: error: conflicting declaration ‘typedef int* PMSV1_0_S4U_LOGON’ > 1246 | } MSV1_0_S4U_LOGON, *PMSV1_0_S4U_LOGON; > | ^~~~~~~~~~~~~~~~~ > In file included from ../../../../src/winsup/cygwin/ntsecapi.h:10, > from ../../../../src/winsup/cygwin/sec_auth.cc:13: > /usr/include/w32api/ntsecapi.h:1430:24: note: previous declaration as ‘typedef struct _MSV1_0_S4U_LOGON* PMSV1_0_S4U_LOGON’ > 1430 | } MSV1_0_S4U_LOGON, *PMSV1_0_S4U_LOGON; (cherry picked from commit 0b44b06b0544511bc22352dcff95a216f766f582)
2022-04-27Cygwin: Fix "0x0x" in gmondump and ssp man pagesMark Geisert2-3/+3
A recent patch fixed gmondump to stop printing "0x0x" as an address prefix. It turns out the Cygwin User's Guide and the gmondump and ssp man pages (all from utils.xml) have examples of the same error.
2022-04-18Cygwin: pty: Fix Ctrl-C behaviour in latest GDB.Takashi Yano1-1/+3
- In the latest GDB (11.2-1), Ctrl-C behaviour is broken a bit for non-cygwin inferior. For example, Ctrl-C on GDB prompt is not sent to GDB but to the inferior. This patch fixes the issue.
2022-04-18Cygwin: pty: Fix deadlock caused by Ctrl-C in setup_pseudoconsole().Takashi Yano1-0/+4
- If Ctrl-C is pressed just after setup_pseudoconsole() is called, mintty stops to respond a while when CPU load is high. This patch fixes the issue. Addresses: https://cygwin.com/pipermail/cygwin/2022-April/251272.html
2022-04-11Cygwin: pty: Do not set internal handles in HPCON inheritable.Takashi Yano1-4/+4
- The internal handles in HPCON should not be inheritable, however, the current code duplicates them as inheritable when handing over ownership of the pseudo console. This patch fixes the issue. Addresses: https://cygwin.com/pipermail/cygwin/2022-April/251222.html
2022-04-09Cygwin: pty: Close pseudo console only if the process is the owner.Takashi Yano1-1/+2
- Currently, close_pseudoconsole() is called unconditionally from fhandler_termios::process_sigs() on Ctrl-C. This causes deadlock if Ctrl-C is pressed while setup_pseudoconsole() is called. With this patch, close_pseudoconsole() is called only if the master process is the owner of the nat-pipe to avoid the deadlock.
2022-04-02Cygwin: pipe: Avoid deadlock for non-cygwin writer.Takashi Yano6-2/+77
- As mentioned in commit message of the commit b531d6b0, if multiple writers including non-cygwin app exist, the non-cygwin app cannot detect pipe closure on the read side when the pipe is created by system account or the the pipe creator is running as service. This is because query_hdl which is held in write side also is a read end of the pipe, so the pipe is still alive for the non-cygwin app even after the reader is closed. To avoid this problem, this patch lets all processes in the same process group close query_hdl using newly introduced internal signal __SIGNONCYGCHLD when non-cygwin app is started. Addresses: https://cygwin.com/pipermail/cygwin/2022-March/251097.html
2022-03-30Cygwin: pty: Fix crash on master close in Windows 7.Takashi Yano2-1/+4
- The 4th parameter of WriteFile() cannot be NULL especially in Windows 7 as mentioned in Microsoft documentation. This patch fixes that. Addresses: https://cygwin.com/pipermail/cygwin/2022-March/251162.html
2022-03-19Cygwin: console: Do not use memcmp() to compare INPUT_RECORD.Takashi Yano1-3/+38
- Using memcmp() to compare structure such as INPUT_RECORD is not correct manner because padding may not be initialized. This patch stops to use memcmp() for comparison of INPUT_RECORD.
2022-03-19Cygwin: console: Ignore dwControlKeyState in event comparison.Takashi Yano1-3/+3
- dwControlKeyState also may be null'ed on WriteConsoleInputW(). Therefore ignore it in event comparison as well as wVirtualKeyCode and wVirtualScanCode.
2022-03-18Cygwin: console: Add attach_mutex guard that was not added.Takashi Yano1-0/+2
2022-03-18Cygwin: console: Fix typeahead key swapping which still occurs.Takashi Yano1-20/+38
- The commit "Cygwin: console: Improve the code to avoid typeahead key swapping." did not solve the problem enough. Two unexpected things happen. (1) wVirtualKeyCode and wVirtualScanCode of readback key event may be null'ed even if they are not zero on WriteConsoleInputW(). Therefore, memcmp() may report the event sequence is not equal. (2) WriteConsoleInputW() may not be atomic. The event sequence which is written by WriteConsoleInputW() may be inserted by key input in the middle of the sequence. Current code gives up to fix in this situation. This patch should fix that issue.
2022-03-17Cygwin: document recent gmondump formatting fixMark Geisert1-0/+3
2022-03-16Cygwin: Fix gmondump formatting goofsMark Geisert1-3/+3
The rewrite of %X to %p was malhandled. Fix that/them.
2022-03-15Cygwin: Add description of fsync() fix to 3.3.5 release notes.Takashi Yano1-0/+4
2022-03-14Cygwin: path: Add fallback for DFS mounted drive.Takashi Yano1-5/+12
- If UNC path for DFS is mounted to a drive with drive letter, the error "Too many levels of symbolic links" occurs when accessing to that drive. This is because GetDosDeviceW() returns unexpected string such as "\Device\Mup\DfsClient\;Z:000000000003fb89\dfsserver \dfs\linkname" for the mounted UNC path "\??\UNC\fileserver\share". This patch adds a workaround for this issue. Addresses: https://cygwin.com/pipermail/cygwin/2022-March/250979.html