-
Notifications
You must be signed in to change notification settings - Fork 489
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
msys2-runtime-3.3: backport a couple 3.4 patches
This corresponds to msys2/msys2-runtime#197. Signed-off-by: Johannes Schindelin <[email protected]>
- Loading branch information
Showing
7 changed files
with
320 additions
and
5 deletions.
There are no files selected for viewing
44 changes: 44 additions & 0 deletions
44
msys2-runtime-3.3/0051-Cygwin-console-Fix-hangup-of-less-on-quit-after-the-.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
From 8148ef7547f1fb8394810f9e24a28ebd2c83a375 Mon Sep 17 00:00:00 2001 | ||
From: Takashi Yano <[email protected]> | ||
Date: Thu, 22 Dec 2022 20:25:22 +0900 | ||
Subject: [PATCH 51/N] Cygwin: console: Fix hangup of less on quit after the | ||
window is resized. | ||
MIME-Version: 1.0 | ||
Content-Type: text/plain; charset=UTF-8 | ||
Content-Transfer-Encoding: 8bit | ||
|
||
https://cygwin.com/pipermail/cygwin/2022-December/252737.html | ||
|
||
If the less is started from non-cygwin shell and window size is | ||
changed, it will hang-up when quitting. The cause of the proglem is | ||
that less uses longjump() in signal handler. If the signal handler | ||
is called while cygwin is acquiring the mutex, cygwin loses the | ||
chance to release mutex. With this patch, the mutex is released | ||
just before calling kill_pgrp() and re-acquired when kill_pgrp() | ||
returns. | ||
|
||
[ma: dropped changes to release notes file from patch for backport] | ||
|
||
Reported-by: Gregory Mason <[email protected]> | ||
Signed-off-by: Takashi Yano <[email protected]> | ||
Signed-off-by: Matthias Aßhauer <[email protected]> | ||
--- | ||
winsup/cygwin/fhandler_console.cc | 4 ++++ | ||
1 file changed, 4 insertions(+) | ||
|
||
diff --git a/winsup/cygwin/fhandler_console.cc b/winsup/cygwin/fhandler_console.cc | ||
index b5594a6..e3a42ac 100644 | ||
--- a/winsup/cygwin/fhandler_console.cc | ||
+++ b/winsup/cygwin/fhandler_console.cc | ||
@@ -937,7 +937,11 @@ fhandler_console::send_winch_maybe () | ||
con.scroll_region.Bottom = -1; | ||
if (wincap.has_con_24bit_colors () && !con_is_legacy) | ||
fix_tab_position (get_output_handle ()); | ||
+ /* longjmp() may be called in the signal handler like less, | ||
+ so release input_mutex temporarily before kill_pgrp(). */ | ||
+ release_input_mutex (); | ||
get_ttyp ()->kill_pgrp (SIGWINCH); | ||
+ acquire_input_mutex (mutex_timeout); | ||
return true; | ||
} | ||
return false; |
49 changes: 49 additions & 0 deletions
49
msys2-runtime-3.3/0052-Adjust-CWD-magic-to-accommodate-for-the-latest-Windo.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
From b00763c145a60347e6cb41a1b5876e08e09887a7 Mon Sep 17 00:00:00 2001 | ||
From: Johannes Schindelin <[email protected]> | ||
Date: Fri, 12 May 2023 13:37:56 +0200 | ||
Subject: [PATCH 52/N] Adjust CWD magic to accommodate for the latest Windows | ||
previews | ||
|
||
Reportedly Windows 11 build 25*** from Insider changed the current | ||
working directory logic a bit, and Cygwin's "magic" (or: | ||
"technologically sufficiently advanced") code needs to be adjusted | ||
accordingly. | ||
|
||
This fixes https://github.com/git-for-windows/git/issues/4429 | ||
|
||
Signed-off-by: Johannes Schindelin <[email protected]> | ||
--- | ||
winsup/cygwin/path.cc | 18 ++++++++++++++++-- | ||
1 file changed, 16 insertions(+), 2 deletions(-) | ||
|
||
diff --git a/winsup/cygwin/path.cc b/winsup/cygwin/path.cc | ||
index e191b9e..27e203b 100644 | ||
--- a/winsup/cygwin/path.cc | ||
+++ b/winsup/cygwin/path.cc | ||
@@ -4873,10 +4873,24 @@ find_fast_cwd_pointer () | ||
or, then `mov %r12,%rcx', then `callq RtlEnterCriticalSection'. */ | ||
lock = (const uint8_t *) memmem ((const char *) use_cwd, 80, | ||
"\x4c\x8d\x25", 3); | ||
- if (!lock) | ||
- return NULL; | ||
call_rtl_offset = 14; | ||
} | ||
+ | ||
+ if (!lock) | ||
+ { | ||
+ /* A recent Windows Preview calls `lea rel(rip),%r13' then | ||
+ some unrelated instructions, then `callq RtlEnterCriticalSection'. | ||
+ */ | ||
+ lock = (const uint8_t *) memmem ((const char *) use_cwd, 80, | ||
+ "\x4c\x8d\x2d", 3); | ||
+ call_rtl_offset = 24; | ||
+ } | ||
+ | ||
+ if (!lock) | ||
+ { | ||
+ return NULL; | ||
+ } | ||
+ | ||
PRTL_CRITICAL_SECTION lockaddr = | ||
(PRTL_CRITICAL_SECTION) (lock + 7 + peek32 (lock + 3)); | ||
/* Test if lock address is FastPebLock. */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
From 99b8001f7d6456cddd4db254016321e4e9449353 Mon Sep 17 00:00:00 2001 | ||
From: Christoph Reiter <[email protected]> | ||
Date: Fri, 10 Nov 2023 15:31:10 +0100 | ||
Subject: [PATCH 53/N] CI: fix the build with gcc 13 | ||
|
||
--- | ||
.github/workflows/build.yaml | 5 +++++ | ||
1 file changed, 5 insertions(+) | ||
|
||
diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml | ||
index 1775bb9..f89cfcb 100644 | ||
--- a/.github/workflows/build.yaml | ||
+++ b/.github/workflows/build.yaml | ||
@@ -20,6 +20,11 @@ jobs: | ||
- name: Build | ||
shell: msys2 {0} | ||
run: | | ||
+ # XXX: cygwin still uses gcc v11 so we get new warnings with v13, | ||
+ # resulting in errors. We can't selectively disable warnigns since our | ||
+ # cross compiler is also too old and doesn't understand the new | ||
+ # warning flags, so we need to disable all errors for now. | ||
+ export CXXFLAGS="-Wno-error -Wno-narrowing" | ||
(cd winsup && ./autogen.sh) | ||
./configure --disable-dependency-tracking | ||
make -j8 |
30 changes: 30 additions & 0 deletions
30
msys2-runtime-3.3/0054-fixup-Add-functionality-for-converting-UNIX-paths-in.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
From b9149f75436c8a912e3edbcae9f66324e596f151 Mon Sep 17 00:00:00 2001 | ||
From: Kai Pastor <[email protected]> | ||
Date: Tue, 21 Nov 2023 09:24:03 +0100 | ||
Subject: [PATCH 54/N] fixup! Add functionality for converting UNIX paths in | ||
arguments and environment variables to Windows form for native Win32 | ||
applications. | ||
|
||
Don't memchr behind end, it+1 | ||
--- | ||
winsup/cygwin/msys2_path_conv.cc | 7 +++++++ | ||
1 file changed, 7 insertions(+) | ||
|
||
diff --git a/winsup/cygwin/msys2_path_conv.cc b/winsup/cygwin/msys2_path_conv.cc | ||
index ebf47d6..e6f8f7c 100644 | ||
--- a/winsup/cygwin/msys2_path_conv.cc | ||
+++ b/winsup/cygwin/msys2_path_conv.cc | ||
@@ -346,6 +346,13 @@ path_type find_path_start_and_type(const char** src, int recurse, const char* en | ||
|
||
path_type result = NONE; | ||
|
||
+ if (it + 1 == end) { | ||
+ switch (*it) { | ||
+ case '/': return ROOTED_PATH ; | ||
+ default: return SIMPLE_WINDOWS_PATH; | ||
+ } | ||
+ } | ||
+ | ||
if (isalpha(*it) && *(it + 1) == ':') { | ||
if (*(it + 2) == '\\') { | ||
return SIMPLE_WINDOWS_PATH; |
34 changes: 34 additions & 0 deletions
34
msys2-runtime-3.3/0055-fixup-Add-functionality-for-converting-UNIX-paths-in.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
From 6a4927f2daba82f3a08ffb68c342394a33e68944 Mon Sep 17 00:00:00 2001 | ||
From: Kai Pastor <[email protected]> | ||
Date: Tue, 21 Nov 2023 09:25:58 +0100 | ||
Subject: [PATCH 55/N] fixup! Add functionality for converting UNIX paths in | ||
arguments and environment variables to Windows form for native Win32 | ||
applications. | ||
|
||
Don't memchr behind end, it2 | ||
--- | ||
winsup/cygwin/msys2_path_conv.cc | 4 ++-- | ||
1 file changed, 2 insertions(+), 2 deletions(-) | ||
|
||
diff --git a/winsup/cygwin/msys2_path_conv.cc b/winsup/cygwin/msys2_path_conv.cc | ||
index e6f8f7c..68cd6cc 100644 | ||
--- a/winsup/cygwin/msys2_path_conv.cc | ||
+++ b/winsup/cygwin/msys2_path_conv.cc | ||
@@ -428,7 +428,7 @@ path_type find_path_start_and_type(const char** src, int recurse, const char* en | ||
if (isalpha(ch) && (*(it2+1) == ':') && (*(it2+2) == '/')) { | ||
return SIMPLE_WINDOWS_PATH; | ||
} | ||
- if (ch == '/'&& memchr(it2, ',', end - it) == NULL) { | ||
+ if (ch == '/'&& memchr(it2, ',', end - it2) == NULL) { | ||
*src = it2; | ||
return find_path_start_and_type(src, true, end); | ||
} | ||
@@ -455,7 +455,7 @@ path_type find_path_start_and_type(const char** src, int recurse, const char* en | ||
} else { | ||
return POSIX_PATH_LIST; | ||
} | ||
- } else if (memchr(it2, '=', end - it) == NULL) { | ||
+ } else if (memchr(it2, '=', end - it2) == NULL) { | ||
return SIMPLE_WINDOWS_PATH; | ||
} | ||
} |
115 changes: 115 additions & 0 deletions
115
msys2-runtime-3.3/0056-nlsfuncs-work-around-an-overzealous-GCC-warning.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,115 @@ | ||
From 3cba82a63c4f3a8c10565ab531fb64a5d2117474 Mon Sep 17 00:00:00 2001 | ||
From: Johannes Schindelin <[email protected]> | ||
Date: Sat, 25 Nov 2023 02:25:00 +0100 | ||
Subject: [PATCH 56/N] nlsfuncs: work around an overzealous GCC warning | ||
|
||
GCC 13 (and maybe 12, too), warn about pointers used after `free()`. | ||
|
||
In `nlsfuncs.cc`, they are used on purpose, though, in | ||
`rebase_locale_buf()`, to adjust pointers that were invalidated because | ||
of a `realloc()` (not a `free()`, actually). | ||
|
||
So let's shush GCC about those instances. | ||
|
||
However, we must be careful only to do that with GCC >= 12 because older | ||
versions would complain about an unknown warning... | ||
|
||
Signed-off-by: Johannes Schindelin <[email protected]> | ||
--- | ||
winsup/cygwin/nlsfuncs.cc | 30 ++++++++++++++++++++++++++++++ | ||
1 file changed, 30 insertions(+) | ||
|
||
diff --git a/winsup/cygwin/nlsfuncs.cc b/winsup/cygwin/nlsfuncs.cc | ||
index a518d2b..0d1e692 100644 | ||
--- a/winsup/cygwin/nlsfuncs.cc | ||
+++ b/winsup/cygwin/nlsfuncs.cc | ||
@@ -255,8 +255,13 @@ rebase_locale_buf (const void *ptrv, const void *ptrvend, const char *newbase, | ||
{ | ||
const char **ptrsend = (const char **) ptrvend; | ||
for (const char **ptrs = (const char **) ptrv; ptrs < ptrsend; ++ptrs) | ||
+#pragma GCC diagnostic push | ||
+#if __GNUC__ >= 12 | ||
+#pragma GCC diagnostic ignored "-Wuse-after-free" | ||
+#endif | ||
if (*ptrs >= oldbase && *ptrs < oldend) | ||
*ptrs += newbase - oldbase; | ||
+#pragma GCC diagnostic pop | ||
} | ||
|
||
static wchar_t * | ||
@@ -613,10 +618,15 @@ __set_lc_time_from_win (const char *name, | ||
era = NULL; | ||
else | ||
{ | ||
+#pragma GCC diagnostic push | ||
+#if __GNUC__ >= 12 | ||
+#pragma GCC diagnostic ignored "-Wuse-after-free" | ||
+#endif | ||
if (tmp != new_lc_time_buf) | ||
rebase_locale_buf (_time_locale, _time_locale + 1, tmp, | ||
new_lc_time_buf, lc_time_ptr); | ||
lc_time_ptr = tmp + (lc_time_ptr - new_lc_time_buf); | ||
+#pragma GCC diagnostic pop | ||
new_lc_time_buf = tmp; | ||
lc_time_end = new_lc_time_buf + len; | ||
} | ||
@@ -675,9 +685,14 @@ __set_lc_time_from_win (const char *name, | ||
free (new_lc_time_buf); | ||
return -1; | ||
} | ||
+#pragma GCC diagnostic push | ||
+#if __GNUC__ >= 12 | ||
+#pragma GCC diagnostic ignored "-Wuse-after-free" | ||
+#endif | ||
if (tmp != new_lc_time_buf) | ||
rebase_locale_buf (_time_locale, _time_locale + 1, tmp, | ||
new_lc_time_buf, lc_time_ptr); | ||
+#pragma GCC diagnostic pop | ||
*lc_time_buf = tmp; | ||
return 1; | ||
} | ||
@@ -747,9 +762,14 @@ __set_lc_ctype_from_win (const char *name, | ||
free (new_lc_ctype_buf); | ||
return -1; | ||
} | ||
+#pragma GCC diagnostic push | ||
+#if __GNUC__ >= 12 | ||
+#pragma GCC diagnostic ignored "-Wuse-after-free" | ||
+#endif | ||
if (tmp != new_lc_ctype_buf) | ||
rebase_locale_buf (_ctype_locale, _ctype_locale + 1, tmp, | ||
new_lc_ctype_buf, lc_ctype_ptr); | ||
+#pragma GCC diagnostic pop | ||
*lc_ctype_buf = tmp; | ||
return 1; | ||
} | ||
@@ -822,9 +842,14 @@ __set_lc_numeric_from_win (const char *name, | ||
free (new_lc_numeric_buf); | ||
return -1; | ||
} | ||
+#pragma GCC diagnostic push | ||
+#if __GNUC__ >= 12 | ||
+#pragma GCC diagnostic ignored "-Wuse-after-free" | ||
+#endif | ||
if (tmp != new_lc_numeric_buf) | ||
rebase_locale_buf (_numeric_locale, _numeric_locale + 1, tmp, | ||
new_lc_numeric_buf, lc_numeric_ptr); | ||
+#pragma GCC diagnostic pop | ||
*lc_numeric_buf = tmp; | ||
return 1; | ||
} | ||
@@ -959,9 +984,14 @@ __set_lc_monetary_from_win (const char *name, | ||
free (new_lc_monetary_buf); | ||
return -1; | ||
} | ||
+#pragma GCC diagnostic push | ||
+#if __GNUC__ >= 12 | ||
+#pragma GCC diagnostic ignored "-Wuse-after-free" | ||
+#endif | ||
if (tmp != new_lc_monetary_buf) | ||
rebase_locale_buf (_monetary_locale, _monetary_locale + 1, tmp, | ||
new_lc_monetary_buf, lc_monetary_ptr); | ||
+#pragma GCC diagnostic pop | ||
*lc_monetary_buf = tmp; | ||
return 1; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters