Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
97 commits
Select commit Hold shift + click to select a range
b80d279
Cygwin: bump DLL version to 3.6.5
github-cygwin Jul 15, 2025
7c8e7f9
Cygwin: clocks: use InterlockedCompareExchange64
github-cygwin Jul 16, 2025
3b1d436
Cygwin: POSIX timer: handle TIMER_ABSTIME correctly for all realtime …
github-cygwin Jul 16, 2025
e3470cf
Cygwin: add clock bugfixes to 3.6.5 release message
github-cygwin Jul 16, 2025
5fb125d
newlib: fclose: Use sfp lock while fp lock is active
tyan0 Jul 16, 2025
d0d9085
Cygwin: sys/termios.h: define struct winsize before using it
github-cygwin Jul 18, 2025
d62ac25
Cygwin: cygheap: Add lock()/unlock() method
tyan0 Jul 19, 2025
5af6f6f
Cygwin: spawn: Lock cygheap from refresh_cygheap() until child_copy()
tyan0 Jul 19, 2025
94e4d32
Cygwin: spawn: Make system() thread-safe
tyan0 Jul 19, 2025
501be96
Cygwin: Add recent fixes to release note 3.6.5
tyan0 Jul 23, 2025
d9af416
Revert "mbrtowc: fix handling invalid UTF-8 4 byte sequences if wchar…
github-cygwin Jul 22, 2025
8a87d35
Cygwin: _sys_mbstowcs: fix handling invalid 4-byte UTF-8 sequences
github-cygwin Jul 23, 2025
25ade60
Cygwin: _sys_wcstombs: add FIXME comment
github-cygwin Jul 23, 2025
41e0d0e
Cygwin: Add UTF-8 surrogate fix to release messages
github-cygwin Jul 24, 2025
99cfcb8
Cygwin: Fix handling of archetype fhandler in process_fd
tyan0 Jul 24, 2025
a5f96c1
Cygwin: spawn: Make ch_spwan_local be initialized properly
tyan0 Aug 15, 2025
6285ae6
Cygwin: pty: Fix FLUSHO handling
tyan0 Aug 30, 2025
822b49e
Cygwin: Note Ctrl-O (FLUSHO) fix to release note
tyan0 Aug 30, 2025
275c91f
Cygwin: lock cygheap during fork
jeremyd2019 Sep 19, 2025
2ae6825
Cygwin: symlink_native: allow linking to `.` again
dscho Oct 6, 2025
39b4a0d
Fix msys library name in import libraries
ktbarrett Mar 14, 2021
baeb79e
Rename dll from cygwin to msys
Alexpux Apr 14, 2019
5031617
Add functionality for converting UNIX paths in arguments and environm…
Alexpux Apr 14, 2019
4b92ba6
Add functionality for changing OS name via MSYSTEM environment variab…
Alexpux Apr 14, 2019
c2e033e
- Move root to /usr. - Change sorting mount points. - By default moun…
Alexpux Apr 14, 2019
aaf1b29
Instead of creating Cygwin symlinks, use deep copy by default
Alexpux Apr 14, 2019
162b872
Automatically rewrite TERM=msys to TERM=cygwin
Alexpux Apr 14, 2019
317ab5c
Do not convert environment for strace
Alexpux Apr 14, 2019
635e837
strace.cc: Don't set MSYS=noglob
mingwandroid Aug 23, 2015
ec9b0f5
Add debugging for strace make_command_line
mingwandroid Aug 21, 2015
aae2354
strace --quiet: be *really* quiet
dscho May 17, 2017
9928501
path_conv: special-case root directory to have trailing slash
Alexpux Apr 14, 2019
15b9005
When converting to a Unix path, avoid double trailing slashes
dscho Nov 8, 2022
570a012
msys2_path_conv: pass PC_NOFULL to path_conv
lazka Nov 20, 2022
de30986
path-conversion: Introduce ability to switch off conversion.
Jun 17, 2015
a1ad885
dcrt0.cc: Untangle allow_glob from winshell
mingwandroid Aug 21, 2015
a863a97
dcrt0.cc (globify): Don't quote literal strings differently when dos_…
mingwandroid Aug 23, 2015
cf6b4fb
Add debugging for build_argv
mingwandroid Aug 21, 2015
240fcf2
environ.cc: New facility/environment variable MSYS2_ENV_CONV_EXCL
mingwandroid Apr 10, 2016
5581aba
Introduce the `enable_pcon` value for `MSYS`
dscho May 19, 2020
b515460
popen: call /usr/bin/sh instead of /bin/sh
lazka Jun 5, 2020
b5a1369
Disable the 'cygwin' GitHub workflow
dscho Mar 17, 2021
a69e75d
CI: add a GHA for doing a basic build test
lazka Aug 9, 2020
422ef25
Set up a GitHub Action to keep in sync with Cygwin
dscho Nov 22, 2019
a3e87c1
Expose full command-lines to other Win32 processes by default
dscho Aug 12, 2020
ab684c6
Add a helper to obtain a function's address in kernel32.dll
dscho Apr 16, 2018
97045eb
Emulate GenerateConsoleCtrlEvent() upon Ctrl+C
dscho Mar 20, 2015
169cc75
kill: kill Win32 processes more gently
dscho Mar 20, 2015
e9c387d
Cygwin: make option for native inner link handling.
jeremyd2019 Jul 22, 2021
6a898da
docs: skip building texinfo and PDF files
dscho Nov 8, 2021
65fb4f3
install-libs: depend on the "toollibs"
dscho Nov 8, 2021
4d520fc
POSIX-ify the SHELL variable
dscho Nov 23, 2015
ad95c5c
Handle ORIGINAL_PATH just like PATH
dscho Mar 21, 2017
54f7f41
uname: allow setting the system name to CYGWIN
lazka Jul 3, 2022
b4f031f
Pass environment variables with empty values
dscho Feb 18, 2015
4a7fa0d
Optionally disallow empty environment values again
dscho Sep 6, 2022
9bf14b5
build_env(): respect the `MSYS` environment variable
dscho Sep 6, 2022
65ae61d
Revert "Cygwin: Enable dynamicbase on the Cygwin DLL by default"
lazka Dec 17, 2022
4a74e2f
Avoid sharing cygheaps across Cygwin versions
dscho Jan 30, 2023
5baa55c
uname: report msys2-runtime commit hash, too
dscho Feb 21, 2023
0eeda3e
Cygwin: Adjust CWD magic to accommodate for the latest Windows previews
dscho May 22, 2023
a94817f
Start the merging-rebase to cygwin-3.6.5
dscho Oct 10, 2025
58a13d8
ci: bump actions/checkout from 3 to 5
dscho Aug 18, 2025
a317bf8
Merge branch 'bump-checkout-to-5'
dscho Oct 10, 2025
82b5b10
fixup! CI: add a GHA for doing a basic build test
dscho Oct 10, 2025
48af390
fixup! CI: add a GHA for doing a basic build test
dscho Aug 18, 2025
cb48c88
Mention the extremely useful small_printf() function
dscho Feb 20, 2015
c6e68dc
Allow native symlinks to non-existing targets in 'nativestrict' mode
kblees May 20, 2015
2a9d34f
WIP Handle 8-bit characters under LOCALE=C
dscho Feb 20, 2015
7721d42
Make paths' WCS->MBS conversion explicit
dscho Dec 18, 2015
5c25e84
Use MB_CUR_MAX == 6 by default
dscho Nov 21, 2019
df2f735
msys2-runtime: restore fast path for current user primary group
rglidden Aug 24, 2023
30c80e0
fixup! Add functionality for converting UNIX paths in arguments and e…
Mar 9, 2015
d81d295
Merge branch 'mention-small-printf'
dscho Oct 10, 2025
a490c77
Change the default base address for x86_64
chirpnot Mar 10, 2022
c260433
Merge pull request #10 from kblees/kb/symlinks
dscho Feb 12, 2018
fbe66f6
Merge branch 'handle-8-bit-under-locale-c'
dscho Oct 10, 2025
c47dedf
Merge branch 'wcstombs'
dscho Feb 12, 2018
dcac504
Merge pull request #57 from rglidden/main
dscho Aug 28, 2023
281e1dd
Merge branch 'msys2-3.6.5'
dscho Aug 14, 2020
3ed307a
Merge branch 'msys2-ci-fixups'
dscho Oct 10, 2025
7dbc098
Merge branch 'msys2-path-conversion-starting-with-non-ascii'
dscho Oct 10, 2025
c7c08d2
Merge pull request #37 from chirpnot/main
dscho May 13, 2022
a9e5b63
dependabot: help keeping GitHub Actions versions up to date
dscho Feb 6, 2024
01b5c83
Do not try to sync with Cygwin
dscho Aug 20, 2020
0119a81
ci: run Git's entire test suite
dscho Feb 12, 2024
387251b
Merge pull request #83 from dscho/run-gits-test-suite
dscho Jan 24, 2025
f41b002
Start implementing UI-based tests by adding an AutoHotKey library
dscho Oct 10, 2025
8c1cae6
ci: add an AutoHotKey-based integration test
dscho May 7, 2025
354f2e2
ci(ui-tests): upload the test logs
dscho Jul 5, 2025
1f37a37
ci(ui-tests): take a screenshot when canceled
dscho Jul 4, 2025
a7c4297
ui-tests: verify that a `sleep` in Windows Terminal can be interrupted
dscho Jul 3, 2025
d59282b
ui-tests: verify that interrupting clones via SSH works
dscho Jul 3, 2025
b98e5fb
ci(ui-tests): exclude the large repository from the build artifact
dscho Jul 5, 2025
ee3f04a
ui-tests: add `ping` interrupt test
dscho Jul 3, 2025
ce42fe3
ui-tests: do verify the SSH hang fix
dscho Jul 5, 2025
22c9553
Merge branch 'ui-tests'
dscho May 7, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion newlib/libc/stdio/fclose.c
Original file line number Diff line number Diff line change
Expand Up @@ -72,13 +72,15 @@ _fclose_r (struct _reent *rptr,
int __oldcancel;
pthread_setcancelstate (PTHREAD_CANCEL_DISABLE, &__oldcancel);
#endif
__sfp_lock_acquire ();
if (!(fp->_flags2 & __SNLK))
_flockfile (fp);

if (fp->_flags == 0) /* not open! */
{
if (!(fp->_flags2 & __SNLK))
_funlockfile (fp);
__sfp_lock_release ();
#ifdef _STDIO_WITH_THREAD_CANCELLATION_SUPPORT
pthread_setcancelstate (__oldcancel, &__oldcancel);
#endif
Expand All @@ -101,7 +103,6 @@ _fclose_r (struct _reent *rptr,
FREEUB (rptr, fp);
if (HASLB (fp))
FREELB (rptr, fp);
__sfp_lock_acquire ();
fp->_flags = 0; /* release this FILE for reuse */
if (!(fp->_flags2 & __SNLK))
_funlockfile (fp);
Expand Down
25 changes: 9 additions & 16 deletions newlib/libc/stdlib/mbtowc_r.c
Original file line number Diff line number Diff line change
Expand Up @@ -677,21 +677,6 @@ __utf8_mbtowc (struct _reent *r,
state->__count = 3;
else if (n < (size_t)-1)
++n;
if (n < 4)
return -2;
ch = t[i++];
if (ch < 0x80 || ch > 0xbf)
{
_REENT_ERRNO(r) = EILSEQ;
return -1;
}
/* Note: Originally we created the low surrogate pair on systems with
wchar_t == UTF-16 *before* checking the 4th byte. This was utterly
wrong, because this failed to check the last byte for being a valid
value for a complete UTF-8 4 byte sequence. As a result, calling
functions happily digested the low surrogate and then got an entirely
different character and handled this separately, thus generating
invalid UTF-16 values. */
if (state->__count == 3 && sizeof(wchar_t) == 2)
{
/* On systems which have wchar_t being UTF-16 values, the value
Expand All @@ -710,7 +695,15 @@ __utf8_mbtowc (struct _reent *r,
| (wint_t)((state->__value.__wchb[2] & 0x3f) << 6);
state->__count = 4;
*pwc = 0xd800 | ((tmp - 0x10000) >> 10);
return 3;
return i;
}
if (n < 4)
return -2;
ch = t[i++];
if (ch < 0x80 || ch > 0xbf)
{
_REENT_ERRNO(r) = EILSEQ;
return -1;
}
tmp = (wint_t)((state->__value.__wchb[0] & 0x07) << 18)
| (wint_t)((state->__value.__wchb[1] & 0x3f) << 12)
Expand Down
9 changes: 3 additions & 6 deletions winsup/cygwin/clock.cc
Original file line number Diff line number Diff line change
Expand Up @@ -32,22 +32,19 @@ system_tickcount_period ()
void inline
clk_t::init ()
{
if (!period)
InterlockedExchange64 (&period, system_tickcount_period ());
InterlockedCompareExchange64 (&period, system_tickcount_period (), 0);
}

void inline
clk_realtime_t::init ()
{
if (!ticks_per_sec)
InterlockedExchange64 (&ticks_per_sec, system_qpc_tickspersec ());
InterlockedCompareExchange64 (&ticks_per_sec, system_qpc_tickspersec (), 0);
}

void inline
clk_monotonic_t::init ()
{
if (!ticks_per_sec)
InterlockedExchange64 (&ticks_per_sec, system_qpc_tickspersec ());
InterlockedCompareExchange64 (&ticks_per_sec, system_qpc_tickspersec (), 0);
}

int
Expand Down
3 changes: 3 additions & 0 deletions winsup/cygwin/fhandler/base.cc
Original file line number Diff line number Diff line change
Expand Up @@ -474,6 +474,9 @@ fhandler_base::open_with_arch (int flags, mode_t mode)
if (!open_setup (flags))
api_fatal ("open_setup failed, %E");
}
/* For pty and console, PATH_OPEN flag has not been set in open().
So set it here unconditionally. */
pc.set_isopen ();

close_on_exec (flags & O_CLOEXEC);
/* A unique ID is necessary to recognize fhandler entries which are
Expand Down
6 changes: 1 addition & 5 deletions winsup/cygwin/fhandler/pty.cc
Original file line number Diff line number Diff line change
Expand Up @@ -693,8 +693,7 @@ fhandler_pty_master::process_slave_output (char *buf, size_t len, int pktmode_on

termios_printf ("bytes read %u", n);

if (!buf || ((get_ttyp ()->ti.c_lflag & FLUSHO)
&& !get_ttyp ()->mask_flusho))
if (!buf || (get_ttyp ()->ti.c_lflag & FLUSHO))
continue; /* Discard read data */

memcpy (optr, outbuf, n);
Expand All @@ -714,8 +713,6 @@ fhandler_pty_master::process_slave_output (char *buf, size_t len, int pktmode_on
}

out:
if (buf)
set_mask_flusho (false);
termios_printf ("returning %d", rc);
return rc;
}
Expand Down Expand Up @@ -2258,7 +2255,6 @@ fhandler_pty_master::write (const void *ptr, size_t len)
nlen--;
i--;
}
process_stop_start (buf[i], get_ttyp ());
}

DWORD n;
Expand Down
7 changes: 6 additions & 1 deletion winsup/cygwin/fork.cc
Original file line number Diff line number Diff line change
Expand Up @@ -329,6 +329,7 @@ frok::parent (volatile char * volatile stack_here)
/* NEVER, EVER, call a function which in turn calls malloc&friends while this
malloc lock is active! */
__malloc_lock ();
cygheap->lock ();
bool locked = true;

/* Remove impersonation */
Expand Down Expand Up @@ -483,6 +484,7 @@ frok::parent (volatile char * volatile stack_here)
impure, impure_beg, impure_end,
NULL);

cygheap->unlock ();
__malloc_unlock ();
locked = false;
if (!rc)
Expand Down Expand Up @@ -568,7 +570,10 @@ frok::parent (volatile char * volatile stack_here)
if (fix_impersonation)
cygheap->user.reimpersonate ();
if (locked)
__malloc_unlock ();
{
cygheap->unlock ();
__malloc_unlock ();
}

/* Remember to de-allocate the fd table. */
if (hchild)
Expand Down
2 changes: 1 addition & 1 deletion winsup/cygwin/include/cygwin/version.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ details. */
changes to the DLL and is mainly informative in nature. */

#define CYGWIN_VERSION_DLL_MAJOR 3006
#define CYGWIN_VERSION_DLL_MINOR 4
#define CYGWIN_VERSION_DLL_MINOR 5

/* CYGWIN_VERSION_DLL_COMBINED gives us a single number representing the
combined DLL major and minor numbers. */
Expand Down
13 changes: 6 additions & 7 deletions winsup/cygwin/include/sys/termios.h
Original file line number Diff line number Diff line change
Expand Up @@ -282,6 +282,12 @@ struct termios
speed_t c_ospeed;
};

struct winsize
{
unsigned short ws_row, ws_col;
unsigned short ws_xpixel, ws_ypixel;
};

#define termio termios

#ifdef __cplusplus
Expand Down Expand Up @@ -313,13 +319,6 @@ int tcsetwinsize(int fd, const struct winsize *winsz);
#define cfgetospeed(tp) ((tp)->c_ospeed)
#endif

/* Extra stuff to make porting stuff easier. */
struct winsize
{
unsigned short ws_row, ws_col;
unsigned short ws_xpixel, ws_ypixel;
};

#define TIOCGWINSZ (('T' << 8) | 1)
#define TIOCSWINSZ (('T' << 8) | 2)
#define TIOCLINUX (('T' << 8) | 3)
Expand Down
3 changes: 2 additions & 1 deletion winsup/cygwin/local_includes/child_info.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ enum child_status
#define EXEC_MAGIC_SIZE sizeof(child_info)

/* Change this value if you get a message indicating that it is out-of-sync. */
#define CURR_CHILD_INFO_MAGIC 0xacbf4682U
#define CURR_CHILD_INFO_MAGIC 0x77f25a01U

#include "pinfo.h"
struct cchildren
Expand Down Expand Up @@ -149,6 +149,7 @@ class child_info_spawn: public child_info

void cleanup ();
child_info_spawn () {};
child_info_spawn (child_info_types);
child_info_spawn (child_info_types, bool);
void record_children ();
void reattach_children ();
Expand Down
5 changes: 5 additions & 0 deletions winsup/cygwin/local_includes/cygheap.h
Original file line number Diff line number Diff line change
Expand Up @@ -499,6 +499,9 @@ struct threadlist_t

