Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update to MSYS2 runtime v3.4.10 #62

Merged
merged 92 commits into from
Nov 29, 2023

Conversation

dscho
Copy link
Member

@dscho dscho commented Nov 29, 2023

Range-diff of the Git for Windows-only patches relative to the current main branch
  • 1: 6b376b9 = 1: 3ec60ab Handle 8-bit characters under LOCALE=C

  • 2: 3e71002 = 2: e66db6a Mention the extremely useful small_printf() function

  • 3: 63c0e97 = 3: 7209d82 Leave arguments starting with a tilde or quote alone

  • 4: f90152f = 4: cb6a025 Leave Git's :name and :/message arguments alone, please

  • 5: e03e374 = 5: 8ec99b7 Leave paths containing any special characters alone

  • 6: 0ea33f2 = 6: a84de1f Leave paths containing '/~' alone

  • 7: eb0accd = 7: bb07556 Skip posix-to-windows conversion when '::' is seen

  • 8: d8a47ae = 8: 331f11c Also leave Git's :./ syntax alone

  • 9: 6ee0976 = 9: 80323e9 Arguments starting with '@@' are no paths

  • 10: 39910e3 ! 10: a91afd4 Prevent scp-style arguments from being mangled

    @@ winsup/cygwin/msys2_path_conv.cc: skip_p2w:
     +                        goto skip_p2w;
                          return POSIX_PATH_LIST;
                      }
    -             } else if (memchr(it2, '=', end - it) == NULL) {
    +             } else if (memchr(it2, '=', end - it2) == NULL) {
                      return SIMPLE_WINDOWS_PATH;
                  }
     +        } else if (ch != '.') {
  • 11: 6947249 = 11: 81a0e5d Allow overriding the home directory via the HOME variable

  • 12: 9fb1991 = 12: 5246c13 Fixed path converting with non ascii char.

  • 13: b70eab5 = 13: 22854f6 Respect db_home setting even for the SYSTEM account

  • 14: 49602d1 = 14: 78a29ea path-conversion: Introduce ability to switch off conversion.

  • 15: 0807f4b = 15: f0d5641 Respect the db_home: env setting under more circumstances

  • 17: 0362055 = 16: cebf577 Make paths' WCS->MBS conversion explicit

  • 16: a92e510 = 17: 51451db Allow native symlinks to non-existing targets in 'nativestrict' mode

  • 18: 4d86367 = 18: c2f3cdd Avoid sharing cygheaps across Cygwin versions

  • 19: 9ad0bae = 19: e668c81 Use MB_CUR_MAX == 6 by default

  • 20: d8f626b = 20: 10faa7e Change the default base address for x86_64

  • 21: 4dcf1bd = 21: 013e4d6 Do not try to sync with Cygwin

  • 22: dbd0a16 = 22: 20469e7 uname: report msys2-runtime commit hash, too

  • 23: 10d77b5 = 23: 2bd5e69 Revert "Cygwin: pipe: Restore blocking mode for cygwin process at startup."

  • 24: a9a875c = 24: 0ad833b msys2-runtime: restore fast path for current user primary group

  • 25: 78f82c3 < -: ---------- CI: fix the build with gcc 13

  • 26: 0e7d075 < -: ---------- fixup! Add functionality for converting UNIX paths in arguments and environment variables to Windows form for native Win32 applications.

  • 27: 677ece6 < -: ---------- fixup! Add functionality for converting UNIX paths in arguments and environment variables to Windows form for native Win32 applications.

The only non-obvious thing is that the three patches that I merged from msys2-3.4.9 in #60 are shown as "removed" because they are now part of the patches coming in via 5b45686.

github-cygwin and others added 30 commits September 6, 2023 12:40
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
Add a missing "void" to the prototype for __cpuset_zero_s().

Reported-by: Marco Mason <marco.mason@gmail.com>
Addresses: https://cygwin.com/pipermail/cygwin/2023-September/254423.html
Signed-off-by: Mark Geisert <mark@maxrnd.com>
Fixes: c6cfc99648d6 (Cygwin: sys/cpuset.h: add cpuset-specific external functions)
(cherry picked from commit 003fc33)
Document the most recent update to include/sys/cpuset.h.

(cherry picked from commit 27e8815)
If app is killed during blocking write(), it sometimes hangs. This
patch fixes the issue.

Signed-off-by: Takashi Yano <takashi.yano@nifty.ne.jp>
cwdstuff::set has a code snippet handling the case where a process
can't create a handle to a directory, e. g., due to permissions.

Commit 88443b0 ("cwdstuff: Don't leave from setting the CWD
prematurely on init") introduced a special case to handle this
situation at process initialization. It also introduces an early
mutex release, which is not required, but ok, because we're in the
init phase. Releasing the mutex twice is no problem since the mutexes
are recursive.

Fast forward to commit 0819679 ("Cygwin: cwd: use SRWLOCK
instead of muto"). The mechanical change from a recursive mutex
to a non-recursive SRWLOCK failed to notice that this very specific
situation will release the SRWLOCK twice.

Remove the superfluous release action. While at it, don't set dir to
NULL, but h, since dir will get the value of h anyway later on.
Setting h to NULL may not be necessary, but better safe than sorry.

Reported-by: tryandbuy >tryandbuy@proton.me>
Fixes: 88443b0 ("cwdstuff: Don't leave from setting the CWD prematurely on init")
Fixes: 0819679 ("Cygwin: cwd: use SRWLOCK instead of muto")
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
The exception handling inside of Cygwin functions marked as SIGFE
covers exceptions and lets the library code handle them gracefully.
If these functions want to raise an exception, they have to send a
signal explicitely via raise(3).

That's not what we want in feraiseexcept(). It triggers a floating
point exception explicitely by calling the i387 op "fwait".  Being
marked as SIGFE, this exception will be suppressed and the normal
exception handling won't kick in.

Fix this by moving feraiseexcept into the NOSIGFE realm.

Fixes: 0f81b5d ("* Makefile.in (DLL_OFILES): Add new fenv.o module.")
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
Add locking to the random(3) family of functions to gain
thread-safety per POSIX. Use NetBSD version of the file as
role-model.

Reported-by: Bruno Haible <bruno@clisp.org>
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
Also drop includes only required for srandomdev().

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
Minor updates to profiler and gmondump, which share some code:
- fix operation of error() so it actually works as intended
- resize 4K-size auto buffer reservations to BUFSIZ (==1K)
- remove trailing '\n' from 2nd arg on error() calls everywhere
- provide consistent annotation of Windows error number displays

Fixes: 9887fb27f6126 ("Cygwin: New tool: profiler")
Fixes: 087a3d76d7335 ("Cygwin: New tool: gmondump")
Signed-off-by: Mark Geisert <mark@maxrnd.com>
This makes rand(3) ISO C compliant and adds locking to avoid
race conditions.

Reported-by: Bruno Haible <bruno@clisp.org>
Fixes: 8a0efa5 ("import newlib-2000-02-17 snapshot")
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
Previously, e.g. nl_langinfo(_NL_TIME_WMONTH_1) returns "February"
due to the bug. Similarly, nl_langinfo(_NL_TIME_WWDAY_1) returns
"Mon". This occurs because wide char month and weekday arrays are
pointed off-by-one (e.g. the array wmon[12] is reffered as wmon[1-12]
rather than wmon[0-11]). This patch fixes that.

Fixes: d47d5b8 ("Extend locale support to maintain wide char values of native strings")
Reviewed-by: Corinna Vinschen <corinna@vinschen.de>
Signed-off-by: Takashi Yano <takashi.yano@nifty.ne.jp>
The fhandler method ftruncate returns either EISDIR if it has been
called on directories, or EINVAL if called on files other than
regular files.  This matches what ftruncate(2) is supposed to return,
but it doesn't match posix_fallocate(3), which is supposed to return
ENODEV in both cases.

To accomplish that, return ENODEV from fhandler_base::ftruncate()
and convert it to EINVAL in ftruncate(2). In posix_fallocate(3),
convert EISDIR to ENODEV.

Fixes: 7636b58 ("* autoload.cc (NtSetInformationFile): Define.")
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
open(2) implements O_TRUNC by just reducing the size of the file
to 0, to make sure EAs stay available.

Turns out, file sparseness is not removed this way either, so add
code to do just that.

Fixes: 603ef54 ("* fhandler.cc (fhandler_base::open): Never open files with  FILE_OVERWITE/FILE_OVERWRITE_IF.")
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
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>
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.
When converting `/c/` to `C:\`, the trailing slash is actually really
necessary, as `C:` is not an absolute path.

We must be very careful to do this only for root directories, though. If
we kept the trailing slash also for, say, `/y/directory/`, we would run
into the following issue: On FAT file systems, the normalized path is
used to fake inode numbers. As a result, `Y:\directory\` and
`Y:\directory` have different inode numbers!!!

This would result in very non-obvious symptoms. Back when we were too
careless about keeping the trailing slash, it was reported to the Git
for Windows project that the `find` and `rm` commands can error out on
FAT file systems with very confusing "No such file or directory" errors,
for no good reason.

During the original investigation, Vasil Minkov pointed out in
git-for-windows/git#1497 (comment),
that this bug had been fixed in Cygwin as early as 1997... and the bug
was unfortunately reintroduced into early MSYS2 versions.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Otherwise if globbing is allowed and we get called from a
Windows program, build_argv thinks we've been called from
a Cygwin program.
…spec

Reverts 25ba8f3. I can't figure out what
the intention was. I'm sure I'll find out soon enough when everything breaks.

This change means that input of:
  '"C:/test.exe SOME_VAR=\"literal quotes\""'

becomes:
  'C:/test.exe SOME_VAR="literal quotes"'

instead of:
  'C:/test.exe SOME_VAR=\literal quotes\'

.. which is at least consistent with the result for:
  '"no_drive_or_colon SOME_VAR=\"literal quotes\""'

The old result of course resulted in the quoted string being split into
two arguments at the space which is clearly not intended.

I *guess* backslashes in dos paths may have been the issue here?
If so I don't care since we should not use them, ever, esp. not at
the expense of sensible forward-slash-containing input.
Commit message for this code was:

* strace.cc (create_child): Set CYGWIN=noglob when starting new process so that

  Cygwin will leave already-parsed the command line alonw."

I can see no reason for it and it badly breaks the ability to use
strace.exe to investigate calling a Cygwin program from a Windows
program, for example:
strace mingw32-make.exe
.. where mingw32-make.exe finds sh.exe and uses it as the shell.
The reason it badly breaks this use-case is because dcrt0.cc depends
on globbing to happen to parse commandlines from Windows programs;
irrespective of whether they contain any glob patterns or not.

See quoted () comment:
"This must have been run from a Windows shell, so preserve
 quotes for globify to play with later."
Works very much like MSYS2_ARG_CONV_EXCL. In fact it uses the same
function, arg_heuristic_with_exclusions (). Also refactors parsing
the env. variables to use new function, string_split_delimited ().

The env. that is searched through is the merged (POSIX + Windows)
one. It remains to be seen if this should be made an option or not.

This feature was prompted because the R language (Windows exe) calls
bash to run configure.win, which then calls back into R to read its
config variables (LOCAL_SOFT) and when this happens, msys2-runtime
converts R_ARCH from "/x64" to an absolute Windows path and appends
it to another absolute path, R_HOME, forming an invalid path.
dscho and others added 24 commits November 29, 2023 23:07
In Git for Windows, it is a well-established technique to use the
`$HOME` variable to define where the current user's home directory is,
falling back to `$HOMEDRIVE$HOMEPATH` and `$USERPROFILE`.

This strategy is particular important when Cygwin, or command-line
programs depending on the HOME variable, cannot cope with the Windows'
idea of the user's home directory e.g. when it is set to a hidden
directory via an UNC path (\\share\some\hidden\folder$).

Of course this strategy needs to be opt-in. For that reason, this
strategy is activated via the `env` keyword in the `db_home` line in
`/etc/nsswitch.conf`.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
When a non ascii char is at the beginning of a path the current conversion
destroys the path. This fix will prevent this with an extra check for
non-ascii UTF-8 characters.

Helped-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: 마누엘 <nalla@hamal.uberspace.de>
We should not blindly set the home directory of the SYSTEM account to
/home/SYSTEM, especially not when that value disagrees with what is
configured via the `db_home` line in the `/etc/nsswitch.conf` file.

This fixes git-for-windows/git#435

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
When calling windows native apps from MSYS2, the runtime tries to convert
commandline arguments by a specific set of rules. See [MinGW wiki]
(http://www.mingw.org/wiki/Posix_path_conversion).

If the user does not want that behavior on a big scale, e.g. inside a bash
script, the user can now set the the environment variable
`MSYS_NO_PATHCONV` when calling native windows commands.

Signed-off-by: 마누엘 <nalla@hamal.uberspace.de>
In particular when we cannot figure out a uid for the current user, we
should still respect the `db_home: env` setting. Such a situation occurs
for example when the domain returned by `LookupAccountSid()` is not our
machine name and at the same time our machine is no domain member: In
that case, we have nobody to ask for the POSIX offset necessary to come
up with the uid.

It is important that even in such cases, the HOME environment variable
can be used to override the home directory, e.g. when Git for Windows is
used by an account that was generated on the fly, e.g. for transient use
in a cloud scenario.

Reported by David Ebbo.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
	* dcrt0.cc (dll_crt0_1), dtable.cc (handle_to_fn), environ.cc
	(environ_init, getwinenveq, build_env), external.cc
	(fillout_pinfo), fhandler_disk_file.cc (__DIR_mounts::eval_ino,
	fhandler_disk_file::readdir_helper), fhandler_netdrive.cc
	(fhandler_netdrive::readdir), fhandler_process.cc
	(format_process_winexename, format_process_maps,
	format_process_stat, format_process_status), fhandler_procsys.cc
	(fill_filebuf, fhandler_procsys::readdir), mount.cc
	(fs_info::update, mount_info::create_root_entry,
	mount_info::conv_to_posix_path, mount_info::from_fstab_line),
	nlsfuncs.cc (internal_setlocale), path.cc (path_conv::check,
	sysmlink_info::check_shortcut, symlink_info::check_sysfile,
	symlink_info::check_reparse_point,
	symlink_info::check_nfs_symlink, cygwin_conv_path,
	cygwin_conv_path_list, cwdstuff::get_error_desc, cwdstuff::get),
	strfuncs.cc (sys_wcstombs_no_path, sys_wcstombs_alloc_no_path),
	uinfo.cc (ontherange, fetch_from_path, cygheap_pwdgrp::get_home,
	cygheap_pwdgrp::get_shell, cygheap_pwdgrp::get_gecos), wchar.h
	(sys_wcstombs_no_path, sys_wcstombs_alloc_no_path): Convert call
	sites of the sys_wcstombs*() family to specify explicitly when the
	parameter refers to a path or file name, to avoid future
	misconversions.

Detailed explanation:

The sys_wcstombs() function contains special handling for paths/file
names, to work around file name restriction on Windows that are
unexpected in the POSIX context of Cygwin.

We actually do not want that special handling for WCS strings that
do *not* refer to paths or file names.

Neither do we want to convert those special file names unless they come
from inside Cygwin: if the source of the string value is the Windows API,
we *know* it cannot be such a special file name because Windows itself
would not be able to handle it in the way Cygwin does.

So let's switch the previous sys_wcstombs()/sys_wcstombs_no_path() (and
the *_alloc* variant) around to sys_wcstombs_path()/sys_wcstombs(). We do
this for several reasons:

- whenever a call site wants to convert a WCS representation of a path or
  file name to an MBS one, it should be made very clear that we *want* the
  special file name conversion to happen.

- it is shorter to read and write.

- future calls to sys_wcstombs() will not incur unwanted conversion by
  accident (it is easy for unsuspecting programmers to assume that the
  function name "sys_wcstombs()" refers to a regular text conversion that
  has nothing to do with paths or filenames).

By keeping the name sys_wcstombs() (and not switching to
sys_wcstombs_path()), the following call sites are implicitly changed to
*exclude* the special path/file name conversion:

cygheap.h (get_drive):
	Cannot contain special characters

external.cc (cygwin_internal):
	Refers to user/domain names, not paths

fhandler_clipboard.cc (fhandler_dev_clipboard::read):
	Is not a path or file name but characters from the Windows
	clipboard

fhandler_console.cc: (dev_console::con_to_str):
	Is not a path or file name but characters from the console

fhandler_registry.cc (encode_regname):
	Is a registry key, not a path or filename

fhandler_registry.cc (multi_wcstombs):
	All call sites pass registry values, not paths or filenames

fhandler_registry.cc (fstat):
	Is a registry value, not a path or filename

fhandler_registry.cc (fill_filebuf):
	Is a registry value, not a path or filename

net.cc (get_ipv4fromreg):
	Is a registry value, not a path or filename

net.cc (get_friendlyname):
	Is a device name, not a path or filename

netdb.cc (open_system_file):
	Is from outside Cygwin

smallprint.cc (__small_vsprintf):
	Is a free text, not a path or filename

strfuncs.cc (strlwr):
	Should preserve the characters from the private page if there
	are any

strfuncs.cc (strupr):
	Should preserve the characters from the private page if there
	are any

uinfo.cc (cygheap_user::init):
	Refers to a user name, not a path or filename

uinfo.cc (pwdgrp::fetch_account_from_windows):
	Refers to value from outside Cygwin

By keeping the function name sys_wcstombs_alloc() (and not changing it to
sys_wcstombs_alloc_path()), the following call sites are implicitly
changed to *exclude* the special path/file name conversion:

ldap.cc (cyg_ldap::remap_uid):
	Refers to a user name, not a path or filename

ldap.cc (cyg_ldap::remap_gid):
	Refers to a group name, not a path or filename

pinfo.cc (_pinfo::cmdline):
	Refers to a command line from Windows, outside Cygwin

uinfo.cc (cygheap_user::env_logsrv):
	Is a server name, not a path or filename

uinfo.cc (cygheap_user::env_domain):
	Refers to the user/domain name, not a path or filename

uinfo.cc (cygheap_user::env_userprofile):
	Refers to Windows' idea of a path, outside Cygwin

uinfo.cc (cygheap_user::env_systemroot):
	Refers to Windows' idea of a path, outside Cygwin

uinfo.cc (fetch_from_description):
	Refers to values from outside of Cygwin

uinfo.cc (cygheap_pwdgrp::get_gecos):
	Refers to user/domain name and email address, not path nor filename

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Windows native symlinks must match the type of their target (file or
directory), otherwise native Windows tools will fail. Creating symlinks in
'nativestrict' mode currently requires the target to exist in order to
check its type.

However, the target of a symlink can change at any time after the symlink
has been created. Thus users of native symlinks must be prepared to deal
with type mismatches anyway. Checking the target type at symlink creation
time is not a good reason to violate the symlink() API specification.

In 'nativestrict' mode, always create native symlinks. Choose the symlink
type according to the target if it exists. Otherwise check the target path
for a trailing '/' as hint to create a directory symlink.

This allows callers to explicitly specify the expected target type, e.g.:

  $ ln -s test/ link-to-test
  $ mkdir test

Signed-off-by: Karsten Blees <blees@dcon.de>
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Allow overriding the home directory via the HOME variable
It frequently leads to problems when trying, say, to call from Git for
Windows' Bash into Cygwin's or MSYS2's, merely because sharing that data
is pretty finicky.

For example, using the Git for Windows that is current at time of
writing, trying to call MSYS2's Bash from Git for Windows' Bash fails
somewhere in `_cmalloc()`, without any error message, and with the
rather misleading exit code 127 (a code which is reserved to indicate
that a command was not found).

Let's just treat these as completely incompatible with one another, by
virtue of using a different `CHILD_INFO_MAGIC` constant.

Let's take the msys2-runtime commit as the tell-tale whether two MSYS2
runtime versions are compatible with each other. To support building in
the MSYS2-packages repository (where we do not check out the
`msys2-runtime` but instead check out Cygwin and apply patches on top),
let's accept a hard-coded commit hash as `./configure` option.

One consequence is that spawned MSYS processes using a different MSYS2
runtime will not be visible as such to the parent process, i.e. they
cannot share any resources such as pseudo terminals. But that's okay,
they are simply treated as if they were regular Win32 programs.

This should also help the scenario where interactions between two
different versions of Git for Windows lead to those infamous `cygheap
base mismatch detected` problems mentioned e.g. in
git-for-windows/git#4255

Note: We have to use a very rare form of encoding the brackets in the
`expr` calls: quadrigraphs (for a thorough explanation, see
https://www.gnu.org/savannah-checkouts/gnu/autoconf/manual/autoconf-2.70/html_node/Quadrigraphs.html#Quadrigraphs).
This is necessary because it is apparently impossible in `configure.ac`
files to encode brackets otherwise.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Internally, Cygwin already uses __utf8_mbtowc(), even if it still claims
to use the "ASCII" charset.

But the `MB_CUR_MAX` value (which is not actually a constant, but
dependent on the current locale) was still 1, which broke the initial
`globify()` call while parsing the the command-line in `build_argv()`
for non-ASCII arguments.

This fixes git-for-windows/git#2189

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Allow native symlinks to non-existing targets in 'nativestrict' mode
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>
This is a forked repository...

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Having just Cygwin's version in the output of `uname` is not helpful as
both MSYS2 as well as Git for Windows release intermediate versions of
the MSYS2 runtime much more often than Cygwin runtime versions are
released.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
…rtup."

When Git for Windows upgraded its MSYS2 runtime from v3.3.* to v3.4.* at
long last, the t3701-add-interactive test of Git's test suite started to
hang consistently, timing out.

The culprit is a `git add -p` call that wants to read from a diff
filter. This diff filter is `cat.exe`, i.e. nothing special, but that
diff filter gets input that is larger than the pipe buffer, and
therefore must not block. Yet that is exactly what it does.

This was a regression that introduced by upgrading from MSYS2 runtime
v3.3.*. After a tedious, multi-day bisection session, the commit
introducing that regression was identified as 9078882 (Cygwin: pipe:
Restore blocking mode for cygwin process at startup., 2021-11-17), which
we hereby revert.

So what bug does this reversion reintroduce?

The commit seems to have been in response to
https://inbox.sourceware.org/cygwin/CAEv6GOB8PXHgHoz7hdJy6Bia2GWEmUDnTd252gTGinz2vuv=hA@mail.gmail.com/
which reported a bug when a C# program writes 0-byte content to a Cygwin
pipe. (Irony of ironies, this report originated from Git's realm, over
at git-ecosystem/git-credential-manager#509.)

The analysis revealed, back in December '21, that a `CYGWIN=pipe_byte`
would work around the bug, too, but that did not fix the regression in
Git's test suite.

That leaves us with the somewhat unsatisfying conclusion that we _might_
reintroduce a regression when Git Credential Manager tries to talk to an
_MSYS_ `git.exe`. But since we do not need that in Git for Windows, and
since we need to have CI builds that do not time out after 6h causing
failures, it is better to revert that commit, and in the hopefully
unlikely event that this causes _other_ problems in Git for Windows'
ecosystem, we will simply have to revisit this issue in more depth.

This fixes git-for-windows/git#4422.

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

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Unlike MSYS2, we do not need to constantly sync tags with Cygwin.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
…ys2-runtime-versions-from-sharing-cygheaps

Avoid sharing cygheaps across Cygwin versions
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>
 Fix hanging t3701-add-interactive in Git's test suite (git-for-windows#51)

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
msys2-runtime: restore fast path for current user primary group
@dscho dscho self-assigned this Nov 29, 2023
dscho added a commit to dscho/MSYS2-packages that referenced this pull request Nov 29, 2023
This commit corresponds to
git-for-windows/msys2-runtime#62.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
@dscho dscho merged commit b7b5f3a into git-for-windows:main Nov 29, 2023
2 checks passed
@dscho dscho deleted the msys2-runtime-v3.4.10 branch November 29, 2023 22:28
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.