Skip to content

Rebase to cygwin-3.6.7#127

Merged
dscho merged 103 commits intogit-for-windows:mainfrom
dscho:rebase-to-3.6.7
Mar 5, 2026
Merged

Rebase to cygwin-3.6.7#127
dscho merged 103 commits intogit-for-windows:mainfrom
dscho:rebase-to-3.6.7

Conversation

@dscho
Copy link
Member

@dscho dscho commented Mar 2, 2026

This PR rebases Git for Windows' MSYS2 runtime patches to cygwin-3.6.7.

Range-diff vs previous rebase
  • 1: 3632155 < -: ------------ Add functionality for converting UNIX paths in arguments and environment variables to Windows form for native Win32 applications.
  • -: ------------ > 1: 90c6e2f Fix msys library name in import libraries
  • -: ------------ > 2: eb0623c Rename dll from cygwin to msys
  • -: ------------ > 3: 2d57400 Add functionality for converting UNIX paths in arguments and environment variables to Windows form for native Win32 applications.
  • 2: b91f792 = 4: 3e3b14f Add functionality for changing OS name via MSYSTEM environment variables.
  • 3: 31f4e2e ! 5: 019fb8c - Move root to /usr. - Change sorting mount points. - By default mount without ACLs. - Can read /etc/fstab with short mount point format.
    @@ winsup/cygwin/mount.cc: mount_info::add_item (const char *native, const char *po
      
     
      ## winsup/cygwin/uinfo.cc ##
    -@@ winsup/cygwin/uinfo.cc: pwdgrp::fetch_account_from_windows (fetch_user_arg_t &arg, cyg_ldap *pldap)
    +@@ winsup/cygwin/uinfo.cc: pwdgrp::fetch_account_from_windows (fetch_user_arg_t &arg, bool ugid_caching, cy
      		     dom, name,
      		     sid.string ((char *) sidstr),
      		     home ?: "/home/", home ? L"" : name,
  • 4: 09111b3 = 6: 025bc50 Instead of creating Cygwin symlinks, use deep copy by default
  • 5: aa7810d = 7: 384856e Automatically rewrite TERM=msys to TERM=cygwin
  • 6: 6887106 = 8: add7911 Do not convert environment for strace
  • 7: 97de8ba = 9: 34d346c strace.cc: Don't set MSYS=noglob
  • 8: 64aee59 = 10: e36f87e Add debugging for strace make_command_line
  • 9: 32d830b = 11: 42b2b9f strace --quiet: be really quiet
  • 10: 130ee39 = 12: 9dd7fc9 path_conv: special-case root directory to have trailing slash
  • 11: 78616ca = 13: a5545b3 When converting to a Unix path, avoid double trailing slashes
  • 12: b855b86 = 14: 4774fb2 msys2_path_conv: pass PC_NOFULL to path_conv
  • 13: fe02c0a = 15: 793bb2a path-conversion: Introduce ability to switch off conversion.
  • 14: 931e1b3 = 16: 0fe7d40 dcrt0.cc: Untangle allow_glob from winshell
  • 15: 7bb236e = 17: da4617d dcrt0.cc (globify): Don't quote literal strings differently when dos_spec
  • 16: a9fd176 = 18: 17bfb25 Add debugging for build_argv
  • 17: 990d129 = 19: 3d7efd8 environ.cc: New facility/environment variable MSYS2_ENV_CONV_EXCL
  • 18: 3e847b2 = 20: a7b6522 Introduce the enable_pcon value for MSYS
  • 19: a5ad379 = 21: f6c8e15 popen: call /usr/bin/sh instead of /bin/sh
  • 20: e225326 = 22: 4c0a1a8 Disable the 'cygwin' GitHub workflow
  • 21: 9497d87 = 23: 79bf3a1 CI: add a GHA for doing a basic build test
  • 22: 2085fe3 = 24: 54cf1de Set up a GitHub Action to keep in sync with Cygwin
  • 23: 0f3895d = 25: 4b6770b Expose full command-lines to other Win32 processes by default
  • 24: ae50042 = 26: a0c3117 Add a helper to obtain a function's address in kernel32.dll
  • 25: 4d290ec = 27: 752cf15 Emulate GenerateConsoleCtrlEvent() upon Ctrl+C
  • 26: eec10db = 28: e841010 kill: kill Win32 processes more gently
  • 27: ca436dd = 29: 488d8d8 Cygwin: make option for native inner link handling.
  • 28: f049279 = 30: b89a0ae docs: skip building texinfo and PDF files
  • 29: 9788a4e = 31: c3d121f install-libs: depend on the "toollibs"
  • 30: 905a968 = 32: bbe177f POSIX-ify the SHELL variable
  • 31: 2bc769d = 33: a0f611a Handle ORIGINAL_PATH just like PATH
  • 32: a32cbc8 = 34: 370a8b4 uname: allow setting the system name to CYGWIN
  • 33: ba3d622 = 35: 871d236 Pass environment variables with empty values
  • 34: 364c6c1 = 36: f29cf3d Optionally disallow empty environment values again
  • 35: a1f5d8c = 37: 443ed30 build_env(): respect the MSYS environment variable
  • 36: 856b8db = 38: 306baf5 Revert "Cygwin: Enable dynamicbase on the Cygwin DLL by default"
  • 37: 896d72e = 39: 35c1c7c Avoid sharing cygheaps across Cygwin versions
  • 38: 309908d = 40: c9aee64 uname: report msys2-runtime commit hash, too
  • 39: 2369286 = 41: 6e9c4de Cygwin: Adjust CWD magic to accommodate for the latest Windows previews
  • 40: 9bd2c5c = 42: 63747e4 fixup! CI: add a GHA for doing a basic build test
  • 45: 8d7b2c2 = 43: 74ca85b Make paths' WCS->MBS conversion explicit
  • 41: 749f5a2 = 44: ee9f333 fixup! CI: add a GHA for doing a basic build test
  • 42: ef4d5ce = 45: 520e5c9 fixup! Add functionality for converting UNIX paths in arguments and environment variables to Windows form for native Win32 applications.
  • 43: eb83ba7 = 46: ea6fb84 Mention the extremely useful small_printf() function
  • 44: 1f24813 = 47: 37e7445 Allow native symlinks to non-existing targets in 'nativestrict' mode
  • 46: 6e3b0e1 = 48: 0ee34fb WIP Handle 8-bit characters under LOCALE=C
  • 47: cd63e4e = 49: ee961da Use MB_CUR_MAX == 6 by default
  • 48: 1aafca5 ! 50: 143d323 msys2-runtime: restore fast path for current user primary group
    @@ winsup/cygwin/uinfo.cc: cygheap_pwdgrp::nss_init_line (const char *line)
      		else
      		  {
      		    c += strcspn (c, " \t");
    -@@ winsup/cygwin/uinfo.cc: pwdgrp::fetch_account_from_windows (fetch_user_arg_t &arg, cyg_ldap *pldap)
    +@@ winsup/cygwin/uinfo.cc: pwdgrp::fetch_account_from_windows (fetch_user_arg_t &arg, bool ugid_caching, cy
        gid_t gid = ILLEGAL_GID;
        bool is_domain_account = true;
        PCWSTR domain = NULL;
    @@ winsup/cygwin/uinfo.cc: pwdgrp::fetch_account_from_windows (fetch_user_arg_t &ar
        char *shell = NULL;
        char *home = NULL;
        char *gecos = NULL;
    -@@ winsup/cygwin/uinfo.cc: pwdgrp::fetch_account_from_windows (fetch_user_arg_t &arg, cyg_ldap *pldap)
    +@@ winsup/cygwin/uinfo.cc: pwdgrp::fetch_account_from_windows (fetch_user_arg_t &arg, bool ugid_caching, cy
      	    uid = posix_offset + sid_sub_auth_rid (sid);
      	  if (!is_group () && acc_type == SidTypeUser)
      	    {
    @@ winsup/cygwin/uinfo.cc: pwdgrp::fetch_account_from_windows (fetch_user_arg_t &ar
      	    }
      
      	  if (is_domain_account)
    -@@ winsup/cygwin/uinfo.cc: pwdgrp::fetch_account_from_windows (fetch_user_arg_t &arg, cyg_ldap *pldap)
    +@@ winsup/cygwin/uinfo.cc: pwdgrp::fetch_account_from_windows (fetch_user_arg_t &arg, bool ugid_caching, cy
      	      /* Skip this when creating group entries and for non-users. */
      	      if (is_group() || acc_type != SidTypeUser)
      		break;
  • 49: ee95489 = 51: 3502563 Change the default base address for x86_64
  • 50: d027cf7 = 52: 7292892 dependabot: help keeping GitHub Actions versions up to date
  • 51: 2cd9e94 = 53: 0871d6d Do not try to sync with Cygwin
  • 52: 298a18b = 54: 3a476d9 ci: run Git's entire test suite
  • 53: f3616fb = 55: ad7fedc Start implementing UI-based tests by adding an AutoHotKey library
  • 54: 3d4456a = 56: ec92134 ci: add an AutoHotKey-based integration test
  • 55: a6dfc22 = 57: d0d28f3 ci(ui-tests): upload the test logs
  • 56: a494efd = 58: 5fe6836 ci(ui-tests): take a screenshot when canceled
  • 57: a944627 = 59: 681f35e ui-tests: verify that a sleep in Windows Terminal can be interrupted
  • 58: 5e85e5d = 60: b6bf062 ui-tests: verify that interrupting clones via SSH works
  • 59: e229fa5 = 61: f5121c8 ci(ui-tests): exclude the large repository from the build artifact
  • 60: 06283c5 = 62: 1b0a7e0 ui-tests: add ping interrupt test
  • 61: 39ccbfd = 63: 7535d26 ui-tests: do verify the SSH hang fix
  • 62: 17d881d = 64: 74d76aa ui-tests: minimize Log window
  • 63: 2a904b3 = 65: f0c167b build(deps): bump actions/upload-artifact from 4 to 5
  • 64: 9b310b4 = 66: 40e2b5d Cygwin: CI: update Actions versions

github-cygwin and others added 30 commits January 9, 2026 15:59
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
c32rtomb neglects to check the input character for being outside
the valid UNICODE planes.  It happily converts the invalid character
into a valid (but wrong) surrogate pair and carries on.

Add a check so characters beyond 0x10ffff are not converted anymore.
Return -1 with errno set to EILSEQ instead.

Fixes: 4f258c5 ("Cygwin: Add ISO C11 functions c16rtomb, c32rtomb, mbrtoc16, mbrtoc32.")
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
(cherry picked from commit 7c9c9bcfcf59f43fd9776c6a809ba67eef76bcb4)
Commit 29b7313 ("* cygheap.h (enum cygheap_pwdgrp::cache_t):
Remove.") changed an initial conditional to skip calling
internal_getgroups() if we're running with cygserver account caching
in place.  This breaks changing the primary group.

Unfortunately the commit message doesn't explain why the change was
made.

Just calling internal_getgroups() all the time fixes this behaviour.

Fixes: 29b7313 ("* cygheap.h (enum cygheap_pwdgrp::cache_t): Remove.")
Addresses: https://cygwin.com/pipermail/cygwin/2026-January/259250.html
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
(cherry picked from commit 169a760e5d831f7862ff45812fc0c94fe8df88ec)
This has never worked as desired.  The check for admin permissions
is broken.  The call to check_token_membership() expects a PSID
argument.  What it gets is a pointer to a cygpsid.  There's no
class-specific type conversion for this to a PSID, so the pointer
is converted verbatim.

Pass the cygpsid directly, because cygpsid has a type conversion
method to PSID defined.

Pity that GCC doesn't warn here...

Fixes: 859d215 ("Cygwin: split out fhandler_socket into inet and local classes")
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
(cherry picked from commit 1539d3248a78f07a5ab8667d59e8901f724896ea)
The filler bytes in child_info were only necessary for Vista to
workaround a bug in WOW64. We just neglected to remove them so far.

Fixes: a4efb2a ("Cygwin: remove support for Vista entirely")
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
(cherry picked from commit b0c13bcc7d1cbc5b8ec0f82523830abfed1eddac)
This is outdated and should have been removed when we dropped
32 bit support.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
(cherry picked from commit cdc622a97631b787aab045c975aea4c7eafa4fed)
For case conversion, Unicode has a standard mapping and a separate
list of mapping rules for special cases (file SpecialCasing.txt),
some of which are also language-dependent (as configured via locale).
However, most of these rules are context-dependent, e.g. Greek capital
Sigma is lowered to two different small sigmas, depending on the
position at the end of a word.
The POSIX API function towupper and tolower cannot consider context
as they work only on one character at a time. String casing functions
are unfortunately not available. The only special case conversions
that apply to a single character are i and I in Turkish and Azerbaijani,
where i keeps the dot when capitalised (U+0130) and I keeps not having
a dot when converted small (U+0131).
The patch handles these special cases, based on locale consideration.

(cherry picked from commit 4356ccd02c9c51a0b0f0babc483567c129ba5393)
Commit b39fa2c ("* autoload.cc (CheckTokenMembership): Import.")
introduced a method to recycle a ldap connection throughout a call
stack.  This broke caching the mapping from remote NFS or Samba
uid/gid values to Cygwin uid/gid values partially.  The pldap pointer
given to pwdgrp::fetch_account_from_windows() was supposed to be NULL
if not called from getpwent/getgrent, but in fact it was set to
non-NULL in many callers for performance reasons.

Re-introduce a bool argument telling pwdgrp::fetch_account_from_windows()
if caching is desired or not, and set it to false only when called from
getpwent/getgrent.

Fixes: b39fa2c ("* autoload.cc (CheckTokenMembership): Import.")
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
(cherry picked from commit 2ca642dd6a6322915c4277b80d8c7c30058a434b)
NetBSD gencat version 1.37

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
(cherry picked from commit 55a8cbc595250ce82d58b313bb0b5e48a47112c2)
NetBSD defines __dead as __attribute__((__noreturn__)).  Add a matching
macro expression.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
(cherry picked from commit ede7cbc9946b23da883b98d5d757ab00f135151b)
This works around a bug in docbook2x-texi seen with bash 5.3 while
cross-building from Fedora 42.

If the --output-dir option to db2x_texixml isn't specified (always the
case when invoked by docbook2x-texi), then the script attempts cd ''
which is now an error ("cd: null directory") rather than being treated
as equivalent to cd '.'

Instead, explicitly name the output file when building .info files.

(cherry picked from commit 3a7c3c07f7fcad43f44405afbf39d650668e72b2)
The documentation states that _GNU_SOURCE enables "all of the above
plus GNU extensions.". Furthermore the documentation states that
_DEFAULT_SOURCE would enable POSIX-1.2008 with BSD and SVr4 extensions.

The code did different things though:

* For _GNU_SOURCE it only enabled POSIX.1-2008 but it should have been the
  highest available one, POSIX.1-2024.
* For _DEFAULT_SOURCE it enabled POSIX.1-2024.

Let's use the highest available POSIX standard possible and fix
documentation where necessary.

(cherry picked from commit abce9786a0c6cbfbf2d095461341574ec7097d71)
-Wundef warns if an undefined identifier is evaluated in an #if
directive. This would be valid as they are replaced with 0. However, it
is often an early warning sign and not intentional. To allow for
enabling -Wundef even outside system directories (where compilers
ignore such problems unless -Wsystem-headers is enabled) this patch
adds the required defined() checks.

glibc also has been supporting this for 10 years now:
  https://sourceware.org/git/?p=glibc.git;a=commitdiff;h=f248238cf43bd751db29e6f151d6da7645337ff5

I have not exhaustively tested this but you can see the effect with
something like the following (+ using -stdc= and/or -D...):
  echo | gcc -include newlib/libc/include/sys/features.h -Inewlib/libc/include/ -E - -Wundef

Signed-off-by: Stefan Tauner <stefan.tauner@gmx.at>
(cherry picked from commit a2c34f06d41e535a278130b6d2015aef37726cf7)
These types are to be used from stdatomic.h and uchar.h.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
(cherry picked from commit ed5c614c0da484d42b56102633e8569e73e027cc)
…__char32_t

Now that we have base definitions for these types, use them.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
(cherry picked from commit 68379130ff5d92c22bce87051ec42a5b2a06786e)
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
(cherry picked from commit a7c614986ab2e21a342afe3105fb88985a653996)
Move the heavy machinery evaluating the fast types from stdint.h
to machine/_default_types.h.  Do not try to guess from INTMAX.
In the unlikely case that __INT_FASTn_TYPE__ and __UINT_FASTn_TYPE__
are not defined, use the size-correct base types instead, just as
with the least types.

Nice side-effect: We don't need the "define fast as least" fallback
code in stdint.h anymore, given that the definitions of least
and fast types in machine/_default_types.h are now equivalent:
If fast couldn't be defined, least couldn't have been defined either.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
(cherry picked from commit e3b83d104f74a7a42c07a6b6e2dc51661da14320)
These are not strictly necessary, but POSIX headers can define
other types based on them even if stddef.h isn't included.
It also simplifies porting BSD headers.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
(cherry picked from commit a6d97392c787c5f68090fda337d7178383986f42)
Aligned definition with FreeBSD to simplify porting FreeBSD headers.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
(cherry picked from commit 09e6aec0a0b361f40fc2b528aff8b18cb2a1745a)
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
(cherry picked from commit e4fbaa9ea1dcc53afdd654213903e85b186c9220)
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
(cherry picked from commit 69f09ebd6f7d543f8e7b66ff58f2f3a178834d7f)
In a specific rare case when a Cygwin process runs out of available
file descriptor numbers (errno set to EMFILE), the underlying Windows
HANDLE is not being closed. This is partly because currently the given
file is first opened natively before a new Cygwin file descriptor has
been assigned - the logic overlooks the fact that it is possible for
the Windows HANDLE to be valid, but not the internal fd.

Even though the object is explicitly freed from memory later using
operator delete, the fhandler_disk_file class has no destructor
defined to mitigate the leak.

This patch introduces a manual call to fh->close() if the assigned fd
value returned by the operator int &() function in the cygheap_fdnew
class is less than 0.

Test fixed on AArch64 and x86_64:
winsup.api/ltp/dup03.exe

Signed-off-by: Igor Podgainoi <Igor.Podgainoi@arm.com>
(cherry picked from commit 335c25cc2b9208b77f8a2d39634ec3983a6a8e6c)
Cygwin's speclib doesn't handle dashes or dots. However, we are about to
rename the output file name from `cygwin1.dll` to `msys-2.0.dll`.

Let's preemptively fix up all the import libraries that would link
against `msys_2_0.dll` to correctly link against `msys-2.0.dll` instead.
…ent variables to Windows form for native Win32 applications.
…t without ACLs. - Can read /etc/fstab with short mount point format.
The new `winsymlinks` mode `deepcopy` (which is made the default) lets
calls to `symlink()` create (deep) copies of the source file/directory.

This is necessary because unlike Cygwin, MSYS2 does not try to be its
own little ecosystem that lives its life separate from regular Win32
programs: the latter have _no idea_ about Cygwin-emulated symbolic links
(i.e. system files whose contents start with `!<symlink>\xff\xfe` and
the remainder consists of the NUL-terminated, UTF-16LE-encoded symlink
target).

To support Cygwin-style symlinks, the new mode `sysfile` is introduced.

Co-authored-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Co-authored-by: Jeremy Drake <github@jdrake.com>
With MSys1, it was necessary to set the TERM variable to "msys". To
allow for a smooth transition from MSys1 to MSys2, let's simply handle
TERM=msys as if the user had not specified TERM at all and wanted us to
use our preferred TERM value.
Strace is a Windows program so MSYS2 will convert all arguments and environment vars and that makes debugging msys2 software with strace very tricky.
dscho and others added 24 commits March 3, 2026 00:05
This seems to have been necessary in 2015 to address the expectations of
some tests in Git's test suite, but seems no longer to be necessary?!?

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
The test logs are quite interesting to have, and not only those: In case
of a fatal failure, the test directory is valuable information, too.
Let's always upload them as build artifacts.

For convenience, let's just reuse the `ui-tests/` directory as the place
to put all of those files; Technically, we do not need the files in
there that are tracked by Git, but practically speaking, it is neat to
have them packaged in the same `.zip` file as the test logs and stuff.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Commit a5bcfe6 removed an optimization that fetches the
default group from the current user token, as it is sometimes
not accurate such as when groups like the builtin
Administrators group is the primary group.

However, removing this optimization causes extremely poor
performance when connected to some Active Directory
environments.

Restored this optimization as the default behaviour, and
added a `group: db-accurate` option to `nsswitch.conf` that
can be used to disable the optimization in cases where
accurate group information is required.

This fixes git-for-windows/git#4459

Signed-off-by: Richard Glidden <richard@glidden.org>
This topic branch fixes the problem where a UTF-16 command-line was
converted to UTF-8 in an incorrect way (because Cygwin treated it as if
it was a file name and applied some magic that is intended to allow for
otherwise invalid file names on Windows).

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Sometimes the logs are empty and it is highly unclear what has happened.
In such a scenario, a picture is indeed worth more than a thousand
words.

Note that this commit is more complicated than anyone would like, for
two reasons:

- While PowerShell is the right tool for the job, a PowerShell step in
  GitHub Actions will pop up a Terminal window, _hiding_ what we want to
  screenshot. To work around that, I tried to run things in a Bash step.
  _Also_ opens a Terminal window! Node.js to the rescue.

- _Of course_ it is complicated to take a screenshot. The challenge is
  to figure out the dimensions of the screen, which should be as easy as
  looking at `[System.Windows.Forms.Screen]::PrimaryScreen`'s `Bounds`
  attribute.

  Easy peasy, right? No, it's not. Most machines nowadays have a
  _ridiculous_ resolution which is why most setups have a _zoom factor_.
  Getting to that factor should be trivial, by calling
  `GetDeviceCaps(hDC, LOGPIXELSX)`, but that's not working in modern
  Windows! There is a per-monitor display scaling ("DPI"). But even
  _that_ is hard to get at, calling `GetDpiForMonitor()` will still
  return 96 DPI (i.e. 100% zoom) because PowerShell is not marked as
  _Per-Monitor DPI Aware_. Since we do not want to write a manifest into
  the same directory as `powershell.exe` resides, we have to jump
  through yet another hoop to get that.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
This might break things, but it turns out several Windows libraries like
to be loaded at 0x180000000.

This causes a problem, because `msys-2.0.dll` loads at `0x180040000` and
expects `0x180000000-0x180040000` to be available. A problem arises when
Antiviruses (or other DLL hooking mechanisms) load a DLL whose preferred
load address is `0x180000000` and fits in size before `0x180010000`:

1. `msys-2.0.dll` loads and fills `0x180010000-0x180040000` assuming no
   shared console structure is going to be needed.

2. Another DLL loads and fills `0x180000000-0x18000xxxx`

3. `msys-2.0.dll` tries to load `0x180000000-0x180010000` but it's not
   available. It falls back to another address, but down the line
   something else fails.

This bug triggers when using subshells (e.g.: `git clone --recursive`).

The MSYS2 runtime should be able to work around the address conflict,
but the code is failing in some way or other...

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Mikael Larsson <95430516+chirpnot@users.noreply.github.com>
msys2-runtime: restore fast path for current user primary group
The Ctrl+C way to interrupt run-away processes is highly important. It
was recently broken in multiple ways in the Cygwin runtime (and hence
also in the MSYS2 runtime).

Let's add some integration tests that will catch regressions.

It is admittedly less than ideal to add _integration_ tests; While
imitating exactly what the end user does looks appealing at first,
excellent tests impress by how quickly they allow regressions not only
to be identified but also to be fixed. Even worse: all integration
tests, by virtue of working in a broader environment than, say, unit
tests, incur the price of sometimes catching unactionable bugs, i.e.
bugs in software that is both outside of our control as well as not the
target of our testing at all.

Nevertheless, seeing as Cygwin did not add any unit tests for those
Ctrl+C fixes (which is understandable, given how complex testing for
Ctrl+C without UI testing would be), it is better to have integration
tests than no tests at all.

So here goes: This commit introduces a test that verifies that the MSYS2
`sleep.exe` can be interrupted when run from PowerShell in a Windows
Terminal. This was broken in v3.6.0 and fixed in 7674c51 (Cygwin:
console: Set ENABLE_PROCESSED_INPUT when disable_master_thread,
2025-07-01).

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Workaround certain anti-malware programs

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
This was the actual use case that was broken and necessitated the fix in
7674c51 (Cygwin: console: Set ENABLE_PROCESSED_INPUT when
disable_master_thread, 2025-07-01).

It does require an SSH server, which Git for Windows no longer ships.
Therefore, this test uses the `sshd.exe` of OpenSSH for Windows
(https://github.com/powershell/Win32-OpenSSH) in conjunction with Git
for Windows' `ssh.exe` (because using OpenSSH for Windows' variant of
`ssh.exe` would not exercise the MSYS2 runtime and therefore not
demonstrate a regression, should it surface in the future).

To avoid failing the test because OpenSSH for Windows is not available,
the test case is guarded by the environment variable
`OPENSSH_FOR_WINDOWS_DIRECTORY` which needs to point to a directory that
contains a working `sshd.exe`.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
In the previous commit, I added a new UI test that generates a somewhat
large repository for testing the clone via SSH. Since that repository is
created in the test directory, that would inflate the `ui-tests` build
artifact rather dramatically. So let's create the repository outside of
that directory.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
One particularly important part of Git for Windows' MSYS2 runtime is
that it is used to run Git's tests, and regressions happened there: For
example, the first iteration of MSYS2 runtime v3.5.5 caused plenty of
hangs. This was realized unfortunately only after deploying the
msys2-runtime Pacman package, and some painful vacation-time scrambling
was required to revert to v3.5.4.This was realized unfortunately only
after deploying the msys2-runtime Pacman package, and some painful
vacation-time scrambling was required to revert to v3.5.4.

To verify that this does not happen anymore, let's reuse what
`setup-git-for-windows-sdk` uses in Git's very own CI:

- determine the latest successful `ci-artifacts` workflow run in
  git-for-windows/git-sdk-64

- download its Git files and build artifacts

- download its minimal-sdk

- overwrite the MSYS2 runtime in the minimal-sdk

- run the test suite and the assorted validations just like the
  `ci-artifacts` workflow (from which these jobs are copied)

This obviously adds a hefty time penalty (around 7 minutes!) to every
MSYS2 runtime PR in the git-for-windows org. Happily, these days we
don't need many of those, and the balance between things like the v3.5.5
scramble and waiting a little longer for the CI to finish is clearly in
favor of the latter.

Co-authored-by: Jeremy Drake <github@jdrake.com>
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
This is a forked repository...

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
The fixes of 7674c51 (Cygwin: console: Set ENABLE_PROCESSED_INPUT
when disable_master_thread, 2025-07-01) were unfortunately not complete;
There were still a couple of edge cases where Ctrl+C was unable to
interrupt processes. Let's add a demonstration of that issue.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
In 0ae6a6f (Cygwin: pipe: Fix SSH hang with non-cygwin pipe reader,
2025-06-27), a quite problematic bug was fixed where somewhat large-ish
repositories could not be cloned via SSH anymore.

This fix was not accompanied by a corresponding test case in Cygwin's
test suite, i.e. there is no automated way to ensure that there won't be
any regressions on that bug (and therefore it would fall onto end users
to deal with those).

This constitutes what Michael C. Feathers famously characterized as
"legacy code" in his book "Working Effectively with Legacy Code":

    To me, legacy code is simply code without tests. I've gotten some
    grief for this definition. What do tests have to do with whether
    code is bad? To me, the answer is straightforward, and it is a point
    that I elaborate throughout the book:

	Code without tests is bad code. It doesn’t matter how well
	written it is; it doesn’t matter how pretty or object-oriented
	or well-encapsulated it is. With tests, we can change the
	behavior of our code quickly and verifiably. Without them, we
	really don’t know if our code is getting better or worse.

Just to drive this point home, let me pull out Exhibit A: The bug fix in
question, which is the latest (and hopefully last) commit in a _long_
chain of bug fixes that fix bugs introduced by preceding bug fixes:

- 9e4d308 (Cygwin: pipe: Adopt FILE_SYNCHRONOUS_IO_NONALERT flag for
  read pipe., 2021-11-10) fixed a bug where Cygwin hung by mistake while
  piping output from one .NET program as input to another .NET program
  (potentially introduced by 3651990 (Cygwin: pipe: Avoid false EOF
  while reading output of C# programs., 2021-11-07), which was itself a
  bug fix). It introduced a bug that was fixed by...
- fc691d0 (Cygwin: pipe: Make sure to set read pipe non-blocking for
  cygwin apps., 2024-03-11). Which introduced a bug that was purportedly
  fixed by...
- 7ed9adb (Cygwin: pipe: Switch pipe mode to blocking mode by
  default, 2024-09-05). Which introduced a bug that was fixed by...
- cbfaeba (Cygwin: pipe: Fix incorrect write length in raw_write(),
  2024-11-06). Which introduced a bug that was fixed by... the SSH hang
  fix in 0ae6a6f (Cygwin: pipe: Fix SSH hang with non-cygwin pipe
  reader, 2025-06-27).

There is not only the common thread here that each of these bug fixes
introduced a new bug, but also the common thread that none of the
commits introduced new test cases into the test suite that could
potentially have helped prevent future breakages in this code.

So let's at least add an integration test here.

Side note: I am quite unhappy with introducing integration tests. I know
there are a lot of fans out there, but I cannot help wondering whether
they favor the convenience of writing tests quickly over the vast cost
of making debugging any regression a highly cumbersome and unenjoyable
affair (try single-stepping through a test case that requires several
processes to be orchestrated in unison). Also, integration tests have
the large price of introducing moving parts outside the code base that
is actually to be tested, opening the door for breakages caused by
software (or infrastructure, think: network glitches!) that are
completely outside the power or responsibility of the poor engineer
tasked with fixing the breakages. Nevertheless, I have been unable
despite days of trying to wrap my head around the issue to figure out a
way to reproduce the `fhandler_pipe_fifo::raw_write()` hang without
involving a MINGW `git.exe` and an MSYS2/Cygwin `ssh.exe`. So: It's the
best I could do with any reasonable amount of effort. It's better to
have integration tests that would demonstrate regressions than not
having any tests for that at all.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
On hosted GitHub Actions runners, there is always this Log window
visible on the Desktop, and due to some magic logic, this window is
sometimes in the foreground on the `windows-2025` runners.

Let's minimize it so that it is out of the way and does not interfere
with the AutoHotKey-based UI tests.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
There have been way too many regressions in Cygwin as of late, in
particular in the console handling. The worst part? Many of those bugs
were introduced _in bug fix patches_!

Here are a bunch of tests that are designed to help Git for Windows
increase confidence in upgrades to newer Cygwin versions.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Bumps [actions/upload-artifact](https://github.com/actions/upload-artifact) from 4 to 5.
- [Release notes](https://github.com/actions/upload-artifact/releases)
- [Commits](actions/upload-artifact@v4...v5)

---
updated-dependencies:
- dependency-name: actions/upload-artifact
  dependency-version: '5'
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Originally-authored-by: dependabot[bot] <support@github.com>
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
…ows-2025-ui-tests-more-robust

ui-tests: minimize Log window
Bumps [actions/checkout](https://github.com/actions/checkout) from 5 to 6.
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](actions/checkout@v5...v6)

Bumps [actions/upload-artifact](https://github.com/actions/upload-artifact) from 5 to 6.
- [Release notes](https://github.com/actions/upload-artifact/releases)
- [Commits](actions/upload-artifact@v5...v6)

Originally-authored-by: dependabot[bot] <support@github.com>
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
…pload/download-artifact-actions

Upgrade `upload-artifact`/`download-artifact` Actions
…t/github_actions/actions/checkout-6

build(deps): bump actions/checkout from 5 to 6
@dscho
Copy link
Member Author

dscho commented Mar 3, 2026

/open pr

The workflow run was started

@dscho

This comment was marked as outdated.

@dscho dscho merged commit 8e8e091 into git-for-windows:main Mar 5, 2026
31 checks passed
@dscho dscho deleted the rebase-to-3.6.7 branch March 5, 2026 08:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.