forked from msys2/MSYS2-packages
-
Notifications
You must be signed in to change notification settings - Fork 32
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 important fixes from 3.4
We haven't updated the i686 variant of Git for Windows' MSYS2 runtime. The recent "Bad address" fixes (in this commit, 0068 and 0069) seem to be important to warrant a new package version, and while at it, backport a couple of other relevant patches as well as build fixes for GCC >= 13. Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
- Loading branch information
Showing
9 changed files
with
369 additions
and
5 deletions.
There are no files selected for viewing
57 changes: 57 additions & 0 deletions
57
msys2-runtime-3.3/0065-Optionally-disallow-empty-environment-values-again.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,57 @@ | ||
From 3434791039d7f0c20005b614973c196fbce59f53 Mon Sep 17 00:00:00 2001 | ||
From: Johannes Schindelin <johannes.schindelin@gmx.de> | ||
Date: Tue, 6 Sep 2022 10:40:58 +0200 | ||
Subject: [PATCH 65/N] Optionally disallow empty environment values again | ||
|
||
We just disabled the code that skips environment variables whose values | ||
are empty. | ||
|
||
However, this code was introduced a long time ago into Cygwin in | ||
d6b1ac7faa (* environ.cc (build_env): Don't put an empty environment | ||
variable into the environment. Optimize use of "len". * errno.cc | ||
(ERROR_MORE_DATA): Translate to EMSGSIZE rather than EAGAIN., | ||
2006-09-07), seemingly without any complaints. | ||
|
||
Meaning: There might very well be use cases out there where it makes | ||
sense to skip empty-valued environment variables. | ||
|
||
Therefore, it seems like a good idea to have a "knob" to turn it back | ||
on. With this commit, we introduce such a knob: by setting | ||
`noemptyenvvalues` the `MSYS` variable (or appending it if that variable | ||
is already set), users can tell the MSYS2 runtime to behave just like in | ||
the olden times. | ||
|
||
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de> | ||
--- | ||
winsup/cygwin/environ.cc | 4 +++- | ||
1 file changed, 3 insertions(+), 1 deletion(-) | ||
|
||
diff --git a/winsup/cygwin/environ.cc b/winsup/cygwin/environ.cc | ||
index 3cf60a1..30b713e 100644 | ||
--- a/winsup/cygwin/environ.cc | ||
+++ b/winsup/cygwin/environ.cc | ||
@@ -36,6 +36,7 @@ static char **lastenviron; | ||
/* Parse CYGWIN options */ | ||
|
||
static NO_COPY bool export_settings = false; | ||
+static bool emptyenvvalues = true; | ||
|
||
enum settings | ||
{ | ||
@@ -130,6 +131,7 @@ static struct parse_thing | ||
{"enable_pcon", {&disable_pcon}, setnegbool, NULL, {{true}, {false}}}, | ||
{"winjitdebug", {&winjitdebug}, setbool, NULL, {{false}, {true}}}, | ||
{"nativeinnerlinks", {&nativeinnerlinks}, setbool, NULL, {{false}, {true}}}, | ||
+ {"emptyenvvalues", {&emptyenvvalues}, setbool, NULL, {{false}, {true}}}, | ||
{NULL, {0}, setdword, 0, {{0}, {0}}} | ||
}; | ||
|
||
@@ -1339,7 +1341,7 @@ build_env (const char * const *envp, PWCHAR &envblock, int &envc, | ||
Note that this doesn't stop invalid strings without '=' in it | ||
etc., but we're opting for speed here for now. Adding complete | ||
checking would be pretty expensive. */ | ||
- if (len == 1) | ||
+ if (len == 1 || (!emptyenvvalues && !*rest)) | ||
continue; | ||
|
||
/* See if this entry requires posix->win32 conversion. */ |
34 changes: 34 additions & 0 deletions
34
msys2-runtime-3.3/0066-build_env-respect-the-MSYS-environment-variable.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 734de5a2ad5fe3db2105578596bf3f883aa56e5b Mon Sep 17 00:00:00 2001 | ||
From: Johannes Schindelin <johannes.schindelin@gmx.de> | ||
Date: Tue, 6 Sep 2022 12:18:18 +0200 | ||
Subject: [PATCH 66/N] build_env(): respect the `MSYS` environment variable | ||
|
||
With this commit, you can call | ||
|
||
MSYS=noemptyenvvalues my-command | ||
|
||
and it does what is expected: to pass no empty-valued environment | ||
variables to `my-command`. | ||
|
||
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de> | ||
--- | ||
winsup/cygwin/environ.cc | 6 +++++- | ||
1 file changed, 5 insertions(+), 1 deletion(-) | ||
|
||
diff --git a/winsup/cygwin/environ.cc b/winsup/cygwin/environ.cc | ||
index 30b713e..17fa866 100644 | ||
--- a/winsup/cygwin/environ.cc | ||
+++ b/winsup/cygwin/environ.cc | ||
@@ -1217,7 +1217,11 @@ build_env (const char * const *envp, PWCHAR &envblock, int &envc, | ||
{ | ||
bool calc_tl = !no_envblock; | ||
#ifdef __MSYS__ | ||
- if (!keep_posix) | ||
+ if (ascii_strncasematch(*srcp, "MSYS=", 5)) | ||
+ { | ||
+ parse_options (*srcp + 5); | ||
+ } | ||
+ else if (!keep_posix) | ||
{ | ||
/* Don't pass timezone environment to non-msys applications */ | ||
if (ascii_strncasematch(*srcp, "TZ=", 3)) |
33 changes: 33 additions & 0 deletions
33
msys2-runtime-3.3/0067-When-converting-to-a-Unix-path-avoid-double-trailing.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,33 @@ | ||
From 8e228a326c7c54b1351e340704f93dbe42aec987 Mon Sep 17 00:00:00 2001 | ||
From: Johannes Schindelin <johannes.schindelin@gmx.de> | ||
Date: Tue, 8 Nov 2022 16:24:20 +0100 | ||
Subject: [PATCH 67/N] When converting to a Unix path, avoid double trailing | ||
slashes | ||
|
||
When calling `cygpath -u C:/msys64/` in an MSYS2 setup that was | ||
installed into `C:/msys64/`, the result should be `/`, not `//`. | ||
|
||
Let's ensure that we do not append another trailing slash if the | ||
converted path already ends in a slash. | ||
|
||
This fixes https://github.com/msys2/msys2-runtime/issues/112 | ||
|
||
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de> | ||
--- | ||
winsup/cygwin/mount.cc | 3 +++ | ||
1 file changed, 3 insertions(+) | ||
|
||
diff --git a/winsup/cygwin/mount.cc b/winsup/cygwin/mount.cc | ||
index 2336949..91ad1af 100644 | ||
--- a/winsup/cygwin/mount.cc | ||
+++ b/winsup/cygwin/mount.cc | ||
@@ -923,6 +923,9 @@ mount_info::conv_to_posix_path (const char *src_path, char *posix_path, | ||
nextchar = 1; | ||
|
||
int addslash = nextchar > 0 ? 1 : 0; | ||
+ /* avoid appending a slash if the result already has a trailing slash */ | ||
+ if (append_slash && mi.posix_pathlen && mi.posix_path[mi.posix_pathlen-1] == '/') | ||
+ append_slash = addslash = 0; | ||
if ((mi.posix_pathlen + (pathbuflen - mi.native_pathlen) + addslash) >= NT_MAX_PATH) | ||
return ENAMETOOLONG; | ||
strcpy (posix_path, mi.posix_path); |
30 changes: 30 additions & 0 deletions
30
msys2-runtime-3.3/0068-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 7c12bf29458c87fc9e1766c8e2a7af2b572bf25c Mon Sep 17 00:00:00 2001 | ||
From: Kai Pastor <dg0yt@darc.de> | ||
Date: Tue, 21 Nov 2023 09:24:03 +0100 | ||
Subject: [PATCH 68/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 61a4cb4..45e1d9b 100644 | ||
--- a/winsup/cygwin/msys2_path_conv.cc | ||
+++ b/winsup/cygwin/msys2_path_conv.cc | ||
@@ -406,6 +406,13 @@ skip_p2w: | ||
|
||
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/0069-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 74016bbf735942bbc59f390bdcf298ad70ed299a Mon Sep 17 00:00:00 2001 | ||
From: Kai Pastor <dg0yt@darc.de> | ||
Date: Tue, 21 Nov 2023 09:25:58 +0100 | ||
Subject: [PATCH 69/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 45e1d9b..c40f504 100644 | ||
--- a/winsup/cygwin/msys2_path_conv.cc | ||
+++ b/winsup/cygwin/msys2_path_conv.cc | ||
@@ -490,7 +490,7 @@ skip_p2w: | ||
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); | ||
} | ||
@@ -519,7 +519,7 @@ 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 != '.') { |
40 changes: 40 additions & 0 deletions
40
msys2-runtime-3.3/0070-Cygwin-Fix-compiling-with-w32api-headers-v11.0.0.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,40 @@ | ||
From 52b92eb739b48ec694f640719f8c153b6268ca3f Mon Sep 17 00:00:00 2001 | ||
From: Biswapriyo Nath <nathbappai@gmail.com> | ||
Date: Sun, 30 Apr 2023 00:03:21 +0530 | ||
Subject: [PATCH 70/N] Cygwin: Fix compiling with w32api-headers v11.0.0 | ||
MIME-Version: 1.0 | ||
Content-Type: text/plain; charset=UTF-8 | ||
Content-Transfer-Encoding: 8bit | ||
|
||
This solves redefinition of FILE_CS_FLAG_CASE_SENSITIVE_DIR in winnt.h | ||
and fixes the following compiler errors | ||
|
||
ntdll.h:523:3: error: expected identifier before numeric constant | ||
523 | FILE_CS_FLAG_CASE_SENSITIVE_DIR = 0x01 | ||
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
ntdll.h:522:1: note: to match this ‘{’ | ||
522 | { | ||
| ^ | ||
|
||
(cherry picked from commit 3bee68248fc8e164a8bb6bba3f105b10fdec8a71) | ||
--- | ||
winsup/cygwin/ntdll.h | 2 ++ | ||
1 file changed, 2 insertions(+) | ||
|
||
diff --git a/winsup/cygwin/ntdll.h b/winsup/cygwin/ntdll.h | ||
index 0510d83..9358fc0 100644 | ||
--- a/winsup/cygwin/ntdll.h | ||
+++ b/winsup/cygwin/ntdll.h | ||
@@ -513,10 +513,12 @@ enum | ||
FILE_RENAME_IGNORE_READONLY_ATTRIBUTE = 0x40 | ||
}; | ||
|
||
+#if (__MINGW64_VERSION_MAJOR < 11) | ||
enum | ||
{ | ||
FILE_CS_FLAG_CASE_SENSITIVE_DIR = 0x01 | ||
}; | ||
+#endif | ||
|
||
enum | ||
{ |
115 changes: 115 additions & 0 deletions
115
msys2-runtime-3.3/0071-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 09fa4556d6e0b7a3394ea4eedc69895ac7347718 Mon Sep 17 00:00:00 2001 | ||
From: Johannes Schindelin <johannes.schindelin@gmx.de> | ||
Date: Sat, 25 Nov 2023 02:25:00 +0100 | ||
Subject: [PATCH 71/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 <johannes.schindelin@gmx.de> | ||
--- | ||
winsup/cygwin/nlsfuncs.cc | 30 ++++++++++++++++++++++++++++++ | ||
1 file changed, 30 insertions(+) | ||
|
||
diff --git a/winsup/cygwin/nlsfuncs.cc b/winsup/cygwin/nlsfuncs.cc | ||
index 6cf2739..8db1bee 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; | ||
} |
Oops, something went wrong.