Skip to content

Commit dc3dd0e

Browse files
authored
Merge pull request #232 from git-for-windows/msys2-runtime-7acbb031654404c9fd711eee9974c88475de98fd
msys2-runtime: update to 3.6.1-3
2 parents b160d8e + 8f3dc52 commit dc3dd0e

5 files changed

+149
-8
lines changed
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
From 28176974e765b6aa37def4141d47637c50d75aad Mon Sep 17 00:00:00 2001
2+
From: Takashi Yano <[email protected]>
3+
Date: Fri, 11 Apr 2025 20:03:11 +0900
4+
Subject: [PATCH 50/N] newlib: sys/unistd.h: Change inline to __inline
5+
6+
Addresses: https://sourceware.org/pipermail/cygwin-patches/2025q2/013644.html
7+
Fixes: 3e8a7eb1a868 ("sys/unistd.h: fix definition of setproctitle_init")
8+
Reported-by: Brian Inglis <[email protected]>
9+
Co-authored-by: Corinna Vinschen <[email protected]>
10+
Signed-off-by: Takashi Yano <[email protected]>
11+
(cherry picked from commit 1c530c37fd637ab1b7607b810d0495570932b8e7)
12+
---
13+
newlib/libc/include/sys/unistd.h | 2 +-
14+
1 file changed, 1 insertion(+), 1 deletion(-)
15+
16+
diff --git a/newlib/libc/include/sys/unistd.h b/newlib/libc/include/sys/unistd.h
17+
index 771a4bd..4cf9f06 100644
18+
--- a/newlib/libc/include/sys/unistd.h
19+
+++ b/newlib/libc/include/sys/unistd.h
20+
@@ -215,7 +215,7 @@ int setpgrp (void);
21+
#if defined(__CYGWIN__) && __BSD_VISIBLE
22+
/* Stub for Linux libbsd compatibility. */
23+
#define initsetproctitle(c, a, e) setproctitle_init((c), (a), (e))
24+
-static inline void setproctitle_init (int _c, char *_a[], char *_e[]) {}
25+
+static __inline void setproctitle_init (int _c, char *_a[], char *_e[]) {}
26+
27+
void setproctitle (const char *, ...)
28+
_ATTRIBUTE ((__format__ (__printf__, 1, 2)));
Lines changed: 107 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,107 @@
1+
From a86d33ef296849d7ef2e954e1f296236d2c2a5c3 Mon Sep 17 00:00:00 2001
2+
From: Takashi Yano <[email protected]>
3+
Date: Wed, 7 May 2025 15:40:22 +0900
4+
Subject: [PATCH 51/N] Cygwin: console: Store console mode only when console
5+
is opened
6+
7+
... and restore it when app exits. The commit 0bfd91d57863 has a bug
8+
that the console mode is stored into the shared memory when both:
9+
(1) cygwin process is started from non-cygwin process.
10+
(2) cygwin process started from non-cygwin process exits.
11+
(1) is intended, but (2) is not. Due to (2), the stored console mode
12+
is unexpectedly broken when the cygwin process exits. Then the mode
13+
restored will be not as expected. This causes undesired console mode
14+
in the use case that cygwin and non-cygwin apps are mixed.
15+
16+
With this patch, the console mode will stored only in the case (1).
17+
This is done by putting the code, which stores the console mode, into
18+
fhandler_console::open() rather than fhandler_console::set_input_mode()
19+
and fhandler_console::set_output_mode().
20+
21+
Fixes: 0bfd91d57863 ("Cygwin: console: tty::restore really restores the previous mode")
22+
Reported-by: Johannes Schindelin <[email protected]>
23+
Signed-off-by: Takashi Yano <[email protected]>
24+
(cherry picked from commit 09ae9f6ee99e2b58dcb17af563f15e8026b773ae)
25+
---
26+
winsup/cygwin/fhandler/console.cc | 33 ++++++++++++++++++++-----------
27+
1 file changed, 22 insertions(+), 11 deletions(-)
28+
29+
diff --git a/winsup/cygwin/fhandler/console.cc b/winsup/cygwin/fhandler/console.cc
30+
index f33e354..2a224fe 100644
31+
--- a/winsup/cygwin/fhandler/console.cc
32+
+++ b/winsup/cygwin/fhandler/console.cc
33+
@@ -771,6 +771,8 @@ fhandler_console::setup ()
34+
con.disable_master_thread = true;
35+
con.master_thread_suspended = false;
36+
con.num_processed = 0;
37+
+ con.curr_input_mode = tty::restore;
38+
+ con.curr_output_mode = tty::restore;
39+
}
40+
}
41+
42+
@@ -849,11 +851,6 @@ fhandler_console::set_input_mode (tty::cons_mode m, const termios *t,
43+
flags |= ENABLE_PROCESSED_INPUT;
44+
break;
45+
}
46+
- if (con.curr_input_mode != tty::cygwin && m == tty::cygwin)
47+
- {
48+
- prev_input_mode_backup = con.prev_input_mode;
49+
- con.prev_input_mode = oflags;
50+
- }
51+
con.curr_input_mode = m;
52+
SetConsoleMode (p->input_handle, flags);
53+
if (!(oflags & ENABLE_VIRTUAL_TERMINAL_INPUT)
54+
@@ -893,11 +890,6 @@ fhandler_console::set_output_mode (tty::cons_mode m, const termios *t,
55+
flags |= DISABLE_NEWLINE_AUTO_RETURN;
56+
break;
57+
}
58+
- if (con.curr_output_mode != tty::cygwin && m == tty::cygwin)
59+
- {
60+
- prev_output_mode_backup = con.prev_output_mode;
61+
- GetConsoleMode (p->output_handle, &con.prev_output_mode);
62+
- }
63+
con.curr_output_mode = m;
64+
acquire_attach_mutex (mutex_timeout);
65+
DWORD resume_pid = attach_console (con.owner);
66+
@@ -1836,6 +1828,12 @@ fhandler_console::open (int flags, mode_t)
67+
handle_set.output_handle = h;
68+
release_output_mutex ();
69+
70+
+ if (con.owner == GetCurrentProcessId ())
71+
+ {
72+
+ GetConsoleMode (get_handle (), &con.prev_input_mode);
73+
+ GetConsoleMode (get_output_handle (), &con.prev_output_mode);
74+
+ }
75+
+
76+
wpbuf.init ();
77+
78+
handle_set.input_mutex = input_mutex;
79+
@@ -1881,6 +1879,19 @@ fhandler_console::open (int flags, mode_t)
80+
setenv ("TERM", "cygwin", 1);
81+
}
82+
83+
+ if (con.curr_input_mode != tty::cygwin)
84+
+ {
85+
+ prev_input_mode_backup = con.prev_input_mode;
86+
+ GetConsoleMode (get_handle (), &con.prev_input_mode);
87+
+ set_input_mode (tty::cygwin, &get_ttyp ()->ti, &handle_set);
88+
+ }
89+
+ if (con.curr_output_mode != tty::cygwin)
90+
+ {
91+
+ prev_output_mode_backup = con.prev_output_mode;
92+
+ GetConsoleMode (get_output_handle (), &con.prev_output_mode);
93+
+ set_output_mode (tty::cygwin, &get_ttyp ()->ti, &handle_set);
94+
+ }
95+
+
96+
debug_printf ("opened conin$ %p, conout$ %p", get_handle (),
97+
get_output_handle ());
98+
99+
@@ -4720,7 +4731,7 @@ fhandler_console::cons_mode_on_close (handle_set_t *p)
100+
NTSTATUS status =
101+
NtQueryInformationProcess (GetCurrentProcess (), ProcessBasicInformation,
102+
&pbi, sizeof (pbi), NULL);
103+
- if (NT_SUCCESS (status)
104+
+ if (NT_SUCCESS (status) && cygwin_pid (con.owner)
105+
&& !process_alive ((DWORD) pbi.InheritedFromUniqueProcessId))
106+
/* Execed from normal cygwin process and the parent has been exited. */
107+
return tty::cygwin;

msys2-runtime/PKGBUILD

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
pkgbase=msys2-runtime
55
pkgname=('msys2-runtime' 'msys2-runtime-devel')
66
pkgver=3.6.1
7-
pkgrel=2
7+
pkgrel=3
88
pkgdesc="Cygwin POSIX emulation engine"
99
arch=('x86_64')
1010
url="https://www.cygwin.com/"
@@ -75,9 +75,11 @@ source=('msys2-runtime'::git+https://github.com/cygwin/cygwin#tag=cygwin-${pkgve
7575
0046-Change-the-default-base-address-for-x86_64.patch
7676
0047-msys2-runtime-restore-fast-path-for-current-user-pri.patch
7777
0048-Cygwin-console-Fix-the-console-states-after-the-cons.patch
78-
0049-fixup-Instead-of-creating-Cygwin-symlinks-use-deep-c.patch)
78+
0049-fixup-Instead-of-creating-Cygwin-symlinks-use-deep-c.patch
79+
0050-newlib-sys-unistd.h-Change-inline-to-__inline.patch
80+
0051-Cygwin-console-Store-console-mode-only-when-console-.patch)
7981
sha256sums=('24c4782e0e48d59f4155885c790d37a8bb59c4ab318851b99c675ca83792f563'
80-
'2280305f1f4a8f851abd3e24823f05d853e124ff34c56754fca18dabf1ea49d6'
82+
'd0f53d2153351681e88a8550cfbc9147c65586b3f9a7f83b33941182f3bf4d1c'
8183
'f0fb7e2f29859d57fd61edf2fb5453f975117aa6c53400f79e6d0eecf9dddba2'
8284
'3083f60db3649474270319856e8ecb39b15015ad49df4e1ab8c93a0ad3a71152'
8385
'27c196e05e46f26b86b2154b048aac0727b7303c464263e49016aabf63335dfd'
@@ -126,7 +128,9 @@ sha256sums=('24c4782e0e48d59f4155885c790d37a8bb59c4ab318851b99c675ca83792f563'
126128
'84a91ae1cf46d7e358754a33d85c7580578c3e4f12776e4fd70f43e8258bd209'
127129
'b13471f6459eb725ba85ee712e0c037b92d5128329b2dc599823e37bfa87812e'
128130
'f2d679b59f68ddf025edb191d8888dcc783f85ea6ce63609fb9d562b5bcc9e7f'
129-
'2194f705bfa4fae545fecd0251bd03acacc76a6f18783a281b8eb60dec166d9d')
131+
'2194f705bfa4fae545fecd0251bd03acacc76a6f18783a281b8eb60dec166d9d'
132+
'246bd2d26bb86be65e838cb03dd798d1647be210af6143f757e3bbd099a1c953'
133+
'54f7fce15b7fd345a62f3e6d0212b250afd2facb81c5027489ee34eec9a563a8')
130134