struct init_cygheap: public mini_cygheap
{
private:
static SRWLOCK cygheap_protect;
public:
_cmalloc_entry *chain;
char *buckets[NBUCKETS];
UNICODE_STRING installation_root;
Expand Down Expand Up @@ -542,6 +545,8 @@ struct init_cygheap: public mini_cygheap
threadlist_t *find_tls (int, bool&);
sigset_t compute_sigblkmask ();
void unlock_tls (threadlist_t *t) { if (t) ReleaseMutex (t->mutex); }
inline void lock () { AcquireSRWLockExclusive (&cygheap_protect); }
inline void unlock () { ReleaseSRWLockExclusive (&cygheap_protect); }
};


Expand Down
1 change: 0 additions & 1 deletion winsup/cygwin/local_includes/fhandler.h
Original file line number Diff line number Diff line change
Expand Up @@ -2622,7 +2622,6 @@ class fhandler_pty_master: public fhandler_pty_common
}
void get_master_thread_param (master_thread_param_t *p);
void get_master_fwd_thread_param (master_fwd_thread_param_t *p);
void set_mask_flusho (bool m) { get_ttyp ()->mask_flusho = m; }
bool need_send_ctrl_c_event ();
};

Expand Down
1 change: 1 addition & 0 deletions winsup/cygwin/local_includes/path.h
Original file line number Diff line number Diff line change
Expand Up @@ -244,6 +244,7 @@ class path_conv
int isopen () const {return path_flags & PATH_OPEN;}
int isctty_capable () const {return path_flags & PATH_CTTY;}
int follow_fd_symlink () const {return path_flags & PATH_RESOLVE_PROCFD;}
void set_isopen () {path_flags |= PATH_OPEN;}
void set_cygexec (bool isset)
{
if (isset)
Expand Down
1 change: 0 additions & 1 deletion winsup/cygwin/local_includes/tty.h
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,6 @@ class tty: public tty_min
bool master_is_running_as_service;
bool req_xfer_input;
xfer_dir pty_input_state;
bool mask_flusho;
bool discard_input;
bool stop_fwd_thread;

Expand Down
12 changes: 6 additions & 6 deletions winsup/cygwin/mm/cygheap.cc
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ static mini_cygheap NO_COPY cygheap_dummy =
init_cygheap NO_COPY *cygheap = (init_cygheap *) &cygheap_dummy;
void NO_COPY *cygheap_max;

static NO_COPY SRWLOCK cygheap_protect = SRWLOCK_INIT;
SRWLOCK NO_COPY init_cygheap::cygheap_protect = SRWLOCK_INIT;

struct cygheap_entry
{
Expand Down Expand Up @@ -377,7 +377,7 @@ _cmalloc (unsigned size)
if (b >= NBUCKETS)
return NULL;

AcquireSRWLockExclusive (&cygheap_protect);
cygheap->lock ();
if (cygheap->buckets[b])
{
rvc = (_cmalloc_entry *) cygheap->buckets[b];
Expand All @@ -389,27 +389,27 @@ _cmalloc (unsigned size)
rvc = (_cmalloc_entry *) _csbrk (bucket_val[b] + sizeof (_cmalloc_entry));
if (!rvc)
{
ReleaseSRWLockExclusive (&cygheap_protect);
cygheap->unlock ();
return NULL;
}

rvc->b = b;
rvc->prev = cygheap->chain;
cygheap->chain = rvc;
}
ReleaseSRWLockExclusive (&cygheap_protect);
cygheap->unlock ();
return rvc->data;
}

static void
_cfree (void *ptr)
{
AcquireSRWLockExclusive (&cygheap_protect);
cygheap->lock ();
_cmalloc_entry *rvc = to_cmalloc (ptr);
unsigned b = rvc->b;
rvc->ptr = cygheap->buckets[b];
cygheap->buckets[b] = (char *) rvc;
ReleaseSRWLockExclusive (&cygheap_protect);
cygheap->unlock ();
}

static void *
Expand Down
5 changes: 4 additions & 1 deletion winsup/cygwin/path.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2071,7 +2071,10 @@ symlink_native (const char *oldpath, path_conv &win32_newpath)
e_old = wcpcpy (e_old, L"..\\"), num--;
if (num > 0)
e_old = wcpcpy (e_old, L"..");
wcpcpy (e_old, c_old);
if (e_old == final_oldpath->Buffer && c_old[0] == L'\0')
wcpcpy (e_old, L".");
else
wcpcpy (e_old, c_old);
}
}

Expand Down
4 changes: 3 additions & 1 deletion winsup/cygwin/posix_timer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -349,7 +349,9 @@ timer_tracker::settime (int flags, const itimerspec *new_value,
/ (NSPERSEC / NS100PERSEC);
if (flags & TIMER_ABSTIME)
{
if (clock_id == CLOCK_REALTIME)
if (clock_id == CLOCK_REALTIME_COARSE
|| clock_id == CLOCK_REALTIME
|| clock_id == CLOCK_REALTIME_ALARM)
DueTime.QuadPart = ts + FACTOR;
else /* non-REALTIME clocks require relative DueTime. */
{
Expand Down
33 changes: 33 additions & 0 deletions winsup/cygwin/release/3.6.5
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
Fixes:
------

- Fix two minor bugs in clock and POSIX timer handling.

- Fix an ordering problem in sys/termios.h.
Addresses: https://cygwin.com/pipermail/cygwin/2025-July/258474.html

- Fix doxygen hang due to a deadlock between fclose() and fork().
Addresses: https://cygwin.com/pipermail/cygwin-apps/2025-May/044318.html
Addresses: https://cygwin.com/pipermail/cygwin/2025-June/258323.html

- Fix multi-thread safety of system().
Addresses: https://cygwin.com/pipermail/cygwin/2025-June/258324.html

- Revert fix handling of invalid 4 byte UTF-8 sequence. It was broken.
Addresses: https://cygwin.com/pipermail/cygwin/2025-July/258513.html

- Instead, fix internal conversion of filenames in case of an invalid
4 byte UTF-8 sequence.
Addresses: https://cygwin.com/pipermail/cygwin/2025-June/258358.html

- Make process_fd correctly handle pty and console.
Addresses: https://cygwin.com/pipermail/cygwin/2025-May/258167.html

- Fix Ctrl-O (FLUSHO) handling.
Addresses: https://cygwin.com/pipermail/cygwin/2025-August/258717.html

- Fix multi-thread safety of fork()/exec() by adding the same locking as was
done for spawn.
Addresses: https://cygwin.com/pipermail/cygwin/2025-September/258801.html

- Fix native symlink to '.' (a regresison in 3.6.4)
16 changes: 11 additions & 5 deletions winsup/cygwin/select.cc
Original file line number Diff line number Diff line change
Expand Up @@ -689,6 +689,8 @@ pipe_data_available (int fd, fhandler_base *fh, HANDLE h, int mode)
return 0;
}

SRWLOCK ptym_peek_lock = SRWLOCK_INIT;

static int
peek_pipe (select_record *s, bool from_select)
{
Expand Down Expand Up @@ -730,10 +732,19 @@ peek_pipe (select_record *s, bool from_select)
gotone = s->read_ready = true;
goto out;
}
if (fh->get_major () == DEV_PTYM_MAJOR)
AcquireSRWLockExclusive (&ptym_peek_lock);
ssize_t n = pipe_data_available (s->fd, fh, h, PDA_READ);
/* On PTY masters, check if input from the echo pipe is available. */
if (n == 0 && fh->get_echo_handle ())
n = pipe_data_available (s->fd, fh, fh->get_echo_handle (), PDA_READ);
if (fh->get_major () == DEV_PTYM_MAJOR)
{
fhandler_pty_master *fhm = (fhandler_pty_master *) fh;
while (n > 0 && (fhm->tc ()->ti.c_lflag & FLUSHO))
n = fhm->process_slave_output (NULL, n, 0); /* Discard pipe data */
ReleaseSRWLockExclusive (&ptym_peek_lock);
}

if (n == PDA_ERROR)
{
Expand All @@ -759,11 +770,6 @@ peek_pipe (select_record *s, bool from_select)
}

out:
if (fh->get_major () == DEV_PTYM_MAJOR)
{
fhandler_pty_master *fhm = (fhandler_pty_master *) fh;
fhm->set_mask_flusho (s->read_ready);
}
h = fh->get_output_handle ();
if (s->write_selected && dev != FH_PIPER)
{
Expand Down
Loading
Loading