131135
# Helper macros to help make tasks easier #
132136
apply_patch_with_msg() {
@@ -229,7 +233,9 @@ prepare() {
229233
0046-Change-the-default-base-address-for-x86_64.patch \
230234
0047-msys2-runtime-restore-fast-path-for-current-user-pri.patch \
231235
0048-Cygwin-console-Fix-the-console-states-after-the-cons.patch \
232-
0049-fixup-Instead-of-creating-Cygwin-symlinks-use-deep-c.patch
236+
0049-fixup-Instead-of-creating-Cygwin-symlinks-use-deep-c.patch \
237+
0050-newlib-sys-unistd.h-Change-inline-to-__inline.patch \
238+
0051-Cygwin-console-Store-console-mode-only-when-console-.patch
233239
}
234240

235241
build() {

msys2-runtime/msys2-runtime.commit

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
bb4e8e05b4c68895887eba9c420e8a42e0e2801e
1+
7acbb031654404c9fd711eee9974c88475de98fd

msys2-runtime/update-patches.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ die "Clean worktree required"
1717
git rm 0*.patch ||
1818
die "Could not remove previous patches"
1919

20-
base_tag=refs/tags/"$(expr "$(git -C src/msys2-runtime/ describe --tags HEAD)" : '^\(cygwin-[0-9.]*\)')"
20+
base_tag=refs/tags/"$(expr "$(git -C src/msys2-runtime/ describe --match 'cygwin-[0-9]*' --tags HEAD)" : '^\(cygwin-[0-9.]*\)')"
2121
source_url=$(sed -ne 's/git+https:/https:/' -e 's/^source=\([^:]\+::\)\?["'\'']\?\([^"'\''#?=&,;[:space:]]\+[^)"'\''#?=&,;[:space:]]\).*/\2/p' <PKGBUILD)
2222

2323
git -C src/msys2-runtime fetch --no-tags "$source_url" "$base_tag:$base_tag"
@@ -43,7 +43,7 @@ git -c core.abbrev=7 \
4343
--subject-prefix=PATCH \
4444
--output-directory ../.. \
4545
$base_tag.. ${merging_rebase_start:+^$merging_rebase_start} \
46-
-- ':(exclude).github/' ||
46+
-- ':(exclude).github/' ':(exclude)ui-tests/' ||
4747
die "Could not generate new patch set"
4848

4949
patches="$(ls 0*.patch)" &&

0 commit comments

Comments
 (0)