Merge pull request #2687 from dscho/msys2-runtime-v3.3.2

msys2-runtime: upgrade to Cygwin v3.3.2
This commit is contained in:
Christoph Reiter 2021-11-11 09:23:15 +01:00 committed by GitHub
commit 98fcdb5574
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
52 changed files with 1296 additions and 8499 deletions

View File

@ -1,4 +1,4 @@
From 2dc8548f51242cc30dd1dcada075475e5856167e Mon Sep 17 00:00:00 2001
From 88039c4cb480595a608332fd900a94cbc7e8fe14 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=D0=90=D0=BB=D0=B5=D0=BA=D1=81=D0=B5=D0=B8=CC=86=20=D0=9F?=
=?UTF-8?q?=D0=B0=D0=B2=D0=BB=D0=BE=D0=B2?= <alexey.pawlow@gmail.com>
Date: Sun, 14 Apr 2019 20:40:45 +0300
@ -809,10 +809,10 @@ index 5ef12ce..5e7bc34 100644
AC_CHECK_TOOL(DLLTOOL, dlltool, false)
AC_CHECK_TOOL(OBJDUMP, objdump, false)
diff --git a/newlib/configure b/newlib/configure
index 6b3684b..2905ab2 100755
index 2771fa2..ea3740b 100755
--- a/newlib/configure
+++ b/newlib/configure
@@ -4302,7 +4302,7 @@ if test "${use_libtool}" = "yes"; then
@@ -4304,7 +4304,7 @@ if test "${use_libtool}" = "yes"; then
enable_win32_dll=yes
case $host in
@ -821,7 +821,7 @@ index 6b3684b..2905ab2 100755
if test -n "$ac_tool_prefix"; then
# Extract the first word of "${ac_tool_prefix}as", so it can be a program name with args.
set dummy ${ac_tool_prefix}as; ac_word=$2
@@ -6128,7 +6128,7 @@ else
@@ -6130,7 +6130,7 @@ else
lt_cv_sys_max_cmd_len=-1;
;;
@ -830,7 +830,7 @@ index 6b3684b..2905ab2 100755
# On Win9x/ME, this test blows up -- it succeeds, but takes
# about 5 minutes as the teststring grows exponentially.
# Worse, since 9x/ME are not pre-emptively multitasking,
@@ -6467,7 +6467,7 @@ bsdi[45]*)
@@ -6469,7 +6469,7 @@ bsdi[45]*)
lt_cv_file_magic_test_file=/shlib/libc.so
;;
@ -839,7 +839,7 @@ index 6b3684b..2905ab2 100755
# func_win32_libid is a shell function defined in ltmain.sh
lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL'
lt_cv_file_magic_cmd='func_win32_libid'
@@ -7047,7 +7047,7 @@ case $host_os in
@@ -7049,7 +7049,7 @@ case $host_os in
aix*)
symcode='[BCDT]'
;;
@ -848,7 +848,7 @@ index 6b3684b..2905ab2 100755
symcode='[ABCDGISTW]'
;;
hpux*)
@@ -8928,7 +8928,7 @@ $as_echo_n "checking for $compiler option to produce PIC... " >&6; }
@@ -8930,7 +8930,7 @@ $as_echo_n "checking for $compiler option to produce PIC... " >&6; }
# PIC is the default for these OSes.
;;
@ -857,7 +857,7 @@ index 6b3684b..2905ab2 100755
# This hack is so that the source file can tell whether it is being
# built for inclusion in a dll (and should export symbols for example).
# Although the cygwin gcc ignores -fPIC, still need this for old-style
@@ -9010,7 +9010,7 @@ $as_echo_n "checking for $compiler option to produce PIC... " >&6; }
@@ -9012,7 +9012,7 @@ $as_echo_n "checking for $compiler option to produce PIC... " >&6; }
fi
;;
@ -866,7 +866,7 @@ index 6b3684b..2905ab2 100755
# This hack is so that the source file can tell whether it is being
# built for inclusion in a dll (and should export symbols for example).
lt_prog_compiler_pic='-DDLL_EXPORT'
@@ -9472,7 +9472,7 @@ $as_echo_n "checking whether the $compiler linker ($LD) supports shared librarie
@@ -9474,7 +9474,7 @@ $as_echo_n "checking whether the $compiler linker ($LD) supports shared librarie
extract_expsyms_cmds=
case $host_os in
@ -875,7 +875,7 @@ index 6b3684b..2905ab2 100755
# FIXME: the MSVC++ port hasn't been tested in a loooong time
# When not using gcc, we currently assume that we are using
# Microsoft Visual C++.
@@ -9587,7 +9587,7 @@ _LT_EOF
@@ -9589,7 +9589,7 @@ _LT_EOF
fi
;;
@ -884,7 +884,7 @@ index 6b3684b..2905ab2 100755
# _LT_TAGVAR(hardcode_libdir_flag_spec, ) is actually meaningless,
# as there is no search path for DLLs.
hardcode_libdir_flag_spec='-L$libdir'
@@ -10018,7 +10018,7 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
@@ -10020,7 +10020,7 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
export_dynamic_flag_spec=-rdynamic
;;
@ -893,7 +893,7 @@ index 6b3684b..2905ab2 100755
# When not using gcc, we currently assume that we are using
# Microsoft Visual C++.
# hardcode_libdir_flag_spec is actually meaningless, as there is
@@ -10919,14 +10919,14 @@ bsdi[45]*)
@@ -10921,14 +10921,14 @@ bsdi[45]*)
# libtool to hard-code these into programs
;;
@ -910,7 +910,7 @@ index 6b3684b..2905ab2 100755
library_names_spec='$libname.dll.a'
# DLL is installed to $(libdir)/../bin by postinstall_cmds
postinstall_cmds='base_file=`basename \${file}`~
@@ -10948,6 +10948,12 @@ cygwin* | mingw* | pw32* | cegcc*)
@@ -10950,6 +10950,12 @@ cygwin* | mingw* | pw32* | cegcc*)
# Cygwin DLLs use 'cyg' prefix rather than 'lib'
soname_spec='`echo ${libname} | sed -e 's/^lib/cyg/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}'
@ -923,7 +923,7 @@ index 6b3684b..2905ab2 100755
sys_lib_search_path_spec="$sys_lib_search_path_spec /usr/lib/w32api"
;;
mingw* | cegcc*)
@@ -11586,7 +11592,7 @@ else
@@ -11588,7 +11594,7 @@ else
lt_cv_dlopen_libs=
;;
@ -933,19 +933,19 @@ index 6b3684b..2905ab2 100755
lt_cv_dlopen_libs=
;;
diff --git a/newlib/configure.host b/newlib/configure.host
index 1ddbb6c..db24ca3 100644
index ef481ff..7dbf48f 100644
--- a/newlib/configure.host
+++ b/newlib/configure.host
@@ -195,7 +195,7 @@ case "${host_cpu}" in
i[34567]86)
@@ -201,7 +201,7 @@ case "${host_cpu}" in
shared_machine_dir=shared_x86
# Don't use for these since they provide their own setjmp.
case ${host} in
- *-*-sco* | *-*-cygwin*)
+ *-*-sco* | *-*-cygwin* | *-*-msys*)
libm_machine_dir=i386
machine_dir=i386
;;
@@ -402,7 +402,7 @@ fi
*)
mach_add_setjmp=true
@@ -406,7 +406,7 @@ fi
if [ "x${newlib_mb}" = "x" ]; then
case "${host}" in
@ -954,7 +954,7 @@ index 1ddbb6c..db24ca3 100644
newlib_mb=yes
;;
esac
@@ -436,7 +436,7 @@ esac
@@ -440,7 +440,7 @@ esac
# THIS TABLE IS ALPHA SORTED. KEEP IT THAT WAY.
case "${host}" in
@ -963,7 +963,7 @@ index 1ddbb6c..db24ca3 100644
posix_dir=posix
stdio64_dir=stdio64
xdr_dir=xdr
@@ -640,7 +640,7 @@ esac
@@ -644,7 +644,7 @@ esac
# THIS TABLE IS ALPHA SORTED. KEEP IT THAT WAY.
case "${host}" in
@ -1097,10 +1097,10 @@ index aaadeb8..f60bf17 100755
lt_cv_dlopen_libs=
;;
diff --git a/newlib/libc/configure b/newlib/libc/configure
index dd9b3c8..fc11972 100755
index 7367964..e169c18 100755
--- a/newlib/libc/configure
+++ b/newlib/libc/configure
@@ -4016,7 +4016,7 @@ if test "${use_libtool}" = "yes"; then
@@ -4018,7 +4018,7 @@ if test "${use_libtool}" = "yes"; then
enable_win32_dll=yes
case $host in
@ -1109,7 +1109,7 @@ index dd9b3c8..fc11972 100755
if test -n "$ac_tool_prefix"; then
# Extract the first word of "${ac_tool_prefix}as", so it can be a program name with args.
set dummy ${ac_tool_prefix}as; ac_word=$2
@@ -5842,7 +5842,7 @@ else
@@ -5844,7 +5844,7 @@ else
lt_cv_sys_max_cmd_len=-1;
;;
@ -1118,7 +1118,7 @@ index dd9b3c8..fc11972 100755
# On Win9x/ME, this test blows up -- it succeeds, but takes
# about 5 minutes as the teststring grows exponentially.
# Worse, since 9x/ME are not pre-emptively multitasking,
@@ -6181,7 +6181,7 @@ bsdi[45]*)
@@ -6183,7 +6183,7 @@ bsdi[45]*)
lt_cv_file_magic_test_file=/shlib/libc.so
;;
@ -1127,7 +1127,7 @@ index dd9b3c8..fc11972 100755
# func_win32_libid is a shell function defined in ltmain.sh
lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL'
lt_cv_file_magic_cmd='func_win32_libid'
@@ -6761,7 +6761,7 @@ case $host_os in
@@ -6763,7 +6763,7 @@ case $host_os in
aix*)
symcode='[BCDT]'
;;
@ -1136,7 +1136,7 @@ index dd9b3c8..fc11972 100755
symcode='[ABCDGISTW]'
;;
hpux*)
@@ -8642,7 +8642,7 @@ $as_echo_n "checking for $compiler option to produce PIC... " >&6; }
@@ -8644,7 +8644,7 @@ $as_echo_n "checking for $compiler option to produce PIC... " >&6; }
# PIC is the default for these OSes.
;;
@ -1145,7 +1145,7 @@ index dd9b3c8..fc11972 100755
# This hack is so that the source file can tell whether it is being
# built for inclusion in a dll (and should export symbols for example).
# Although the cygwin gcc ignores -fPIC, still need this for old-style
@@ -8724,7 +8724,7 @@ $as_echo_n "checking for $compiler option to produce PIC... " >&6; }
@@ -8726,7 +8726,7 @@ $as_echo_n "checking for $compiler option to produce PIC... " >&6; }
fi
;;
@ -1154,7 +1154,7 @@ index dd9b3c8..fc11972 100755
# This hack is so that the source file can tell whether it is being
# built for inclusion in a dll (and should export symbols for example).
lt_prog_compiler_pic='-DDLL_EXPORT'
@@ -9186,7 +9186,7 @@ $as_echo_n "checking whether the $compiler linker ($LD) supports shared librarie
@@ -9188,7 +9188,7 @@ $as_echo_n "checking whether the $compiler linker ($LD) supports shared librarie
extract_expsyms_cmds=
case $host_os in
@ -1163,7 +1163,7 @@ index dd9b3c8..fc11972 100755
# FIXME: the MSVC++ port hasn't been tested in a loooong time
# When not using gcc, we currently assume that we are using
# Microsoft Visual C++.
@@ -9301,7 +9301,7 @@ _LT_EOF
@@ -9303,7 +9303,7 @@ _LT_EOF
fi
;;
@ -1172,7 +1172,7 @@ index dd9b3c8..fc11972 100755
# _LT_TAGVAR(hardcode_libdir_flag_spec, ) is actually meaningless,
# as there is no search path for DLLs.
hardcode_libdir_flag_spec='-L$libdir'
@@ -9732,7 +9732,7 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
@@ -9734,7 +9734,7 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
export_dynamic_flag_spec=-rdynamic
;;
@ -1181,7 +1181,7 @@ index dd9b3c8..fc11972 100755
# When not using gcc, we currently assume that we are using
# Microsoft Visual C++.
# hardcode_libdir_flag_spec is actually meaningless, as there is
@@ -10633,14 +10633,14 @@ bsdi[45]*)
@@ -10635,14 +10635,14 @@ bsdi[45]*)
# libtool to hard-code these into programs
;;
@ -1198,7 +1198,7 @@ index dd9b3c8..fc11972 100755
library_names_spec='$libname.dll.a'
# DLL is installed to $(libdir)/../bin by postinstall_cmds
postinstall_cmds='base_file=`basename \${file}`~
@@ -10662,6 +10662,12 @@ cygwin* | mingw* | pw32* | cegcc*)
@@ -10664,6 +10664,12 @@ cygwin* | mingw* | pw32* | cegcc*)
# Cygwin DLLs use 'cyg' prefix rather than 'lib'
soname_spec='`echo ${libname} | sed -e 's/^lib/cyg/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}'
@ -1211,7 +1211,7 @@ index dd9b3c8..fc11972 100755
sys_lib_search_path_spec="$sys_lib_search_path_spec /usr/lib/w32api"
;;
mingw* | cegcc*)
@@ -11300,7 +11306,7 @@ else
@@ -11302,7 +11308,7 @@ else
lt_cv_dlopen_libs=
;;
@ -2337,10 +2337,10 @@ index 7c5de77..ab10fc4 100755
lt_cv_dlopen_libs=
;;
diff --git a/newlib/libm/configure b/newlib/libm/configure
index 9b06c69..0451524 100755
index 0c79bb2..06f7042 100755
--- a/newlib/libm/configure
+++ b/newlib/libm/configure
@@ -3956,7 +3956,7 @@ if test "${use_libtool}" = "yes"; then
@@ -3958,7 +3958,7 @@ if test "${use_libtool}" = "yes"; then
enable_win32_dll=yes
case $host in
@ -2349,7 +2349,7 @@ index 9b06c69..0451524 100755
if test -n "$ac_tool_prefix"; then
# Extract the first word of "${ac_tool_prefix}as", so it can be a program name with args.
set dummy ${ac_tool_prefix}as; ac_word=$2
@@ -5782,7 +5782,7 @@ else
@@ -5784,7 +5784,7 @@ else
lt_cv_sys_max_cmd_len=-1;
;;
@ -2358,7 +2358,7 @@ index 9b06c69..0451524 100755
# On Win9x/ME, this test blows up -- it succeeds, but takes
# about 5 minutes as the teststring grows exponentially.
# Worse, since 9x/ME are not pre-emptively multitasking,
@@ -6121,7 +6121,7 @@ bsdi[45]*)
@@ -6123,7 +6123,7 @@ bsdi[45]*)
lt_cv_file_magic_test_file=/shlib/libc.so
;;
@ -2367,7 +2367,7 @@ index 9b06c69..0451524 100755
# func_win32_libid is a shell function defined in ltmain.sh
lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL'
lt_cv_file_magic_cmd='func_win32_libid'
@@ -6701,7 +6701,7 @@ case $host_os in
@@ -6703,7 +6703,7 @@ case $host_os in
aix*)
symcode='[BCDT]'
;;
@ -2376,7 +2376,7 @@ index 9b06c69..0451524 100755
symcode='[ABCDGISTW]'
;;
hpux*)
@@ -8582,7 +8582,7 @@ $as_echo_n "checking for $compiler option to produce PIC... " >&6; }
@@ -8584,7 +8584,7 @@ $as_echo_n "checking for $compiler option to produce PIC... " >&6; }
# PIC is the default for these OSes.
;;
@ -2385,7 +2385,7 @@ index 9b06c69..0451524 100755
# This hack is so that the source file can tell whether it is being
# built for inclusion in a dll (and should export symbols for example).
# Although the cygwin gcc ignores -fPIC, still need this for old-style
@@ -8664,7 +8664,7 @@ $as_echo_n "checking for $compiler option to produce PIC... " >&6; }
@@ -8666,7 +8666,7 @@ $as_echo_n "checking for $compiler option to produce PIC... " >&6; }
fi
;;
@ -2394,7 +2394,7 @@ index 9b06c69..0451524 100755
# This hack is so that the source file can tell whether it is being
# built for inclusion in a dll (and should export symbols for example).
lt_prog_compiler_pic='-DDLL_EXPORT'
@@ -9126,7 +9126,7 @@ $as_echo_n "checking whether the $compiler linker ($LD) supports shared librarie
@@ -9128,7 +9128,7 @@ $as_echo_n "checking whether the $compiler linker ($LD) supports shared librarie
extract_expsyms_cmds=
case $host_os in
@ -2403,7 +2403,7 @@ index 9b06c69..0451524 100755
# FIXME: the MSVC++ port hasn't been tested in a loooong time
# When not using gcc, we currently assume that we are using
# Microsoft Visual C++.
@@ -9241,7 +9241,7 @@ _LT_EOF
@@ -9243,7 +9243,7 @@ _LT_EOF
fi
;;
@ -2412,7 +2412,7 @@ index 9b06c69..0451524 100755
# _LT_TAGVAR(hardcode_libdir_flag_spec, ) is actually meaningless,
# as there is no search path for DLLs.
hardcode_libdir_flag_spec='-L$libdir'
@@ -9672,7 +9672,7 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
@@ -9674,7 +9674,7 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
export_dynamic_flag_spec=-rdynamic
;;
@ -2421,7 +2421,7 @@ index 9b06c69..0451524 100755
# When not using gcc, we currently assume that we are using
# Microsoft Visual C++.
# hardcode_libdir_flag_spec is actually meaningless, as there is
@@ -10573,14 +10573,14 @@ bsdi[45]*)
@@ -10575,14 +10575,14 @@ bsdi[45]*)
# libtool to hard-code these into programs
;;
@ -2438,7 +2438,7 @@ index 9b06c69..0451524 100755
library_names_spec='$libname.dll.a'
# DLL is installed to $(libdir)/../bin by postinstall_cmds
postinstall_cmds='base_file=`basename \${file}`~
@@ -10602,6 +10602,12 @@ cygwin* | mingw* | pw32* | cegcc*)
@@ -10604,6 +10604,12 @@ cygwin* | mingw* | pw32* | cegcc*)
# Cygwin DLLs use 'cyg' prefix rather than 'lib'
soname_spec='`echo ${libname} | sed -e 's/^lib/cyg/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}'
@ -2451,7 +2451,7 @@ index 9b06c69..0451524 100755
sys_lib_search_path_spec="$sys_lib_search_path_spec /usr/lib/w32api"
;;
mingw* | cegcc*)
@@ -11240,7 +11246,7 @@ else
@@ -11242,7 +11248,7 @@ else
lt_cv_dlopen_libs=
;;
@ -2709,5 +2709,5 @@ index eb2a870..3bf9d9f 100755
lt_cv_dlopen_libs=
;;
--
2.31.1
2.33.0

View File

@ -1,4 +1,4 @@
From 5e23b7ebff98cd5fed5344362189478b3d9ccc6a Mon Sep 17 00:00:00 2001
From 95a30d3e61d87a14571db698bfb8877bd84e6dd7 Mon Sep 17 00:00:00 2001
From: Kaleb Barrett <dev.ktbarrett@gmail.com>
Date: Sun, 14 Mar 2021 18:58:55 -0500
Subject: [PATCH 02/N] Fix msys library name in import libraries
@ -25,5 +25,5 @@ index b900960..617a9c2 100755
my ($file, $member, $symbol) = m%^([^:]*):([^:]*(?=:))?.* T (.*)%o;
next if !defined($symbol) || $symbol =~ $exclude_regex;
--
2.31.1
2.33.0

File diff suppressed because it is too large Load Diff

View File

@ -1,4 +1,4 @@
From 85834517a224e8ec7971d710b330fe905852deb9 Mon Sep 17 00:00:00 2001
From 8dcd7c5d7da369cf1dcf329b4223726614ee20d7 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=D0=90=D0=BB=D0=B5=D0=BA=D1=81=D0=B5=D0=B8=CC=86=20=D0=9F?=
=?UTF-8?q?=D0=B0=D0=B2=D0=BB=D0=BE=D0=B2?= <alexey.pawlow@gmail.com>
Date: Sun, 14 Apr 2019 21:17:46 +0300
@ -7,7 +7,7 @@ Subject: [PATCH 04/N] Add functionality for converting UNIX paths in
applications.
---
winsup/cygwin/Makefile.in | 1 +
winsup/cygwin/Makefile.am | 1 +
winsup/cygwin/environ.cc | 24 +-
winsup/cygwin/environ.h | 2 +-
winsup/cygwin/external.cc | 2 +-
@ -21,23 +21,23 @@ Subject: [PATCH 04/N] Add functionality for converting UNIX paths in
create mode 100644 winsup/cygwin/msys2_path_conv.cc
create mode 100644 winsup/cygwin/msys2_path_conv.h
diff --git a/winsup/cygwin/Makefile.in b/winsup/cygwin/Makefile.in
index 4c51cf3..1b67c9e 100644
--- a/winsup/cygwin/Makefile.in
+++ b/winsup/cygwin/Makefile.in
@@ -347,6 +347,7 @@ DLL_OFILES:= \
mmap.o \
mmap_alloc.o \
msg.o \
+ msys2_path_conv.o \
mount.o \
net.o \
netdb.o \
diff --git a/winsup/cygwin/Makefile.am b/winsup/cygwin/Makefile.am
index 6a53049..f10b1b5 100644
--- a/winsup/cygwin/Makefile.am
+++ b/winsup/cygwin/Makefile.am
@@ -283,6 +283,7 @@ DLL_FILES= \
mmap.cc \
mmap_alloc.cc \
msg.cc \
+ msys2_path_conv.cc \
mount.cc \
net.cc \
netdb.cc \
diff --git a/winsup/cygwin/environ.cc b/winsup/cygwin/environ.cc
index 3a03657..73df083 100644
index 03f8277..8ad1026 100644
--- a/winsup/cygwin/environ.cc
+++ b/winsup/cygwin/environ.cc
@@ -1056,7 +1056,7 @@ env_compare (const void *key, const void *memb)
@@ -1058,7 +1058,7 @@ env_compare (const void *key, const void *memb)
to the child. */
char ** __reg3
build_env (const char * const *envp, PWCHAR &envblock, int &envc,
@ -46,7 +46,7 @@ index 3a03657..73df083 100644
{
PWCHAR cwinenv = NULL;
size_t winnum = 0;
@@ -1149,6 +1149,19 @@ build_env (const char * const *envp, PWCHAR &envblock, int &envc,
@@ -1151,6 +1151,19 @@ build_env (const char * const *envp, PWCHAR &envblock, int &envc,
for (srcp = envp, dstp = newenv, pass_dstp = pass_env; *srcp; srcp++)
{
bool calc_tl = !no_envblock;
@ -66,7 +66,7 @@ index 3a03657..73df083 100644
/* Look for entries that require special attention */
for (unsigned i = 0; i < SPENVS_SIZE; i++)
if (!saw_spenv[i] && (*dstp = spenvs[i].retrieve (no_envblock, *srcp)))
@@ -1269,6 +1282,15 @@ build_env (const char * const *envp, PWCHAR &envblock, int &envc,
@@ -1271,6 +1284,15 @@ build_env (const char * const *envp, PWCHAR &envblock, int &envc,
saw_PATH = true;
}
}
@ -926,7 +926,7 @@ index 0000000..67d85ec
+#endif /* end of include guard: PATH_CONV_H_DB4IQBH3 */
+
diff --git a/winsup/cygwin/path.cc b/winsup/cygwin/path.cc
index 1d6bcbe..4db7b24 100644
index baf04ce..5a3aa9b 100644
--- a/winsup/cygwin/path.cc
+++ b/winsup/cygwin/path.cc
@@ -66,6 +66,7 @@
@ -937,7 +937,7 @@ index 1d6bcbe..4db7b24 100644
#undef basename
suffix_info stat_suffixes[] =
@@ -3676,6 +3677,74 @@ fchdir (int fd)
@@ -3768,6 +3769,74 @@ fchdir (int fd)
return res;
}
@ -1013,7 +1013,7 @@ index 1d6bcbe..4db7b24 100644
/* Cover functions to the path conversion routines.
diff --git a/winsup/cygwin/spawn.cc b/winsup/cygwin/spawn.cc
index ec0cdd4..53ddc60 100644
index 6b20267..c128add 100644
--- a/winsup/cygwin/spawn.cc
+++ b/winsup/cygwin/spawn.cc
@@ -295,6 +295,27 @@ child_info_spawn::worker (const char *prog_arg, const char *const *argv,
@ -1096,5 +1096,5 @@ index e3a65f8..1aeec8d 100644
{
for (int i = calloced; i < argc; i++)
--
2.31.1
2.33.0

View File

@ -1,4 +1,4 @@
From c6eca0986643dc083840c1017f279e8519d6528d Mon Sep 17 00:00:00 2001
From 6c35e55ed6b9f60565737efda2d2833e7c9da8f7 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=D0=90=D0=BB=D0=B5=D0=BA=D1=81=D0=B5=D0=B8=CC=86=20=D0=9F?=
=?UTF-8?q?=D0=B0=D0=B2=D0=BB=D0=BE=D0=B2?= <alexey.pawlow@gmail.com>
Date: Sun, 14 Apr 2019 21:29:01 +0300
@ -9,8 +9,8 @@ Subject: [PATCH 05/N] Add functionality for changing OS name via MSYSTEM
winsup/cygserver/cygserver-config | 4 ++--
winsup/cygwin/environ.cc | 36 +++++++++++++++++++++++++----
winsup/cygwin/include/sys/utsname.h | 2 +-
winsup/cygwin/uname.cc | 13 +++++++++--
4 files changed, 46 insertions(+), 9 deletions(-)
winsup/cygwin/uname.cc | 17 ++++++++++++--
4 files changed, 50 insertions(+), 9 deletions(-)
diff --git a/winsup/cygserver/cygserver-config b/winsup/cygserver/cygserver-config
index 373bfd2..c902857 100755
@ -35,10 +35,10 @@ index 373bfd2..c902857 100755
echo
echo "Installation of cygserver as service failed. Please check the"
diff --git a/winsup/cygwin/environ.cc b/winsup/cygwin/environ.cc
index 73df083..87650cc 100644
index 8ad1026..f746841 100644
--- a/winsup/cygwin/environ.cc
+++ b/winsup/cygwin/environ.cc
@@ -189,7 +189,11 @@ parse_options (const char *inbuf)
@@ -191,7 +191,11 @@ parse_options (const char *inbuf)
if (export_settings)
{
debug_printf ("%s", newbuf + 1);
@ -50,7 +50,7 @@ index 73df083..87650cc 100644
}
return;
}
@@ -653,7 +657,7 @@ _addenv (const char *name, const char *value, int overwrite)
@@ -655,7 +659,7 @@ _addenv (const char *name, const char *value, int overwrite)
win_env *spenv;
if ((spenv = getwinenv (envhere)))
spenv->add_cache (value);
@ -59,7 +59,7 @@ index 73df083..87650cc 100644
parse_options (value);
return 0;
@@ -757,6 +761,9 @@ static struct renv {
@@ -759,6 +763,9 @@ static struct renv {
} renv_arr[] = {
{ NL("COMMONPROGRAMFILES=") }, // 0
{ NL("COMSPEC=") },
@ -69,7 +69,7 @@ index 73df083..87650cc 100644
{ NL("PATH=") }, // 2
{ NL("PROGRAMFILES=") },
{ NL("SYSTEMDRIVE=") }, // 4
@@ -768,10 +775,21 @@ static struct renv {
@@ -770,10 +777,21 @@ static struct renv {
#define RENV_SIZE (sizeof (renv_arr) / sizeof (renv_arr[0]))
/* Set of first characters of the above list of variables. */
@ -93,7 +93,7 @@ index 73df083..87650cc 100644
/* Turn environment variable part of a=b string into uppercase - for some
environment variables only. */
@@ -846,7 +864,11 @@ environ_init (char **envp, int envc)
@@ -848,7 +866,11 @@ environ_init (char **envp, int envc)
update_envptrs ();
if (envp_passed_in)
{
@ -105,7 +105,7 @@ index 73df083..87650cc 100644
if (p)
parse_options (p);
}
@@ -893,8 +915,13 @@ win32env_to_cygenv (PWCHAR rawenv, bool posify)
@@ -895,8 +917,13 @@ win32env_to_cygenv (PWCHAR rawenv, bool posify)
ucenv (newp, eq); /* uppercase env vars which need it */
if (*newp == 'T' && strncmp (newp, "TERM=", 5) == 0)
sawTERM = 1;
@ -119,7 +119,7 @@ index 73df083..87650cc 100644
if (*eq && posify)
posify_maybe (envp + i, *++eq ? eq : --eq, tmpbuf);
debug_printf ("%p: %s", envp[i], envp[i]);
@@ -963,12 +990,13 @@ struct spenv
@@ -965,12 +992,13 @@ struct spenv
static NO_COPY spenv spenvs[] =
{
#ifdef DEBUGGING
@ -148,22 +148,24 @@ index d6b3be9..730cb73 100644
char release[_UTSNAME_LENGTH];
char version[_UTSNAME_LENGTH];
diff --git a/winsup/cygwin/uname.cc b/winsup/cygwin/uname.cc
index 3502166..28bcd63 100644
index 3502166..daed73f 100644
--- a/winsup/cygwin/uname.cc
+++ b/winsup/cygwin/uname.cc
@@ -36,7 +36,10 @@ uname_x (struct utsname *name)
@@ -36,7 +36,12 @@ uname_x (struct utsname *name)
memset (name, 0, sizeof (*name));
/* sysname */
- __small_sprintf (name->sysname, "CYGWIN_%s-%u%s",
+ char* msystem = getenv("MSYSTEM");
+ const char *msystem_msys = "MSYS";
+ const char* msystem_sysname = "MSYS";
+ if (msystem != NULL && *msystem && strcmp(msystem, "MSYS") != 0)
+ msystem_sysname = (strstr(msystem, "32") != NULL) ? "MINGW32" : "MINGW64";;
+ __small_sprintf (name->sysname, "%s_%s-%u%s",
+ msystem ? msystem : msystem_msys,
+ msystem_sysname,
wincap.osname (), wincap.build_number (),
wincap.is_wow64 () ? "-WOW64" : "");
/* nodename */
@@ -82,7 +85,7 @@ uname_x (struct utsname *name)
@@ -82,7 +87,7 @@ uname_x (struct utsname *name)
/* Old entrypoint for applications up to API 334 */
struct old_utsname
{
@ -172,14 +174,16 @@ index 3502166..28bcd63 100644
char nodename[20];
char release[20];
char version[20];
@@ -98,7 +101,13 @@ uname (struct utsname *in_name)
@@ -98,7 +103,15 @@ uname (struct utsname *in_name)
char *snp = strstr (cygwin_version.dll_build_date, "SNP");
memset (name, 0, sizeof (*name));
+#ifdef __MSYS__
+ char* msystem = getenv("MSYSTEM");
+ const char *msystem_msys = "MSYS";
+ __small_sprintf (name->sysname, "%s_%s", msystem ? msystem : msystem_msys, wincap.osname ());
+ const char* msystem_sysname = "MSYS";
+ if (msystem != NULL && *msystem && strcmp(msystem, "MSYS") != 0)
+ msystem_sysname = (strstr(msystem, "32") != NULL) ? "MINGW32" : "MINGW64";
+ __small_sprintf (name->sysname, "%s_%s", msystem_sysname, wincap.osname ());
+#else
__small_sprintf (name->sysname, "CYGWIN_%s", wincap.osname ());
+#endif
@ -187,5 +191,5 @@ index 3502166..28bcd63 100644
/* Add a hint to the sysname, that we're running under WOW64. This might
give an early clue if somebody encounters problems. */
--
2.31.1
2.33.0

View File

@ -1,4 +1,4 @@
From 926e501ea1232b976a526dcadd1edee13fccf009 Mon Sep 17 00:00:00 2001
From fd8441d4a1dc7541954986345507f1d2c896137e Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=D0=90=D0=BB=D0=B5=D0=BA=D1=81=D0=B5=D0=B8=CC=86=20=D0=9F?=
=?UTF-8?q?=D0=B0=D0=B2=D0=BB=D0=BE=D0=B2?= <alexey.pawlow@gmail.com>
Date: Sun, 14 Apr 2019 21:45:06 +0300
@ -58,7 +58,7 @@ index 01b4946..e64e468 100644
void __stdcall
diff --git a/winsup/cygwin/mount.cc b/winsup/cygwin/mount.cc
index e034981..1d54763 100644
index 5eb0289..22d7b31 100644
--- a/winsup/cygwin/mount.cc
+++ b/winsup/cygwin/mount.cc
@@ -39,7 +39,6 @@ details. */
@ -384,10 +384,10 @@ index 122a679..c447381 100644
public:
void init (bool);
diff --git a/winsup/cygwin/uinfo.cc b/winsup/cygwin/uinfo.cc
index c0a0f61..4c94d83 100644
index 6aae33c..5736ffb 100644
--- a/winsup/cygwin/uinfo.cc
+++ b/winsup/cygwin/uinfo.cc
@@ -2783,7 +2783,7 @@ pwdgrp::fetch_account_from_windows (fetch_user_arg_t &arg, cyg_ldap *pldap)
@@ -2772,7 +2772,7 @@ pwdgrp::fetch_account_from_windows (fetch_user_arg_t &arg, cyg_ldap *pldap)
dom, name,
sid.string ((char *) sidstr),
home ?: "/home/", home ? L"" : name,
@ -397,5 +397,5 @@ index c0a0f61..4c94d83 100644
free (gecos);
if (home)
--
2.31.1
2.33.0

View File

@ -1,4 +1,4 @@
From 96c67015dda33dc6e8e7c419c2d7b97c409059f1 Mon Sep 17 00:00:00 2001
From 2f41ba83a1949dfdea9a15d9736792fe0e4ca417 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=D0=90=D0=BB=D0=B5=D0=BA=D1=81=D0=B5=D0=B8=CC=86=20=D0=9F?=
=?UTF-8?q?=D0=B0=D0=B2=D0=BB=D0=BE=D0=B2?= <alexey.pawlow@gmail.com>
Date: Sun, 14 Apr 2019 21:47:21 +0300
@ -19,16 +19,16 @@ To support Cygwin-style symlinks, the new mode `sysfile` is introduced.
Co-authored-by: Johannes Schindelin <johannes.schindelin@gmx.de>
---
winsup/cygwin/environ.cc | 4 ++
winsup/cygwin/globals.cc | 5 +-
winsup/cygwin/path.cc | 151 +++++++++++++++++++++++++++++++++++++++
3 files changed, 158 insertions(+), 2 deletions(-)
winsup/cygwin/environ.cc | 4 +
winsup/cygwin/globals.cc | 3 +-
winsup/cygwin/path.cc | 154 +++++++++++++++++++++++++++++++++++++++
3 files changed, 160 insertions(+), 1 deletion(-)
diff --git a/winsup/cygwin/environ.cc b/winsup/cygwin/environ.cc
index 87650cc..0e60f30 100644
index f746841..296c890 100644
--- a/winsup/cygwin/environ.cc
+++ b/winsup/cygwin/environ.cc
@@ -86,6 +86,10 @@ set_winsymlinks (const char *buf)
@@ -88,6 +88,10 @@ set_winsymlinks (const char *buf)
else if (ascii_strncasematch (buf, "native", 6))
allow_winsymlinks = ascii_strcasematch (buf + 6, "strict")
? WSYM_nativestrict : WSYM_native;
@ -40,33 +40,31 @@ index 87650cc..0e60f30 100644
/* The structure below is used to set up an array which is used to
diff --git a/winsup/cygwin/globals.cc b/winsup/cygwin/globals.cc
index 942bd1c..019af4f 100644
index 48fb312..72e8f8f 100644
--- a/winsup/cygwin/globals.cc
+++ b/winsup/cygwin/globals.cc
@@ -55,7 +55,8 @@ enum winsym_t
WSYM_lnk,
WSYM_native,
@@ -59,6 +59,7 @@ enum winsym_t
WSYM_nativestrict,
- WSYM_nfs
+ WSYM_nfs,
WSYM_nfs,
WSYM_sysfile,
+ WSYM_deepcopy
};
exit_states NO_COPY exit_state;
@@ -69,7 +70,7 @@ bool ignore_case_with_glob;
@@ -72,7 +73,7 @@ bool ignore_case_with_glob;
bool pipe_byte;
bool reset_com;
bool wincmdln;
-winsym_t allow_winsymlinks = WSYM_sysfile;
-winsym_t allow_winsymlinks = WSYM_default;
+winsym_t allow_winsymlinks = WSYM_deepcopy;
bool disable_pcon;
bool NO_COPY in_forkee;
diff --git a/winsup/cygwin/path.cc b/winsup/cygwin/path.cc
index 4db7b24..70c9793 100644
index 5a3aa9b..f4a0881 100644
--- a/winsup/cygwin/path.cc
+++ b/winsup/cygwin/path.cc
@@ -1663,6 +1663,86 @@ conv_path_list (const char *src, char *dst, size_t size,
@@ -1682,6 +1682,89 @@ conv_path_list (const char *src, char *dst, size_t size,
/********************** Symbolic Link Support **************************/
@ -77,7 +75,7 @@ index 4db7b24..70c9793 100644
+recursiveCopy (char * src, char * dst, const char * origpath)
+{
+ WIN32_FIND_DATA dHfile;
+ HANDLE dH;
+ HANDLE dH = INVALID_HANDLE_VALUE;
+ BOOL findfiles;
+ int srcpos = strlen (src);
+ int dstpos = strlen (dst);
@ -147,15 +145,18 @@ index 4db7b24..70c9793 100644
+
+done:
+
+ if (dH != INVALID_HANDLE_VALUE)
+ FindClose (dH);
+
+ return res;
+}
+
/* Create a symlink from FROMPATH to TOPATH. */
extern "C" int
@@ -2195,6 +2275,77 @@ symlink_worker (const char *oldpath, path_conv &win32_newpath, bool isdevice)
@@ -2215,6 +2298,77 @@ symlink_worker (const char *oldpath, path_conv &win32_newpath, bool isdevice)
}
else
else /* wsym_type == WSYM_sysfile */
{
+ if (wsym_type == WSYM_deepcopy)
+ {
@ -232,5 +233,5 @@ index 4db7b24..70c9793 100644
buf = tp.t_get ();
cp = stpcpy (buf, SYMLINK_COOKIE);
--
2.31.1
2.33.0

View File

@ -1,4 +1,4 @@
From 610a2a4fcd55440ff226114c817bea521f186c97 Mon Sep 17 00:00:00 2001
From b358d0e443b95978bc71bda15496c06651258423 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=D0=90=D0=BB=D0=B5=D0=BA=D1=81=D0=B5=D0=B8=CC=86=20=D0=9F?=
=?UTF-8?q?=D0=B0=D0=B2=D0=BB=D0=BE=D0=B2?= <alexey.pawlow@gmail.com>
Date: Sun, 14 Apr 2019 21:48:54 +0300
@ -13,10 +13,10 @@ Subject: [PATCH 08/N] Automatically rewrite TERM=msys to TERM=cygwin With
1 file changed, 10 insertions(+), 1 deletion(-)
diff --git a/winsup/cygwin/environ.cc b/winsup/cygwin/environ.cc
index 0e60f30..f942ba9 100644
index 296c890..2e290a8 100644
--- a/winsup/cygwin/environ.cc
+++ b/winsup/cygwin/environ.cc
@@ -918,7 +918,16 @@ win32env_to_cygenv (PWCHAR rawenv, bool posify)
@@ -920,7 +920,16 @@ win32env_to_cygenv (PWCHAR rawenv, bool posify)
char *eq = strchrnul (newp, '=');
ucenv (newp, eq); /* uppercase env vars which need it */
if (*newp == 'T' && strncmp (newp, "TERM=", 5) == 0)
@ -35,5 +35,5 @@ index 0e60f30..f942ba9 100644
else if (*newp == 'M' && strncmp (newp, "MSYS=", 5) == 0)
parse_options (newp + 5);
--
2.31.1
2.33.0

View File

@ -1,4 +1,4 @@
From 9b66fa05485cab306c636ded5fd10b19d1b16f4a Mon Sep 17 00:00:00 2001
From b7ed4157cc491da1ff521e02236d058dcc8e9238 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=D0=90=D0=BB=D0=B5=D0=BA=D1=81=D0=B5=D0=B8=CC=86=20=D0=9F?=
=?UTF-8?q?=D0=B0=D0=B2=D0=BB=D0=BE=D0=B2?= <alexey.pawlow@gmail.com>
Date: Sun, 14 Apr 2019 21:50:55 +0300
@ -10,7 +10,7 @@ Strace is a Windows program so MSYS2 will convert all arguments and environment
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/winsup/cygwin/spawn.cc b/winsup/cygwin/spawn.cc
index 53ddc60..a04f613 100644
index c128add..9a54114 100644
--- a/winsup/cygwin/spawn.cc
+++ b/winsup/cygwin/spawn.cc
@@ -572,11 +572,13 @@ child_info_spawn::worker (const char *prog_arg, const char *const *argv,
@ -29,5 +29,5 @@ index 53ddc60..a04f613 100644
{
set_errno (E2BIG);
--
2.31.1
2.33.0

View File

@ -1,4 +1,4 @@
From ad60f22743183e807d70f2a28125f739e442987c Mon Sep 17 00:00:00 2001
From f08a6ec07fefd1cafdd1894cdb2712f50d893c2e Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=D0=90=D0=BB=D0=B5=D0=BA=D1=81=D0=B5=D0=B8=CC=86=20=D0=9F?=
=?UTF-8?q?=D0=B0=D0=B2=D0=BB=D0=BE=D0=B2?= <alexey.pawlow@gmail.com>
Date: Sun, 14 Apr 2019 22:13:51 +0300
@ -10,10 +10,10 @@ Subject: [PATCH 10/N] Special case for converting root directory to have
1 file changed, 16 insertions(+), 9 deletions(-)
diff --git a/winsup/cygwin/path.cc b/winsup/cygwin/path.cc
index 70c9793..a9bf8ec 100644
index f4a0881..d7500af 100644
--- a/winsup/cygwin/path.cc
+++ b/winsup/cygwin/path.cc
@@ -703,6 +703,12 @@ path_conv::check (const char *src, unsigned opt,
@@ -709,6 +709,12 @@ path_conv::check (const char *src, unsigned opt,
need_directory = 1;
*--tail = '\0';
}
@ -26,7 +26,7 @@ index 70c9793..a9bf8ec 100644
path_end = tail;
/* Scan path_copy from right to left looking either for a symlink
@@ -1225,16 +1231,17 @@ path_conv::check (const char *src, unsigned opt,
@@ -1248,16 +1254,17 @@ path_conv::check (const char *src, unsigned opt,
cfree (wide_path);
wide_path = NULL;
}
@ -54,5 +54,5 @@ index 70c9793..a9bf8ec 100644
}
--
2.31.1
2.33.0

View File

@ -1,4 +1,4 @@
From 85d4de44b9850e59cf216da039e25bdf815f882d Mon Sep 17 00:00:00 2001
From 0f233ab6346e0546ab7e93516784555d51083a98 Mon Sep 17 00:00:00 2001
From: Ray Donnelly <mingw.android@gmail.com>
Date: Fri, 21 Aug 2015 12:52:09 +0100
Subject: [PATCH 11/N] dcrt0.cc: Untangle allow_glob from winshell
@ -11,10 +11,10 @@ a Cygwin program.
1 file changed, 8 insertions(+), 7 deletions(-)
diff --git a/winsup/cygwin/dcrt0.cc b/winsup/cygwin/dcrt0.cc
index b851727..c2da0cb 100644
index 0d99d84..1562e27 100644
--- a/winsup/cygwin/dcrt0.cc
+++ b/winsup/cygwin/dcrt0.cc
@@ -153,12 +153,12 @@ isquote (char c)
@@ -154,12 +154,12 @@ isquote (char c)
/* Step over a run of characters delimited by quotes */
static /*__inline*/ char *
@ -29,7 +29,7 @@ index b851727..c2da0cb 100644
{
char *p;
strcpy (cmd, cmd + 1);
@@ -168,8 +168,8 @@ quoted (char *cmd, int winshell)
@@ -169,8 +169,8 @@ quoted (char *cmd, int winshell)
}
const char *s = quote == '\'' ? "'" : "\\\"";
@ -40,7 +40,7 @@ index b851727..c2da0cb 100644
while (*cmd && *++cmd)
if ((p = strpbrk (cmd, s)) == NULL)
{
@@ -290,7 +290,7 @@ globify (char *word, char **&argv, int &argc, int &argvlen)
@@ -291,7 +291,7 @@ globify (char *word, char **&argv, int &argc, int &argvlen)
/* Build argv, argc from string passed from Windows. */
static void __stdcall
@ -49,7 +49,7 @@ index b851727..c2da0cb 100644
{
int argvlen = 0;
int nesting = 0; // monitor "nesting" from insert_file
@@ -324,7 +324,7 @@ build_argv (char *cmd, char **&argv, int &argc, int winshell)
@@ -325,7 +325,7 @@ build_argv (char *cmd, char **&argv, int &argc, int winshell)
a Cygwin process, or if the word starts with a '@'.
In this case, the insert_file function needs an unquoted
DOS filename and globbing isn't performed anyway. */
@ -58,7 +58,7 @@ index b851727..c2da0cb 100644
}
if (issep (*cmd)) // End of argument if space
break;
@@ -350,7 +350,7 @@ build_argv (char *cmd, char **&argv, int &argc, int winshell)
@@ -351,7 +351,7 @@ build_argv (char *cmd, char **&argv, int &argc, int winshell)
}
/* Add word to argv file after (optional) wildcard expansion. */
@ -67,7 +67,7 @@ index b851727..c2da0cb 100644
{
debug_printf ("argv[%d] = '%s'", argc, word);
argv[argc++] = word;
@@ -940,6 +940,7 @@ dll_crt0_1 (void *)
@@ -952,6 +952,7 @@ dll_crt0_1 (void *)
/* Scan the command line and build argv. Expand wildcards if not
called from another cygwin process. */
build_argv (line, __argv, __argc,
@ -76,5 +76,5 @@ index b851727..c2da0cb 100644
/* Convert argv[0] to posix rules if it's currently blatantly
--
2.31.1
2.33.0

View File

@ -1,4 +1,4 @@
From fd56b3d6f95024cb32043a293f6e56293c22e8cc Mon Sep 17 00:00:00 2001
From bbe1dc2a71dc3d499ad5c797d3b06688db819b36 Mon Sep 17 00:00:00 2001
From: Ray Donnelly <mingw.android@gmail.com>
Date: Mon, 24 Aug 2015 00:48:06 +0100
Subject: [PATCH 12/N] dcrt0.cc (globify): Don't quote literal strings
@ -30,10 +30,10 @@ the expense of sensible forward-slash-containing input.
1 file changed, 11 insertions(+), 1 deletion(-)
diff --git a/winsup/cygwin/dcrt0.cc b/winsup/cygwin/dcrt0.cc
index c2da0cb..7ac8bf0 100644
index 1562e27..3d7974e 100644
--- a/winsup/cygwin/dcrt0.cc
+++ b/winsup/cygwin/dcrt0.cc
@@ -235,10 +235,20 @@ globify (char *word, char **&argv, int &argc, int &argvlen)
@@ -236,10 +236,20 @@ globify (char *word, char **&argv, int &argc, int &argvlen)
char quote = *s;
while (*++s && *s != quote)
{
@ -56,5 +56,5 @@ index c2da0cb..7ac8bf0 100644
size_t cnt = isascii (*s) ? 1 : mbtowc (NULL, s, MB_CUR_MAX);
if (cnt <= 1 || cnt == (size_t)-1)
--
2.31.1
2.33.0

View File

@ -1,4 +1,4 @@
From 95fda37063aa0533223d8d8b080fac536da94891 Mon Sep 17 00:00:00 2001
From 20adab04a61716223a06132c90bf9e735a275b5c Mon Sep 17 00:00:00 2001
From: Ray Donnelly <mingw.android@gmail.com>
Date: Sun, 23 Aug 2015 20:47:30 +0100
Subject: [PATCH 13/N] strace.cc: Don't set MSYS=noglob
@ -22,13 +22,13 @@ See quoted () comment:
"This must have been run from a Windows shell, so preserve
quotes for globify to play with later."
---
winsup/utils/strace.cc | 21 ++++++++++++++++++++-
winsup/utils/mingw/strace.cc | 21 ++++++++++++++++++++-
1 file changed, 20 insertions(+), 1 deletion(-)
diff --git a/winsup/utils/strace.cc b/winsup/utils/strace.cc
index 8ba5b9e..e7ac668 100644
--- a/winsup/utils/strace.cc
+++ b/winsup/utils/strace.cc
diff --git a/winsup/utils/mingw/strace.cc b/winsup/utils/mingw/strace.cc
index de4abc4..3dbce3b 100644
--- a/winsup/utils/mingw/strace.cc
+++ b/winsup/utils/mingw/strace.cc
@@ -354,10 +354,28 @@ create_child (char **argv)
make_command_line (one_line, argv);
@ -68,5 +68,5 @@ index 8ba5b9e..e7ac668 100644
NULL, /* Security */
NULL, /* thread */
--
2.31.1
2.33.0

View File

@ -1,4 +1,4 @@
From ec875f85315301408aa53f3601114cc04dffded1 Mon Sep 17 00:00:00 2001
From 41df0f040c1a4d6fd01e9c55fad6ba26c58a014b Mon Sep 17 00:00:00 2001
From: Ray Donnelly <mingw.android@gmail.com>
Date: Fri, 21 Aug 2015 12:18:52 +0100
Subject: [PATCH 14/N] Add debugging for build_argv
@ -8,10 +8,10 @@ Subject: [PATCH 14/N] Add debugging for build_argv
1 file changed, 2 insertions(+)
diff --git a/winsup/cygwin/dcrt0.cc b/winsup/cygwin/dcrt0.cc
index 7ac8bf0..4683972 100644
index 3d7974e..3434316 100644
--- a/winsup/cygwin/dcrt0.cc
+++ b/winsup/cygwin/dcrt0.cc
@@ -309,6 +309,8 @@ build_argv (char *cmd, char **&argv, int &argc, int winshell, int glob)
@@ -310,6 +310,8 @@ build_argv (char *cmd, char **&argv, int &argc, int winshell, int glob)
argvlen = 0;
argv = NULL;
@ -21,5 +21,5 @@ index 7ac8bf0..4683972 100644
while (*cmd)
{
--
2.31.1
2.33.0

View File

@ -1,16 +1,16 @@
From f9eb3fb6733aca8bf065cdd2eb5567a15bb53208 Mon Sep 17 00:00:00 2001
From bd51202286206833b724a827e4e5c3caec0ae962 Mon Sep 17 00:00:00 2001
From: Ray Donnelly <mingw.android@gmail.com>
Date: Fri, 21 Aug 2015 09:52:47 +0100
Subject: [PATCH 15/N] Add debugging for strace make_command_line
---
winsup/utils/strace.cc | 1 +
winsup/utils/mingw/strace.cc | 1 +
1 file changed, 1 insertion(+)
diff --git a/winsup/utils/strace.cc b/winsup/utils/strace.cc
index e7ac668..2fe3cac 100644
--- a/winsup/utils/strace.cc
+++ b/winsup/utils/strace.cc
diff --git a/winsup/utils/mingw/strace.cc b/winsup/utils/mingw/strace.cc
index 3dbce3b..4e5d24c 100644
--- a/winsup/utils/mingw/strace.cc
+++ b/winsup/utils/mingw/strace.cc
@@ -352,6 +352,7 @@ create_child (char **argv)
flags |= CREATE_NEW_CONSOLE | CREATE_NEW_PROCESS_GROUP;
@ -20,5 +20,5 @@ index e7ac668..2fe3cac 100644
SetConsoleCtrlHandler (NULL, 0);
/* Commit message for this code was:
--
2.31.1
2.33.0

View File

@ -1,4 +1,4 @@
From d9df8ec515cfd854d462e6104f553e36d749bb40 Mon Sep 17 00:00:00 2001
From 82ccc92d9ee08b97077dc7dcedecff96660d3e0e Mon Sep 17 00:00:00 2001
From: Ray Donnelly <mingw.android@gmail.com>
Date: Sun, 10 Apr 2016 21:47:41 +0100
Subject: [PATCH 16/N] environ.cc: New facility/environment variable
@ -25,10 +25,10 @@ it to another absolute path, R_HOME, forming an invalid path.
5 files changed, 49 insertions(+), 21 deletions(-)
diff --git a/winsup/cygwin/environ.cc b/winsup/cygwin/environ.cc
index f942ba9..34a951a 100644
index 2e290a8..49631d6 100644
--- a/winsup/cygwin/environ.cc
+++ b/winsup/cygwin/environ.cc
@@ -1183,6 +1183,10 @@ build_env (const char * const *envp, PWCHAR &envblock, int &envc,
@@ -1185,6 +1185,10 @@ build_env (const char * const *envp, PWCHAR &envblock, int &envc,
int tl = 0;
char **pass_dstp;
@ -39,7 +39,7 @@ index f942ba9..34a951a 100644
char **pass_env = (char **) alloca (sizeof (char *)
* (n + winnum + SPENVS_SIZE + 1));
/* Iterate over input list, generating a new environment list and refreshing
@@ -1191,16 +1195,25 @@ build_env (const char * const *envp, PWCHAR &envblock, int &envc,
@@ -1193,16 +1197,25 @@ build_env (const char * const *envp, PWCHAR &envblock, int &envc,
{
bool calc_tl = !no_envblock;
#ifdef __MSYS__
@ -74,7 +74,7 @@ index f942ba9..34a951a 100644
}
#endif
/* Look for entries that require special attention */
@@ -1325,7 +1338,8 @@ build_env (const char * const *envp, PWCHAR &envblock, int &envc,
@@ -1327,7 +1340,8 @@ build_env (const char * const *envp, PWCHAR &envblock, int &envc,
}
#ifdef __MSYS__
else if (!keep_posix) {
@ -85,10 +85,10 @@ index f942ba9..34a951a 100644
p = cstrdup1(win_arg);
if (win_arg != *srcp)
diff --git a/winsup/cygwin/miscfuncs.cc b/winsup/cygwin/miscfuncs.cc
index cba2140..40e443e 100644
index adf9a3d..55c8518 100644
--- a/winsup/cygwin/miscfuncs.cc
+++ b/winsup/cygwin/miscfuncs.cc
@@ -309,6 +309,27 @@ NT_readline::gets ()
@@ -325,6 +325,27 @@ NT_readline::gets ()
}
}
@ -117,7 +117,7 @@ index cba2140..40e443e 100644
void * __reg1
__import_address (void *imp)
diff --git a/winsup/cygwin/miscfuncs.h b/winsup/cygwin/miscfuncs.h
index 1ff7ee0..65605c8 100644
index 47cef6f..b3d1a6b 100644
--- a/winsup/cygwin/miscfuncs.h
+++ b/winsup/cygwin/miscfuncs.h
@@ -88,6 +88,8 @@ void backslashify (const char *, char *, bool);
@ -130,10 +130,10 @@ index 1ff7ee0..65605c8 100644
extern inline void
transform_chars (PUNICODE_STRING upath, USHORT start_idx)
diff --git a/winsup/cygwin/path.cc b/winsup/cygwin/path.cc
index a9bf8ec..4c5595d 100644
index d7500af..859ae3e 100644
--- a/winsup/cygwin/path.cc
+++ b/winsup/cygwin/path.cc
@@ -3854,7 +3854,6 @@ arg_heuristic_with_exclusions (char const * const arg, char const * exclusions,
@@ -3949,7 +3949,6 @@ arg_heuristic_with_exclusions (char const * const arg, char const * exclusions,
return arg_result;
}
@ -142,7 +142,7 @@ index a9bf8ec..4c5595d 100644
{
/* Since we've got regex linked we should maybe switch to that, but
diff --git a/winsup/cygwin/spawn.cc b/winsup/cygwin/spawn.cc
index a04f613..3e048bb 100644
index 9a54114..c098ec0 100644
--- a/winsup/cygwin/spawn.cc
+++ b/winsup/cygwin/spawn.cc
@@ -296,8 +296,7 @@ child_info_spawn::worker (const char *prog_arg, const char *const *argv,
@ -172,5 +172,5 @@ index a04f613..3e048bb 100644
/* Check if we have been called from exec{lv}p or spawn{lv}p and mask
--
2.31.1
2.33.0

View File

@ -1,4 +1,4 @@
From b216b825c9ac9dd580c9982898b92a40ed6bb133 Mon Sep 17 00:00:00 2001
From 22c7f1dfccffa9e6bc045f92d5eca18635cd31d8 Mon Sep 17 00:00:00 2001
From: SquallATF <squallatf@gmail.com>
Date: Mon, 10 Sep 2018 11:32:18 +0300
Subject: [PATCH 17/N] Fix native symbolic link spawn passing wrong arg0
@ -8,7 +8,7 @@ Subject: [PATCH 17/N] Fix native symbolic link spawn passing wrong arg0
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/winsup/cygwin/spawn.cc b/winsup/cygwin/spawn.cc
index 3e048bb..c6bfcb1 100644
index c098ec0..b21fb52 100644
--- a/winsup/cygwin/spawn.cc
+++ b/winsup/cygwin/spawn.cc
@@ -50,7 +50,7 @@ perhaps_suffix (const char *prog, path_conv& buf, int& err, unsigned opt)
@ -21,5 +21,5 @@ index 3e048bb..c6bfcb1 100644
if (buf.isdir ())
--
2.31.1
2.33.0

View File

@ -1,4 +1,4 @@
From c91decd4ba581a027e3896c02a0a05a2077b8de4 Mon Sep 17 00:00:00 2001
From 9291c55480b303b19e5fb359a3a631b3212a5083 Mon Sep 17 00:00:00 2001
From: Alexey Pavlov <alexpux@gmail.com>
Date: Fri, 24 May 2019 13:41:47 +0300
Subject: [PATCH 18/N] QueryUnbiasedInterruptTime must be load from
@ -9,18 +9,18 @@ Subject: [PATCH 18/N] QueryUnbiasedInterruptTime must be load from
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/winsup/cygwin/autoload.cc b/winsup/cygwin/autoload.cc
index 613a019..61c2808 100644
index e254397..2a03ac1 100644
--- a/winsup/cygwin/autoload.cc
+++ b/winsup/cygwin/autoload.cc
@@ -595,7 +595,7 @@ LoadDLLfunc (SetThreadGroupAffinity, 12, kernel32)
@@ -596,7 +596,7 @@ LoadDLLfunc (SetThreadGroupAffinity, 12, kernel32)
available via KernelBase.dll. */
LoadDLLfunc (QueryInterruptTime, 4, KernelBase)
LoadDLLfunc (QueryInterruptTimePrecise, 4, KernelBase)
-LoadDLLfunc (QueryUnbiasedInterruptTime, 4, KernelBase)
+LoadDLLfunc (QueryUnbiasedInterruptTime, 4, kernel32)
LoadDLLfunc (QueryUnbiasedInterruptTimePrecise, 4, KernelBase)
LoadDLLfunc (VirtualAlloc2, 28, kernelbase)
LoadDLLfunc (VirtualAlloc2, 28, KernelBase)
--
2.31.1
2.33.0

View File

@ -1,4 +1,4 @@
From c00fa53325a34bc446f6c96d81c029f850aa5961 Mon Sep 17 00:00:00 2001
From b5c582a6566e6c01bf8e0a4355750c2cb3c51706 Mon Sep 17 00:00:00 2001
From: Johannes Schindelin <johannes.schindelin@gmx.de>
Date: Wed, 17 May 2017 18:13:32 +0200
Subject: [PATCH 19/N] strace --quiet: be *really* quiet
@ -18,13 +18,13 @@ So let's just really be quiet when we're asked to be quiet.
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
---
winsup/utils/strace.cc | 3 ++-
winsup/utils/mingw/strace.cc | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/winsup/utils/strace.cc b/winsup/utils/strace.cc
index 2fe3cac..25f8f6b 100644
--- a/winsup/utils/strace.cc
+++ b/winsup/utils/strace.cc
diff --git a/winsup/utils/mingw/strace.cc b/winsup/utils/mingw/strace.cc
index 4e5d24c..a4713a2 100644
--- a/winsup/utils/mingw/strace.cc
+++ b/winsup/utils/mingw/strace.cc
@@ -352,7 +352,8 @@ create_child (char **argv)
flags |= CREATE_NEW_CONSOLE | CREATE_NEW_PROCESS_GROUP;
@ -36,5 +36,5 @@ index 2fe3cac..25f8f6b 100644
SetConsoleCtrlHandler (NULL, 0);
/* Commit message for this code was:
--
2.31.1
2.33.0

View File

@ -1,4 +1,4 @@
From e50db40edfdf5fc38cc30a02a50fd417f58f0094 Mon Sep 17 00:00:00 2001
From 2f696d72e6fd418ccf485b0beb9e41c1b455df6c Mon Sep 17 00:00:00 2001
From: Johannes Schindelin <johannes.schindelin@gmx.de>
Date: Tue, 19 May 2020 13:24:55 +0200
Subject: [PATCH 20/N] Default to `disable_pcon`
@ -37,10 +37,10 @@ Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/winsup/cygwin/globals.cc b/winsup/cygwin/globals.cc
index 019af4f..275e950 100644
index 72e8f8f..eda7af5 100644
--- a/winsup/cygwin/globals.cc
+++ b/winsup/cygwin/globals.cc
@@ -71,7 +71,7 @@ bool pipe_byte;
@@ -74,7 +74,7 @@ bool pipe_byte;
bool reset_com;
bool wincmdln;
winsym_t allow_winsymlinks = WSYM_deepcopy;
@ -50,5 +50,5 @@ index 019af4f..275e950 100644
bool NO_COPY in_forkee;
--
2.31.1
2.33.0

View File

@ -1,4 +1,4 @@
From d60979423b08e30d65fca5eac88e1ae8a09b85d7 Mon Sep 17 00:00:00 2001
From 9322ca9df0a60c70207d29167bc75342ec10b6ea Mon Sep 17 00:00:00 2001
From: Johannes Schindelin <johannes.schindelin@gmx.de>
Date: Tue, 19 May 2020 13:49:37 +0200
Subject: [PATCH 21/N] Introduce the `enable_pcon` value for `MSYS`
@ -19,7 +19,7 @@ Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
1 file changed, 9 insertions(+)
diff --git a/winsup/cygwin/environ.cc b/winsup/cygwin/environ.cc
index 34a951a..6a54ed4 100644
index 49631d6..daaa1ec 100644
--- a/winsup/cygwin/environ.cc
+++ b/winsup/cygwin/environ.cc
@@ -42,6 +42,7 @@ enum settings
@ -30,7 +30,7 @@ index 34a951a..6a54ed4 100644
setbit
};
@@ -124,6 +125,7 @@ static struct parse_thing
@@ -126,6 +127,7 @@ static struct parse_thing
{"wincmdln", {&wincmdln}, setbool, NULL, {{false}, {true}}},
{"winsymlinks", {func: set_winsymlinks}, isfunc, NULL, {{0}, {0}}},
{"disable_pcon", {&disable_pcon}, setbool, NULL, {{false}, {true}}},
@ -38,7 +38,7 @@ index 34a951a..6a54ed4 100644
{NULL, {0}, setdword, 0, {{0}, {0}}}
};
@@ -241,6 +243,13 @@ parse_options (const char *inbuf)
@@ -243,6 +245,13 @@ parse_options (const char *inbuf)
*k->setting.b = !!strtol (eq, NULL, 0);
debug_printf ("%s%s", *k->setting.b ? "" : "no", k->name);
break;
@ -53,5 +53,5 @@ index 34a951a..6a54ed4 100644
*k->setting.x &= ~k->values[istrue].i;
if (istrue || (eq && strtol (eq, NULL, 0)))
--
2.31.1
2.33.0

View File

@ -1,4 +1,4 @@
From dd3e1a94292c45985223ca8ef29cd9ac373b5c8a Mon Sep 17 00:00:00 2001
From b22c6adafcebe8dc325f5a7202015298dad5a607 Mon Sep 17 00:00:00 2001
From: Christoph Reiter <reiter.christoph@gmail.com>
Date: Fri, 5 Jun 2020 20:09:11 +0200
Subject: [PATCH 22/N] popen: call /usr/bin/sh instead of /bin/sh
@ -17,10 +17,10 @@ in this scenario, so this maybe should be extended to all of them.
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/winsup/cygwin/syscalls.cc b/winsup/cygwin/syscalls.cc
index fd8090b..1eadb71 100644
index d57371e..aa8f0ee 100644
--- a/winsup/cygwin/syscalls.cc
+++ b/winsup/cygwin/syscalls.cc
@@ -4595,7 +4595,7 @@ popen (const char *command, const char *in_type)
@@ -4610,7 +4610,7 @@ popen (const char *command, const char *in_type)
fcntl64 (stdchild, F_SETFD, stdchild_state | FD_CLOEXEC);
/* Start a shell process to run the given command without forking. */
@ -30,5 +30,5 @@ index fd8090b..1eadb71 100644
/* Reinstate the close-on-exec state */
--
2.31.1
2.33.0

View File

@ -1,19 +1,19 @@
From 366703088d235ece5aad4d1045dabc7976a8dae5 Mon Sep 17 00:00:00 2001
From e5fbfc41995045e82916fb4baea6ca640dfdb780 Mon Sep 17 00:00:00 2001
From: Christoph Reiter <reiter.christoph@gmail.com>
Date: Sun, 9 Aug 2020 14:02:51 +0200
Subject: [PATCH 23/N] CI: add a GHA for doing a basic build test
---
.github/workflows/build.yaml | 24 ++++++++++++++++++++++++
1 file changed, 24 insertions(+)
.github/workflows/build.yaml | 36 ++++++++++++++++++++++++++++++++++++
1 file changed, 36 insertions(+)
create mode 100644 .github/workflows/build.yaml
diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml
new file mode 100644
index 0000000..c7ed476
index 0000000..8b0817c
--- /dev/null
+++ b/.github/workflows/build.yaml
@@ -0,0 +1,24 @@
@@ -0,0 +1,36 @@
+name: build
+
+on: [push, pull_request]
@ -36,9 +36,20 @@ index 0000000..c7ed476
+ - name: Build
+ shell: msys2 {0}
+ run: |
+ (cd winsup && ./autogen.sh)
+ ./configure
+ make -j8
\ No newline at end of file
+
+ - name: Install
+ shell: msys2 {0}
+ run: |
+ make DESTDIR="$(pwd)"/_dest install
+
+ - name: Upload
+ uses: actions/upload-artifact@v2
+ with:
+ name: install
+ path: _dest/
--
2.31.1
2.33.0

View File

@ -1,34 +0,0 @@
From 4606a4f01af766efb0ac9a8814bd9cf70c1d02a1 Mon Sep 17 00:00:00 2001
From: Christoph Reiter <reiter.christoph@gmail.com>
Date: Mon, 15 Mar 2021 08:54:00 +0100
Subject: [PATCH 24/N] CI: Upload the build artifacts
---
.github/workflows/build.yaml | 13 ++++++++++++-
1 file changed, 12 insertions(+), 1 deletion(-)
diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml
index c7ed476..ede8d53 100644
--- a/.github/workflows/build.yaml
+++ b/.github/workflows/build.yaml
@@ -21,4 +21,15 @@ jobs:
shell: msys2 {0}
run: |
./configure
- make -j8
\ No newline at end of file
+ make -j8
+
+ - name: Install
+ shell: msys2 {0}
+ run: |
+ make DESTDIR="$(pwd)"/_dest install
+
+ - name: Upload
+ uses: actions/upload-artifact@v2
+ with:
+ name: install
+ path: _dest/
--
2.31.1

View File

@ -1,32 +1,35 @@
From 2eda2605cfbcf18f22dd6c95e678ed391fccef27 Mon Sep 17 00:00:00 2001
From 1131bc08b5660335db02276998527a89200380cf Mon Sep 17 00:00:00 2001
From: Johannes Schindelin <johannes.schindelin@gmx.de>
Date: Fri, 22 Nov 2019 11:20:22 +0100
Subject: [PATCH 25/N] Set up a GitHub Action to keep in sync with Cygwin
Subject: [PATCH 24/N] Set up a GitHub Action to keep in sync with Cygwin
This will help us by automating an otherwise tedious task.
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
---
.github/workflows/sync-with-cygwin.yml | 21 +++++++++++++++++++++
1 file changed, 21 insertions(+)
.github/workflows/sync-with-cygwin.yml | 24 ++++++++++++++++++++++++
1 file changed, 24 insertions(+)
create mode 100644 .github/workflows/sync-with-cygwin.yml
diff --git a/.github/workflows/sync-with-cygwin.yml b/.github/workflows/sync-with-cygwin.yml
new file mode 100644
index 0000000..defcdf8
index 0000000..57bd30e
--- /dev/null
+++ b/.github/workflows/sync-with-cygwin.yml
@@ -0,0 +1,21 @@
@@ -0,0 +1,24 @@
+name: sync-with-cygwin
+
+# File: .github/workflows/repo-sync.yml
+
+on:
+ workflow_dispatch:
+ schedule:
+ - cron: "42 * * * *"
+jobs:
+ repo-sync:
+ runs-on: ubuntu-latest
+ permissions:
+ contents: write
+ steps:
+ - name: Fetch Cygwin's latest master and tags
+ run: |
@ -39,5 +42,5 @@ index 0000000..defcdf8
+ run: |
+ git push https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$GITHUB_REPOSITORY refs/heads/cygwin/master 'refs/tags/*:refs/tags/*'
--
2.31.1
2.33.0

View File

@ -1,7 +1,7 @@
From 5f5bb4bf6ab444ceca383db9322945747870eaa1 Mon Sep 17 00:00:00 2001
From aca6aa309972ec1786d0bc72a55bb03464e046bc Mon Sep 17 00:00:00 2001
From: Johannes Schindelin <johannes.schindelin@gmx.de>
Date: Wed, 12 Aug 2020 12:22:38 +0200
Subject: [PATCH 27/N] Expose full command-lines to other Win32 processes by
Subject: [PATCH 25/N] Expose full command-lines to other Win32 processes by
default
In the Cygwin project, it was decided that the command-line of Cygwin
@ -26,10 +26,10 @@ Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/winsup/cygwin/globals.cc b/winsup/cygwin/globals.cc
index 275e950..abe74f2 100644
index eda7af5..7d82f80 100644
--- a/winsup/cygwin/globals.cc
+++ b/winsup/cygwin/globals.cc
@@ -69,7 +69,7 @@ bool allow_glob = true;
@@ -72,7 +72,7 @@ bool allow_glob = true;
bool ignore_case_with_glob;
bool pipe_byte;
bool reset_com;
@ -39,7 +39,7 @@ index 275e950..abe74f2 100644
bool disable_pcon = true;
diff --git a/winsup/doc/cygwinenv.xml b/winsup/doc/cygwinenv.xml
index a52b6ac..de05270 100644
index 649084d..28056e6 100644
--- a/winsup/doc/cygwinenv.xml
+++ b/winsup/doc/cygwinenv.xml
@@ -72,7 +72,7 @@ time and when handles are inherited. Defaults to set.</para>
@ -52,5 +52,5 @@ index a52b6ac..de05270 100644
<listitem>
--
2.31.1
2.33.0

View File

@ -1,7 +1,7 @@
From c31abe5e7723dd61ede43e534376cc85dbfb812b Mon Sep 17 00:00:00 2001
From ed526a3eb6003b1b2cb2b7c17a17c3f9ebcaf0fb Mon Sep 17 00:00:00 2001
From: Johannes Schindelin <johannes.schindelin@gmx.de>
Date: Wed, 17 Mar 2021 17:41:02 +0100
Subject: [PATCH 28/N] Disable the 'cygwin' GitHub workflow
Subject: [PATCH 26/N] Disable the 'cygwin' GitHub workflow
It does not work at all. For example, `rpm -E %fedora` says that there
should be version 33 of rpmsphere at
@ -19,7 +19,7 @@ Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/.github/workflows/cygwin.yml b/.github/workflows/cygwin.yml
index cdad8e6..3e1e9e6 100644
index f9a9a7a..4b541a8 100644
--- a/.github/workflows/cygwin.yml
+++ b/.github/workflows/cygwin.yml
@@ -1,6 +1,6 @@
@ -31,5 +31,5 @@ index cdad8e6..3e1e9e6 100644
jobs:
fedora-build:
--
2.31.1
2.33.0

View File

@ -1,37 +0,0 @@
From 60d92c8d5facc2c2d8f336007edfb5b1a09eed11 Mon Sep 17 00:00:00 2001
From: Christoph Reiter <reiter.christoph@gmail.com>
Date: Sun, 9 Aug 2020 13:43:50 +0200
Subject: [PATCH 26/N] recursiveCopy: Always close the used handle with
FindClose()
See https://github.com/msys2/MSYS2-packages/issues/2060
---
winsup/cygwin/path.cc | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/winsup/cygwin/path.cc b/winsup/cygwin/path.cc
index 4c5595d..561d1ac 100644
--- a/winsup/cygwin/path.cc
+++ b/winsup/cygwin/path.cc
@@ -1677,7 +1677,7 @@ static int
recursiveCopy (char * src, char * dst, const char * origpath)
{
WIN32_FIND_DATA dHfile;
- HANDLE dH;
+ HANDLE dH = INVALID_HANDLE_VALUE;
BOOL findfiles;
int srcpos = strlen (src);
int dstpos = strlen (dst);
@@ -1747,6 +1747,9 @@ recursiveCopy (char * src, char * dst, const char * origpath)
done:
+ if (dH != INVALID_HANDLE_VALUE)
+ FindClose (dH);
+
return res;
}
--
2.31.1

View File

@ -1,7 +1,7 @@
From c3de1fd2656cf2327d9cbee70dad14d1927077de Mon Sep 17 00:00:00 2001
From 0c8795022cb2ed694cf4545446ee883327c6905e Mon Sep 17 00:00:00 2001
From: Johannes Schindelin <johannes.schindelin@gmx.de>
Date: Wed, 31 Mar 2021 11:38:41 +0200
Subject: [PATCH 29/N] Do not show Error dialogs by default
Subject: [PATCH 27/N] Do not show Error dialogs by default
In https://github.com/msys2/msys2-runtime/pull/18, we discussed a change
that would allow default Windows error handling of spawned processes to
@ -27,10 +27,10 @@ Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
3 files changed, 3 insertions(+), 1 deletion(-)
diff --git a/winsup/cygwin/environ.cc b/winsup/cygwin/environ.cc
index 6a54ed4..e1dbba3 100644
index daaa1ec..f4e2c68 100644
--- a/winsup/cygwin/environ.cc
+++ b/winsup/cygwin/environ.cc
@@ -126,6 +126,7 @@ static struct parse_thing
@@ -128,6 +128,7 @@ static struct parse_thing
{"winsymlinks", {func: set_winsymlinks}, isfunc, NULL, {{0}, {0}}},
{"disable_pcon", {&disable_pcon}, setbool, NULL, {{false}, {true}}},
{"enable_pcon", {&disable_pcon}, setnegbool, NULL, {{true}, {false}}},
@ -39,10 +39,10 @@ index 6a54ed4..e1dbba3 100644
};
diff --git a/winsup/cygwin/globals.cc b/winsup/cygwin/globals.cc
index abe74f2..67103f4 100644
index 7d82f80..a9c7e1c 100644
--- a/winsup/cygwin/globals.cc
+++ b/winsup/cygwin/globals.cc
@@ -72,6 +72,7 @@ bool reset_com;
@@ -75,6 +75,7 @@ bool reset_com;
bool wincmdln = true;
winsym_t allow_winsymlinks = WSYM_deepcopy;
bool disable_pcon = true;
@ -51,7 +51,7 @@ index abe74f2..67103f4 100644
bool NO_COPY in_forkee;
diff --git a/winsup/cygwin/spawn.cc b/winsup/cygwin/spawn.cc
index c6bfcb1..6c580d7 100644
index b21fb52..7dfe1b1 100644
--- a/winsup/cygwin/spawn.cc
+++ b/winsup/cygwin/spawn.cc
@@ -462,7 +462,7 @@ child_info_spawn::worker (const char *prog_arg, const char *const *argv,
@ -64,5 +64,5 @@ index c6bfcb1..6c580d7 100644
/* We're adding the CREATE_BREAKAWAY_FROM_JOB flag here to workaround
--
2.31.1
2.33.0

View File

@ -0,0 +1,385 @@
From ebcfae76d4999d3141533900338a012b1db9c0e8 Mon Sep 17 00:00:00 2001
From: Johannes Schindelin <johannes.schindelin@gmx.de>
Date: Mon, 16 Apr 2018 14:59:39 +0200
Subject: [PATCH 28/N] Add a helper to obtain a function's address in
kernel32.dll
In particular, we are interested in the address of the CtrlRoutine
and the ExitProcess functions. Since kernel32.dll is loaded first thing,
the addresses will be the same for all processes (matching the
CPU architecture, of course).
This will help us with emulating SIGINT properly (by not sending signals
to *all* processes attached to the same Console, as
GenerateConsoleCtrlEvent() would do).
Co-authored-by: Naveen M K <naveen@syrusdark.website>
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
---
winsup/configure.ac | 5 +
winsup/utils/mingw/Makefile.am | 15 ++
winsup/utils/mingw/getprocaddr.c | 310 +++++++++++++++++++++++++++++++
3 files changed, 330 insertions(+)
create mode 100644 winsup/utils/mingw/getprocaddr.c
diff --git a/winsup/configure.ac b/winsup/configure.ac
index 9a11411..5eb3273 100644
--- a/winsup/configure.ac
+++ b/winsup/configure.ac
@@ -95,6 +95,11 @@ if test "x$with_cross_bootstrap" != "xyes"; then
test -n "$MINGW_CXX" || AC_MSG_ERROR([no acceptable MinGW g++ found in \$PATH])
AC_CHECK_PROGS(MINGW_CC, ${target_cpu}-w64-mingw32-gcc)
test -n "$MINGW_CC" || AC_MSG_ERROR([no acceptable MinGW gcc found in \$PATH])
+
+ AC_CHECK_PROGS(MINGW32_CC, i686-w64-mingw32-gcc)
+ test -n "$MINGW32_CC" || AC_MSG_ERROR([no acceptable mingw32 gcc found in \$PATH])
+ AC_CHECK_PROGS(MINGW64_CC, x86_64-w64-mingw32-gcc)
+ test -n "$MINGW64_CC" || AC_MSG_ERROR([no acceptable mingw64 gcc found in \$PATH])
fi
AM_CONDITIONAL(CROSS_BOOTSTRAP, [test "x$with_cross_bootstrap" != "xyes"])
diff --git a/winsup/utils/mingw/Makefile.am b/winsup/utils/mingw/Makefile.am
index 46d8213..0e4218a 100644
--- a/winsup/utils/mingw/Makefile.am
+++ b/winsup/utils/mingw/Makefile.am
@@ -26,6 +26,21 @@ bin_PROGRAMS = \
ldh \
strace
+libexec_PROGRAMS = getprocaddr32 getprocaddr64
+
+# Must *not* use -O2 here, as it screws up the stack backtrace
+getprocaddr32.o: %32.o: %.c
+ $(MINGW32_CC) -c -o $@ $<
+
+getprocaddr32.exe: %.exe: %.o
+ $(MINGW32_CC) -o $@ $^ -static -ldbghelp
+
+getprocaddr64.o: %64.o: %.c
+ $(MINGW64_CC) -c -o $@ $<
+
+getprocaddr64.exe: %.exe: %.o
+ $(MINGW64_CC) -o $@ $^ -static -ldbghelp
+
cygcheck_SOURCES = \
bloda.cc \
cygcheck.cc \
diff --git a/winsup/utils/mingw/getprocaddr.c b/winsup/utils/mingw/getprocaddr.c
new file mode 100644
index 0000000..25814c7
--- /dev/null
+++ b/winsup/utils/mingw/getprocaddr.c
@@ -0,0 +1,310 @@
+/* getprocaddr.c
+
+This program is a helper for getting the pointers for the
+functions in kernel32 module, and optionally injects a remote
+thread that runs those functions given a pid and exit code.
+
+We use dbghelp.dll to get the pointer to kernel32!CtrlRoutine
+because it isn't exported. For that, we try to generate console
+event (Ctrl+Break) ourselves, to find the pointer, and it is
+printed if asked to, or a remote thread is injected to run the
+given function.
+
+This software is a copyrighted work licensed under the terms of the
+Cygwin license. Please consult the file "CYGWIN_LICENSE" for
+details. */
+
+#include <stdio.h>
+#include <windows.h>
+
+/* Include dbghelp.h after windows.h */
+#include <dbghelp.h>
+
+static DWORD pid;
+static uintptr_t exit_code;
+static HANDLE CtrlEvent;
+
+static int
+inject_remote_thread_into_process (HANDLE process,
+ LPTHREAD_START_ROUTINE address,
+ uintptr_t exit_code,
+ DWORD *thread_return)
+{
+ int res = -1;
+
+ if (!address)
+ return res;
+ DWORD thread_id;
+ HANDLE thread = CreateRemoteThread (process, NULL, 1024 * 1024, address,
+ (PVOID)exit_code, 0, &thread_id);
+ if (thread)
+ {
+ /*
+ * Wait up to 10 seconds (arbitrary constant) for the thread to finish;
+ * Maybe we should wait forever? I have seen Cmd does so, but well...
+ */
+ if (WaitForSingleObject (thread, 10000) == WAIT_OBJECT_0)
+ res = 0;
+ /*
+ According to the docs at MSDN for GetExitCodeThread, it will
+ get the return value from the function, here CtrlRoutine. So, this
+ checks if the Ctrl Event is handled correctly by the process.
+
+ By some testing I could see CtrlRoutine returns 0 in case where
+ CtrlEvent set by SetConsoleCtrlHandler is handled correctly, in all
+ other cases it returns something non-zero(not sure what it that).
+ */
+ if (thread_return != NULL)
+ GetExitCodeThread (thread, thread_return);
+
+ CloseHandle (thread);
+ }
+
+ return res;
+}
+
+/* Here, we send a CtrlEvent to the current process for the
+ * sole purpose of capturing the address of the CtrlRoutine
+ * function, by looking the stack trace.
+ *
+ * This hack is needed because we cannot use GetProcAddress()
+ * as we do for ExitProcess(), because CtrlRoutine is not
+ * exported (although the .pdb files ensure that we can see
+ * it in a debugger).
+ */
+static WINAPI BOOL
+ctrl_handler (DWORD ctrl_type)
+{
+ unsigned short count;
+ void *address;
+ HANDLE process;
+ PSYMBOL_INFOW info;
+ DWORD64 displacement;
+ DWORD thread_return = 0;
+
+ count = CaptureStackBackTrace (1l /* skip this function */,
+ 1l /* return only one trace item */, &address,
+ NULL);
+ if (count != 1)
+ {
+ fprintf (stderr, "Could not capture backtrace\n");
+ return FALSE;
+ }
+
+ process = GetCurrentProcess ();
+ if (!SymInitialize (process, NULL, TRUE))
+ {
+ fprintf (stderr, "Could not initialize symbols\n");
+ return FALSE;
+ }
+
+ info = (PSYMBOL_INFOW)malloc (sizeof (*info)
+ + MAX_SYM_NAME * sizeof (wchar_t));
+ if (!info)
+ {
+ fprintf (stderr, "Could not allocate symbol info structure\n");
+ return FALSE;
+ }
+ info->SizeOfStruct = sizeof (*info);
+ info->MaxNameLen = MAX_SYM_NAME;
+
+ if (!SymFromAddrW (process, (DWORD64) (intptr_t)address, &displacement,
+ info))
+ {
+ fprintf (stderr, "Could not get symbol info\n");
+ SymCleanup (process);
+ return FALSE;
+ }
+
+ if (pid == 0)
+ {
+ printf ("%p\n", (void *)(intptr_t)info->Address);
+ }
+ else
+ {
+ LPTHREAD_START_ROUTINE address =
+ (LPTHREAD_START_ROUTINE) (intptr_t)info->Address;
+ HANDLE h = OpenProcess (PROCESS_CREATE_THREAD |
+ PROCESS_QUERY_INFORMATION |
+ PROCESS_VM_OPERATION |
+ PROCESS_VM_WRITE |
+ PROCESS_VM_READ, FALSE, pid);
+ if (h == NULL)
+ {
+ fprintf (stderr, "OpenProcess failed: %ld\n", GetLastError ());
+ return 1;
+ }
+ /* Inject the remote thread only when asked to */
+ if (inject_remote_thread_into_process (h, address, exit_code,
+ &thread_return) < 0)
+ {
+ fprintf (stderr,
+ "Error while injecting remote thread for pid(%lu)\n", pid);
+ exit (1); /*We should exit immediately or else there will a 10s hang
+ waiting for the event to happen.*/
+ }
+ if (thread_return)
+ fprintf (stderr,
+ "Injected remote thread for pid(%lu) returned %lu\n", pid,
+ thread_return);
+ }
+ SymCleanup (process);
+ if (!SetEvent (CtrlEvent))
+ {
+ fprintf (stderr, "SetEvent failed (%ld)\n", GetLastError ());
+ return 1;
+ }
+ exit (thread_return != 0);
+}
+
+/* The easy route for finding the address of CtrlRoutine
+ * would be use GetProcAddress() but this isn't viable
+ * here because that symbol isn't exported.
+ */
+static int
+find_ctrl_routine_the_hard_way ()
+{
+ /*
+ * Avoid terminating all processes attached to the current console;
+ * This would happen if we used the same console as the caller, though,
+ * because we are sending a CtrlEvent on purpose (which _is_ sent to
+ * all processes connected to the same console, and the other processes
+ * are most likely unprepared for that CTRL_BREAK_EVENT and would be
+ * terminated as a consequence, _including the caller_).
+ *
+ * In case we get only one result from GetConsoleProcessList(), we don't
+ * need to create and allocate a new console, and it could avoid a console
+ * window popping up.
+ */
+ DWORD proc_lists;
+ if (GetConsoleProcessList (&proc_lists, 5) > 1)
+ {
+ if (!FreeConsole () && GetLastError () != ERROR_INVALID_PARAMETER)
+ {
+ fprintf (stderr, "Could not detach from current Console: %ld\n",
+ GetLastError ());
+ return 1;
+ }
+ if (!AllocConsole ())
+ {
+ fprintf (stderr, "Could not allocate a new Console\n");
+ return 1;
+ }
+ }
+
+ CtrlEvent = CreateEvent (NULL, // default security attributes
+ TRUE, // manual-reset event
+ FALSE, // initial state is nonsignaled
+ NULL // object name
+ );
+
+ if (CtrlEvent == NULL)
+ {
+ fprintf (stderr, "CreateEvent failed (%ld)\n", GetLastError ());
+ return 1;
+ }
+
+
+ if (!SetConsoleCtrlHandler (ctrl_handler, TRUE))
+ {
+ fprintf (stderr, "Could not register Ctrl handler\n");
+ return 1;
+ }
+
+ if (!GenerateConsoleCtrlEvent (CTRL_BREAK_EVENT, 0))
+ {
+ fprintf (stderr, "Could not simulate Ctrl+Break\n");
+ return 1;
+ }
+
+ if (WaitForSingleObject (CtrlEvent, 10000 /* 10 seconds*/) != WAIT_OBJECT_0)
+ {
+ fprintf (stderr, "WaitForSingleObject failed (%ld)\n", GetLastError ());
+ return 1;
+ }
+ return 0;
+}
+
+static void *
+get_proc_addr (const char * module_name, const char * function_name)
+{
+ HMODULE module = GetModuleHandle (module_name);
+ if (!module)
+ return NULL;
+ return (void *)GetProcAddress (module, function_name);
+}
+
+int
+main (int argc, char **argv)
+{
+ char *end;
+ void *address;
+ BOOL is_ctrl_routine;
+ DWORD thread_return = 0;
+
+ if (argc == 4)
+ {
+ exit_code = atoi (argv[2]);
+ pid = strtoul (argv[3], NULL, 0);
+ }
+ else if (argc == 2)
+ {
+ pid = 0;
+ }
+ else
+ {
+ fprintf (stderr, "Need a function name, exit code and pid\n"
+ "Or needs a function name.\n");
+ return 1;
+ }
+
+ is_ctrl_routine = strcmp (argv[1], "CtrlRoutine") == 0;
+ address = get_proc_addr ("kernel32", argv[1]);
+ if (is_ctrl_routine && !address)
+ {
+ /* CtrlRoutine is undocumented, and has been seen in both
+ * kernel32 and kernelbase
+ */
+ address = get_proc_addr ("kernelbase", argv[1]);
+ if (!address)
+ return find_ctrl_routine_the_hard_way ();
+ }
+
+ if (!address)
+ {
+ fprintf (stderr, "Could not get proc address\n");
+ return 1;
+ }
+
+ if (pid == 0)
+ {
+ printf ("%p\n", address);
+ fflush (stdout);
+ return 0;
+ }
+ HANDLE h = OpenProcess (PROCESS_CREATE_THREAD |
+ PROCESS_QUERY_INFORMATION | PROCESS_VM_OPERATION |
+ PROCESS_VM_WRITE | PROCESS_VM_READ, FALSE, pid);
+ if (h == NULL)
+ {
+ fprintf (stderr, "OpenProcess failed: %ld\n", GetLastError ());
+ return 1;
+ }
+ /* Inject the remote thread */
+ if (inject_remote_thread_into_process (h, (LPTHREAD_START_ROUTINE)address,
+ exit_code, &thread_return) < 0)
+ {
+ fprintf (stderr, "Could not inject thread into process %lu\n", pid);
+ return 1;
+ }
+
+ if (is_ctrl_routine && thread_return)
+ {
+ fprintf (stderr,
+ "Injected remote thread for pid %lu returned %lu\n", pid,
+ thread_return);
+ return 1;
+ }
+
+ return 0;
+}
--
2.33.0

View File

@ -1,7 +1,7 @@
From 55202e1291da165b2b47c726171fb73e007cbed7 Mon Sep 17 00:00:00 2001
From 17a8f32e326cd366c737c23ffd0352f4cc327d87 Mon Sep 17 00:00:00 2001
From: Johannes Schindelin <johannes.schindelin@gmx.de>
Date: Fri, 20 Mar 2015 09:56:28 +0000
Subject: [PATCH 40/N] Emulate GenerateConsoleCtrlEvent() upon Ctrl+C
Subject: [PATCH 29/N] Emulate GenerateConsoleCtrlEvent() upon Ctrl+C
This patch is heavily inspired by the Git for Windows' strategy in
handling Ctrl+C.
@ -88,8 +88,8 @@ Co-authored-by: Naveen M K <naveen@syrusdark.website>
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
---
winsup/cygwin/exceptions.cc | 20 +-
winsup/cygwin/include/cygwin/exit_process.h | 282 ++++++++++++++++++++
2 files changed, 300 insertions(+), 2 deletions(-)
winsup/cygwin/include/cygwin/exit_process.h | 364 ++++++++++++++++++++
2 files changed, 382 insertions(+), 2 deletions(-)
create mode 100644 winsup/cygwin/include/cygwin/exit_process.h
diff --git a/winsup/cygwin/exceptions.cc b/winsup/cygwin/exceptions.cc
@ -132,10 +132,10 @@ index c638044..86e154d 100644
sigproc_printf ("signal %d, signal handler %p", si.si_signo, handler);
diff --git a/winsup/cygwin/include/cygwin/exit_process.h b/winsup/cygwin/include/cygwin/exit_process.h
new file mode 100644
index 0000000..19b8e60
index 0000000..0486a0c
--- /dev/null
+++ b/winsup/cygwin/include/cygwin/exit_process.h
@@ -0,0 +1,282 @@
@@ -0,0 +1,364 @@
+#ifndef EXIT_PROCESS_H
+#define EXIT_PROCESS_H
+
@ -184,7 +184,7 @@ index 0000000..19b8e60
+#define small_printf(...) fprintf (stderr, __VA_ARGS__)
+#endif
+
+static BOOL get_wow (HANDLE process, BOOL &is_wow, int &bitness);
+static BOOL get_wow (HANDLE process, BOOL &is_wow, USHORT &process_arch);
+static int exit_process_tree (HANDLE main_process, int exit_code);
+
+static BOOL
@ -192,34 +192,47 @@ index 0000000..19b8e60
+ DWORD pid)
+{
+ BOOL is_wow;
+ int bitness;
+ if (!get_wow (process, is_wow, bitness))
+ USHORT process_arch;
+ if (!get_wow (process, is_wow, process_arch))
+ {
+ return FALSE;
+ }
+
+ const char *name;
+ if (bitness == 32)
+ switch (process_arch)
+ {
+ case IMAGE_FILE_MACHINE_I386:
+ name = "/usr/libexec/getprocaddr32.exe";
+ else if (bitness == 64)
+ break;
+ case IMAGE_FILE_MACHINE_AMD64:
+ name = "/usr/libexec/getprocaddr64.exe";
+ else
+ return NULL; /* what?!? */
+ break;
+ /* TODO: provide exes for these */
+ case IMAGE_FILE_MACHINE_ARMNT:
+ name = "/usr/libexec/getprocaddrarm32.exe";
+ break;
+ case IMAGE_FILE_MACHINE_ARM64:
+ name = "/usr/libexec/getprocaddrarm64.exe";
+ break;
+ default:
+ return FALSE; /* what?!? */
+ }
+ wchar_t wbuf[PATH_MAX];
+
+ if (cygwin_conv_path (CCP_POSIX_TO_WIN_W, name, wbuf, PATH_MAX)
+ || GetFileAttributesW (wbuf) == INVALID_FILE_ATTRIBUTES)
+ return NULL;
+ return FALSE;
+
+ STARTUPINFOW si = {};
+ PROCESS_INFORMATION pi;
+ size_t len = wcslen (wbuf) + wcslen (function_name) + 3 /* exit code */
+ + 1 /* space */ + 10 /* process ID, i.e. DWORD */ + 1 /* NUL */;
+ size_t len = wcslen (wbuf) + 1 /* space */ + wcslen (function_name)
+ + 1 /* space */ + 3 /* exit code */ + 1 /* space */
+ + 10 /* process ID, i.e. DWORD */ + 1 /* NUL */;
+ WCHAR cmd[len + 1];
+ WCHAR title[] = L"cygwin-console-helper";
+ DWORD process_exit;
+
+ swprintf (cmd, len + 1, L"%S %S %d %ld", wbuf, function_name, exit_code,
+ swprintf (cmd, len + 1, L"%S %S %d %u", wbuf, function_name, exit_code,
+ pid);
+
+ si.cb = sizeof (si);
@ -253,9 +266,30 @@ index 0000000..19b8e60
+static int current_is_wow = -1;
+static int is_32_bit_os = -1;
+
+typedef BOOL (WINAPI * IsWow64Process2_t) (HANDLE, USHORT *, USHORT *);
+static bool wow64process2initialized = false;
+static IsWow64Process2_t pIsWow64Process2 /* = NULL */;
+
+typedef BOOL (WINAPI * GetProcessInformation_t) (HANDLE,
+ PROCESS_INFORMATION_CLASS,
+ LPVOID, DWORD);
+static bool getprocessinfoinitialized = false;
+static GetProcessInformation_t pGetProcessInformation /* = NULL */;
+
+static BOOL
+get_wow (HANDLE process, BOOL &is_wow, int &bitness)
+get_wow (HANDLE process, BOOL &is_wow, USHORT &process_arch)
+{
+ USHORT native_arch = IMAGE_FILE_MACHINE_UNKNOWN;
+ if (!wow64process2initialized)
+ {
+ pIsWow64Process2 = (IsWow64Process2_t)
+ GetProcAddress (GetModuleHandle ("KERNEL32"),
+ "IsWow64Process2");
+ MemoryBarrier ();
+ wow64process2initialized = true;
+ }
+ if (!pIsWow64Process2)
+ {
+ if (is_32_bit_os == -1)
+ {
+ SYSTEM_INFO info;
@ -279,7 +313,49 @@ index 0000000..19b8e60
+ if (!IsWow64Process (process, &is_wow))
+ return FALSE;
+
+ bitness = is_32_bit_os || is_wow ? 32 : 64;
+ process_arch = is_32_bit_os || is_wow ? IMAGE_FILE_MACHINE_I386 :
+ IMAGE_FILE_MACHINE_AMD64;
+ return TRUE;
+ }
+
+ if (!pIsWow64Process2 (process, &process_arch, &native_arch))
+ return FALSE;
+
+ /* The value will be IMAGE_FILE_MACHINE_UNKNOWN if the target process
+ * is not a WOW64 process
+ */
+ if (process_arch == IMAGE_FILE_MACHINE_UNKNOWN)
+ {
+ struct /* _PROCESS_MACHINE_INFORMATION */
+ {
+ /* 0x0000 */ USHORT ProcessMachine;
+ /* 0x0002 */ USHORT Res0;
+ /* 0x0004 */ DWORD MachineAttributes;
+ } /* size: 0x0008 */ process_machine_info;
+
+ is_wow = FALSE;
+ /* However, x86_64 on ARM64 claims not to be WOW64, so we have to
+ * dig harder... */
+ if (!getprocessinfoinitialized)
+ {
+ pGetProcessInformation = (GetProcessInformation_t)
+ GetProcAddress (GetModuleHandle ("KERNEL32"),
+ "GetProcessInformation");
+ MemoryBarrier ();
+ getprocessinfoinitialized = true;
+ }
+ /*#define ProcessMachineTypeInfo 9*/
+ if (pGetProcessInformation &&
+ pGetProcessInformation (process, (PROCESS_INFORMATION_CLASS)9,
+ &process_machine_info, sizeof (process_machine_info)))
+ process_arch = process_machine_info.ProcessMachine;
+ else
+ process_arch = native_arch;
+ }
+ else
+ {
+ is_wow = TRUE;
+ }
+ return TRUE;
+}
+
@ -300,10 +376,12 @@ index 0000000..19b8e60
+ {
+ case SIGINT:
+ case SIGQUIT:
+ /* We are not going to kill them but simply say that Ctrl+C
+ is pressed. If the processes want they can exit or else
+ just wait.*/
+ if (kill_via_console_helper (
+ process, L"CtrlRoutine",
+ signo == SIGINT ? CTRL_C_EVENT : CTRL_BREAK_EVENT, pid) &&
+ GetExitCodeProcess(process, &code) && code != STILL_ACTIVE)
+ signo == SIGINT ? CTRL_C_EVENT : CTRL_BREAK_EVENT, pid))
+ return 0;
+ /* fall-through */
+ case SIGTERM:
@ -332,10 +410,10 @@ index 0000000..19b8e60
+ PROCESSENTRY32 entry;
+ DWORD pids[16384];
+ int max_len = sizeof (pids) / sizeof (*pids), i, len, ret = 0;
+ pid_t pid = GetProcessId (main_process);
+ DWORD pid = GetProcessId (main_process);
+ int signo = exit_code & 0x7f;
+
+ pids[0] = (DWORD)pid;
+ pids[0] = pid;
+ len = 1;
+
+ /*
@ -387,6 +465,8 @@ index 0000000..19b8e60
+ break;
+ }
+
+ CloseHandle (snapshot);
+
+ for (i = len - 1; i >= 0; i--)
+ {
+ HANDLE process;
@ -400,7 +480,9 @@ index 0000000..19b8e60
+ | PROCESS_VM_OPERATION | PROCESS_VM_WRITE | PROCESS_VM_READ,
+ FALSE, pids[i]);
+ if (!process)
+ process = OpenProcess (PROCESS_TERMINATE, FALSE, pids[i]);
+ process = OpenProcess (
+ PROCESS_QUERY_LIMITED_INFORMATION | PROCESS_TERMINATE,
+ FALSE, pids[i]);
+ }
+ DWORD code;
+
@ -410,7 +492,7 @@ index 0000000..19b8e60
+ if (!exit_process (process, exit_code))
+ ret = -1;
+ }
+ if (process)
+ if (process && process != main_process)
+ CloseHandle (process);
+ }
+
@ -419,5 +501,5 @@ index 0000000..19b8e60
+
+#endif
--
2.31.1
2.33.0

View File

@ -1,7 +1,7 @@
From d8b7c36469cc38280e07b32e552b763841a2b134 Mon Sep 17 00:00:00 2001
From 0bff285e26446826fbb12112c52e4e2f828cdaf9 Mon Sep 17 00:00:00 2001
From: Johannes Schindelin <johannes.schindelin@gmx.de>
Date: Fri, 20 Mar 2015 10:01:50 +0000
Subject: [PATCH 41/N] kill: kill Win32 processes more gently
Subject: [PATCH 30/N] kill: kill Win32 processes more gently
This change is the equivalent to the change to the Ctrl+C handling we
just made.
@ -13,7 +13,7 @@ Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
1 file changed, 15 insertions(+), 4 deletions(-)
diff --git a/winsup/utils/kill.cc b/winsup/utils/kill.cc
index d0fb547..e55df49 100644
index d0fb547..ad718c3 100644
--- a/winsup/utils/kill.cc
+++ b/winsup/utils/kill.cc
@@ -17,6 +17,7 @@ details. */
@ -44,11 +44,11 @@ index d0fb547..e55df49 100644
+ CloseHandle(h);
+ h = h2;
+ }
+ exit_process_tree (h2, 128 + sig);
+ exit_process_tree (h, 128 + sig);
+ }
CloseHandle (h);
}
--
2.31.1
2.33.0

View File

@ -1,52 +0,0 @@
From 0eee28b4ad46bcf4ed60d6bb612dc1e477b639b1 Mon Sep 17 00:00:00 2001
From: Christoph Reiter <reiter.christoph@gmail.com>
Date: Mon, 22 Mar 2021 08:10:23 +0100
Subject: [PATCH 30/N] uname: limit sysname to "MSYS" or "MINGW"
uname just included the content of the MSYSTEM env var as sysname
which leads to problems in case build tools use it detect a mingw build
and MSYSTEM is something like UCRT or CLANG.
To work around that, in case MSYSTEM is not set, empty, or not MSYS, then
we just output a hardcoded "MINGW".
And because various scripts hardcode checks for MINGW32/MINGW64 we return MINGW64,
unless there is a "32" in MSYSTEM, in which case we return MINGW32.
---
winsup/cygwin/uname.cc | 12 ++++++++----
1 file changed, 8 insertions(+), 4 deletions(-)
diff --git a/winsup/cygwin/uname.cc b/winsup/cygwin/uname.cc
index 28bcd63..daed73f 100644
--- a/winsup/cygwin/uname.cc
+++ b/winsup/cygwin/uname.cc
@@ -37,9 +37,11 @@ uname_x (struct utsname *name)
memset (name, 0, sizeof (*name));
/* sysname */
char* msystem = getenv("MSYSTEM");
- const char *msystem_msys = "MSYS";
+ const char* msystem_sysname = "MSYS";
+ if (msystem != NULL && *msystem && strcmp(msystem, "MSYS") != 0)
+ msystem_sysname = (strstr(msystem, "32") != NULL) ? "MINGW32" : "MINGW64";;
__small_sprintf (name->sysname, "%s_%s-%u%s",
- msystem ? msystem : msystem_msys,
+ msystem_sysname,
wincap.osname (), wincap.build_number (),
wincap.is_wow64 () ? "-WOW64" : "");
/* nodename */
@@ -103,8 +105,10 @@ uname (struct utsname *in_name)
memset (name, 0, sizeof (*name));
#ifdef __MSYS__
char* msystem = getenv("MSYSTEM");
- const char *msystem_msys = "MSYS";
- __small_sprintf (name->sysname, "%s_%s", msystem ? msystem : msystem_msys, wincap.osname ());
+ const char* msystem_sysname = "MSYS";
+ if (msystem != NULL && *msystem && strcmp(msystem, "MSYS") != 0)
+ msystem_sysname = (strstr(msystem, "32") != NULL) ? "MINGW32" : "MINGW64";
+ __small_sprintf (name->sysname, "%s_%s", msystem_sysname, wincap.osname ());
#else
__small_sprintf (name->sysname, "CYGWIN_%s", wincap.osname ());
#endif
--
2.31.1

View File

@ -1,32 +0,0 @@
From 42ddcfff2eb94055b35bc68d84ec5faafa982faf Mon Sep 17 00:00:00 2001
From: Christoph Reiter <reiter.christoph@gmail.com>
Date: Fri, 23 Apr 2021 19:24:33 +0200
Subject: [PATCH 31/N] CI: give the cygwin sync job explicit write permissions
So we can change the default repo permissions to read-only
---
.github/workflows/sync-with-cygwin.yml | 3 +++
1 file changed, 3 insertions(+)
diff --git a/.github/workflows/sync-with-cygwin.yml b/.github/workflows/sync-with-cygwin.yml
index defcdf8..57bd30e 100644
--- a/.github/workflows/sync-with-cygwin.yml
+++ b/.github/workflows/sync-with-cygwin.yml
@@ -3,11 +3,14 @@ name: sync-with-cygwin
# File: .github/workflows/repo-sync.yml
on:
+ workflow_dispatch:
schedule:
- cron: "42 * * * *"
jobs:
repo-sync:
runs-on: ubuntu-latest
+ permissions:
+ contents: write
steps:
- name: Fetch Cygwin's latest master and tags
run: |
--
2.31.1

View File

@ -1,7 +1,7 @@
From b671a59da80fa1db6115e3275149f9639681453a Mon Sep 17 00:00:00 2001
From 891fb6976639913168a71efd07afdcdc3d1baa3c Mon Sep 17 00:00:00 2001
From: Jeremy Drake <github@jdrake.com>
Date: Thu, 22 Jul 2021 11:59:16 -0700
Subject: [PATCH 48/N] Cygwin: make option for native inner link handling.
Subject: [PATCH 31/N] Cygwin: make option for native inner link handling.
This code has been causing issues with SUBST and mapped network drives,
so add an option (defaulted to on) which can be used to disable it where
@ -13,10 +13,10 @@ needed. MSYS=nonativeinnerlinks
3 files changed, 4 insertions(+), 1 deletion(-)
diff --git a/winsup/cygwin/environ.cc b/winsup/cygwin/environ.cc
index e1dbba3..91e3e9c 100644
index f4e2c68..18c37ee 100644
--- a/winsup/cygwin/environ.cc
+++ b/winsup/cygwin/environ.cc
@@ -127,6 +127,7 @@ static struct parse_thing
@@ -129,6 +129,7 @@ static struct parse_thing
{"disable_pcon", {&disable_pcon}, setbool, NULL, {{false}, {true}}},
{"enable_pcon", {&disable_pcon}, setnegbool, NULL, {{true}, {false}}},
{"winjitdebug", {&winjitdebug}, setbool, NULL, {{false}, {true}}},
@ -25,10 +25,10 @@ index e1dbba3..91e3e9c 100644
};
diff --git a/winsup/cygwin/globals.cc b/winsup/cygwin/globals.cc
index a729e70..a144a98 100644
index a9c7e1c..6faf38d 100644
--- a/winsup/cygwin/globals.cc
+++ b/winsup/cygwin/globals.cc
@@ -75,6 +75,7 @@ bool wincmdln = true;
@@ -76,6 +76,7 @@ bool wincmdln = true;
winsym_t allow_winsymlinks = WSYM_deepcopy;
bool disable_pcon = true;
bool winjitdebug = false;
@ -37,10 +37,10 @@ index a729e70..a144a98 100644
bool NO_COPY in_forkee;
diff --git a/winsup/cygwin/path.cc b/winsup/cygwin/path.cc
index 67124bb..2cf8c93 100644
index 859ae3e..3f24217 100644
--- a/winsup/cygwin/path.cc
+++ b/winsup/cygwin/path.cc
@@ -3641,7 +3641,8 @@ restart:
@@ -3644,7 +3644,8 @@ restart:
goto file_not_symlink;
}
#endif /* __i386__ */
@ -51,5 +51,5 @@ index 67124bb..2cf8c93 100644
PWCHAR fpbuf = tp.w_get ();
DWORD ret;
--
2.32.0.windows.2
2.33.0

View File

@ -1,119 +0,0 @@
From 517744ea36a28d8e1166f8e12b0d88ea9cd9aadc Mon Sep 17 00:00:00 2001
From: Corinna Vinschen <corinna@vinschen.de>
Date: Mon, 19 Apr 2021 14:49:14 +0200
Subject: [PATCH 32/N] Cygwin: path_conv: Try to handle native symlinks more
sanely
For local paths, add a check if the inner path components contain native
symlinks or junctions. Compare the incoming path with the path returned
by NtQueryInformationFile(FileNameInformation). If they differ, there
must be at least one native symlink or junction in the path. If so,
treat the currently evaluated file as non-existant. This forces
path_conv::check to backtrack inner path components until we eliminated
all native symlinks or junctions and have a normalized path.
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
(cherry picked from commits 456c3a46386f38887407603b2c64b7f63a4871c5 and
13fd26ecf5ca8417146d57b45aed0133435c3497)
---
winsup/cygwin/dcrt0.cc | 6 +++++
winsup/cygwin/globals.cc | 2 ++
winsup/cygwin/path.cc | 52 ++++++++++++++++++++++++++++++++++++++++
3 files changed, 60 insertions(+)
diff --git a/winsup/cygwin/dcrt0.cc b/winsup/cygwin/dcrt0.cc
index 4683972..579158a 100644
--- a/winsup/cygwin/dcrt0.cc
+++ b/winsup/cygwin/dcrt0.cc
@@ -742,6 +742,12 @@ init_windows_system_directory ()
system_wow64_directory[system_wow64_directory_length++] = L'\\';
system_wow64_directory[system_wow64_directory_length] = L'\0';
}
+ /* We need the Windows dir in path.cc. */
+ wcscpy (windows_directory, windows_system_directory);
+ windows_directory_length = windows_system_directory_length - 1;
+ windows_directory[windows_directory_length] = L'\0';
+ while (windows_directory[windows_directory_length - 1] != L'\\')
+ windows_directory[--windows_directory_length] = L'\0';
#endif /* __i386__ */
}
}
diff --git a/winsup/cygwin/globals.cc b/winsup/cygwin/globals.cc
index 67103f4..a729e70 100644
--- a/winsup/cygwin/globals.cc
+++ b/winsup/cygwin/globals.cc
@@ -26,6 +26,8 @@ UINT windows_system_directory_length;
#ifdef __i386__
WCHAR system_wow64_directory[MAX_PATH];
UINT system_wow64_directory_length;
+WCHAR windows_directory[MAX_PATH];
+UINT windows_directory_length;
#endif /* __i386__ */
WCHAR global_progname[NT_MAX_PATH];
diff --git a/winsup/cygwin/path.cc b/winsup/cygwin/path.cc
index 561d1ac..4121628 100644
--- a/winsup/cygwin/path.cc
+++ b/winsup/cygwin/path.cc
@@ -3341,6 +3341,58 @@ restart:
status = conv_hdl.get_finfo (h, fs.is_nfs ());
if (NT_SUCCESS (status))
fileattr = conv_hdl.get_dosattr (fs.is_nfs ());
+
+ /* For local paths, check if the inner path components contain
+ native symlinks or junctions. Compare incoming path with
+ path returned by NtQueryInformationFile(FileNameInformation).
+ If they differ, bail out as if the file doesn't exist. This
+ forces path_conv::check to backtrack inner path components. */
+ if (!fs.is_remote_drive ())
+ {
+#ifdef __i386__
+ /* On WOW64, ignore any potential problems if the path is inside
+ the Windows dir to avoid false positives for stuff under
+ File System Redirector control. */
+ if (wincap.is_wow64 ())
+ {
+ static UNICODE_STRING wpath;
+ UNICODE_STRING udpath;
+
+ /* Create UNICODE_STRING for Windows dir. */
+ RtlInitCountedUnicodeString (&wpath, windows_directory,
+ windows_directory_length * sizeof (WCHAR));
+ /* Create a UNICODE_STRING from incoming path, splitting
+ off the leading "\\??\\" */
+ RtlInitCountedUnicodeString (&udpath, upath.Buffer + 4,
+ upath.Length - 4 * sizeof (WCHAR));
+ /* Are we below Windows dir? Skip the check for inner
+ symlinks. */
+ if (RtlEqualUnicodePathPrefix (&udpath, &wpath, TRUE))
+ goto skip_inner_syml_check;
+ }
+#endif /* __i386__ */
+ PFILE_NAME_INFORMATION pfni;
+
+ pfni = (PFILE_NAME_INFORMATION) tp.c_get ();
+ if (NT_SUCCESS (NtQueryInformationFile (h, &io, pfni, NT_MAX_PATH,
+ FileNameInformation)))
+ {
+ UNICODE_STRING npath;
+
+ RtlInitCountedUnicodeString (&npath, pfni->FileName,
+ pfni->FileNameLength);
+ if (!RtlEqualUnicodePathSuffix (&upath, &npath, !!ci_flag))
+ {
+ fileattr = INVALID_FILE_ATTRIBUTES;
+ set_error (ENOENT);
+ break;
+ }
+ }
+#ifdef __i386__
+ skip_inner_syml_check:
+ ;
+#endif /* __i386__ */
+ }
}
if (!NT_SUCCESS (status))
{
--
2.31.1

View File

@ -0,0 +1,49 @@
From de9d09849b66c76e4323df2718bc75dc09ddb180 Mon Sep 17 00:00:00 2001
From: Johannes Schindelin <johannes.schindelin@gmx.de>
Date: Mon, 8 Nov 2021 14:20:07 +0100
Subject: [PATCH 32/N] docs: skip building texinfo and PDF files
The MSYS2 packages lack the infrastructure to build those.
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
---
winsup/doc/Makefile.am | 9 +++------
1 file changed, 3 insertions(+), 6 deletions(-)
diff --git a/winsup/doc/Makefile.am b/winsup/doc/Makefile.am
index 534d674..d448ede 100644
--- a/winsup/doc/Makefile.am
+++ b/winsup/doc/Makefile.am
@@ -10,9 +10,7 @@ man1_MANS =
man3_MANS =
man5_MANS =
-doc_DATA = \
- cygwin-ug-net/cygwin-ug-net.pdf \
- cygwin-api/cygwin-api.pdf
+doc_DATA =
htmldir = $(datarootdir)/doc
@@ -28,8 +26,7 @@ all-local: Makefile.dep \
cygwin-ug-net/cygwin-ug-net.html \
faq/faq.html faq/faq.body \
cygwin-ug-net/cygwin-ug-net-nochunks.html.gz \
- api2man.stamp intro2man.stamp utils2man.stamp \
- cygwin-api.info cygwin-ug-net.info
+ api2man.stamp intro2man.stamp utils2man.stamp
clean-local:
rm -f Makefile.dep
@@ -69,7 +66,7 @@ install-etc:
@$(MKDIR_P) $(DESTDIR)$(sysconfdir)/preremove
$(INSTALL_SCRIPT) $(srcdir)/etc.preremove.cygwin-doc.sh $(DESTDIR)$(sysconfdir)/preremove/cygwin-doc.sh
-install-data-hook: install-extra-man install-html-local install-info-local install-etc
+install-data-hook: install-extra-man install-html-local install-etc
uninstall-extra-man:
for i in *.1 ; do \
--
2.33.0

View File

@ -1,66 +0,0 @@
From 38cbabfa51fef46f53fc3b2f79091062fe15c196 Mon Sep 17 00:00:00 2001
From: Takashi Yano <takashi.yano@nifty.ne.jp>
Date: Mon, 19 Apr 2021 19:30:45 +0900
Subject: [PATCH 33/N] Cygwin: console: Fix race issue regarding
cons_master_thread().
- With this patch, the race issue regarding starting/stopping
cons_master_thread() introduced by commit ff4440fc is fixed.
Addresses:
https://cygwin.com/pipermail/cygwin/2021-April/248292.html
---
winsup/cygwin/fhandler_console.cc | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/winsup/cygwin/fhandler_console.cc b/winsup/cygwin/fhandler_console.cc
index 0b33a13..e418aac 100644
--- a/winsup/cygwin/fhandler_console.cc
+++ b/winsup/cygwin/fhandler_console.cc
@@ -48,6 +48,7 @@ details. */
#define con_is_legacy (shared_console_info && con.is_legacy)
#define CONS_THREAD_SYNC "cygcons.thread_sync"
+static bool NO_COPY master_thread_started = false;
const unsigned fhandler_console::MAX_WRITE_CHARS = 16384;
@@ -184,6 +185,7 @@ cons_master_thread (VOID *arg)
GetCurrentProcess (), &thread_sync_event,
0, FALSE, DUPLICATE_SAME_ACCESS);
SetEvent (thread_sync_event);
+ master_thread_started = true;
/* Do not touch class members after here because the class instance
may have been destroyed. */
fhandler_console::cons_master_thread (&handle_set, ttyp);
@@ -370,6 +372,8 @@ fhandler_console::set_unit ()
}
if (!created && shared_console_info)
{
+ while (con.owner > MAX_PID)
+ Sleep (1);
pinfo p (con.owner);
if (!p)
con.owner = myself->pid;
@@ -1393,14 +1397,16 @@ fhandler_console::close ()
release_output_mutex ();
- if (shared_console_info && con.owner == myself->pid)
+ if (shared_console_info && con.owner == myself->pid
+ && master_thread_started)
{
char name[MAX_PATH];
shared_name (name, CONS_THREAD_SYNC, get_minor ());
thread_sync_event = OpenEvent (MAXIMUM_ALLOWED, FALSE, name);
- con.owner = 0;
+ con.owner = MAX_PID + 1;
WaitForSingleObject (thread_sync_event, INFINITE);
CloseHandle (thread_sync_event);
+ con.owner = 0;
}
CloseHandle (input_mutex);
--
2.31.1

View File

@ -0,0 +1,31 @@
From e6d83d943a6c7336dc746dd8c6e65acbf00801d8 Mon Sep 17 00:00:00 2001
From: Johannes Schindelin <johannes.schindelin@gmx.de>
Date: Mon, 8 Nov 2021 16:22:57 +0100
Subject: [PATCH 33/N] install-libs: depend on the "toollibs"
Before symlinking libg.a, we need the symlink source `libmsys-2.0.a`: in
MSYS2, we copy by default (if we were creating Unix-style symlinks, the
target would not have to exist before symlinking, but when copying we do
need the source _right away_).
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
---
winsup/cygwin/Makefile.am | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/winsup/cygwin/Makefile.am b/winsup/cygwin/Makefile.am
index f10b1b5..27ee986 100644
--- a/winsup/cygwin/Makefile.am
+++ b/winsup/cygwin/Makefile.am
@@ -726,7 +726,7 @@ man_MANS = regex/regex.3 regex/regex.7
install-exec-hook: install-libs
install-data-local: install-headers install-ldif
-install-libs:
+install-libs: install-toollibDATA
@$(MKDIR_P) $(DESTDIR)$(bindir)
$(INSTALL_PROGRAM) $(TEST_DLL_NAME) $(DESTDIR)$(bindir)/$(DLL_NAME)
@$(MKDIR_P) $(DESTDIR)$(toollibdir)
--
2.33.0

View File

@ -1,109 +0,0 @@
From 0aaba50a63d1efdeb3bba4a48e7ac2e33c2578d0 Mon Sep 17 00:00:00 2001
From: Christoph Reiter <reiter.christoph@gmail.com>
Date: Wed, 5 May 2021 09:18:45 +0200
Subject: [PATCH 34/N] Revert "Cygwin: path_conv: Try to handle native
symlinks more sanely"
This reverts commit 517744ea36a28d8e1166f8e12b0d88ea9cd9aadc.
---
winsup/cygwin/dcrt0.cc | 6 -----
winsup/cygwin/globals.cc | 2 --
winsup/cygwin/path.cc | 52 ----------------------------------------
3 files changed, 60 deletions(-)
diff --git a/winsup/cygwin/dcrt0.cc b/winsup/cygwin/dcrt0.cc
index 579158a..4683972 100644
--- a/winsup/cygwin/dcrt0.cc
+++ b/winsup/cygwin/dcrt0.cc
@@ -742,12 +742,6 @@ init_windows_system_directory ()
system_wow64_directory[system_wow64_directory_length++] = L'\\';
system_wow64_directory[system_wow64_directory_length] = L'\0';
}
- /* We need the Windows dir in path.cc. */
- wcscpy (windows_directory, windows_system_directory);
- windows_directory_length = windows_system_directory_length - 1;
- windows_directory[windows_directory_length] = L'\0';
- while (windows_directory[windows_directory_length - 1] != L'\\')
- windows_directory[--windows_directory_length] = L'\0';
#endif /* __i386__ */
}
}
diff --git a/winsup/cygwin/globals.cc b/winsup/cygwin/globals.cc
index a729e70..67103f4 100644
--- a/winsup/cygwin/globals.cc
+++ b/winsup/cygwin/globals.cc
@@ -26,8 +26,6 @@ UINT windows_system_directory_length;
#ifdef __i386__
WCHAR system_wow64_directory[MAX_PATH];
UINT system_wow64_directory_length;
-WCHAR windows_directory[MAX_PATH];
-UINT windows_directory_length;
#endif /* __i386__ */
WCHAR global_progname[NT_MAX_PATH];
diff --git a/winsup/cygwin/path.cc b/winsup/cygwin/path.cc
index 4121628..561d1ac 100644
--- a/winsup/cygwin/path.cc
+++ b/winsup/cygwin/path.cc
@@ -3341,58 +3341,6 @@ restart:
status = conv_hdl.get_finfo (h, fs.is_nfs ());
if (NT_SUCCESS (status))
fileattr = conv_hdl.get_dosattr (fs.is_nfs ());
-
- /* For local paths, check if the inner path components contain
- native symlinks or junctions. Compare incoming path with
- path returned by NtQueryInformationFile(FileNameInformation).
- If they differ, bail out as if the file doesn't exist. This
- forces path_conv::check to backtrack inner path components. */
- if (!fs.is_remote_drive ())
- {
-#ifdef __i386__
- /* On WOW64, ignore any potential problems if the path is inside
- the Windows dir to avoid false positives for stuff under
- File System Redirector control. */
- if (wincap.is_wow64 ())
- {
- static UNICODE_STRING wpath;
- UNICODE_STRING udpath;
-
- /* Create UNICODE_STRING for Windows dir. */
- RtlInitCountedUnicodeString (&wpath, windows_directory,
- windows_directory_length * sizeof (WCHAR));
- /* Create a UNICODE_STRING from incoming path, splitting
- off the leading "\\??\\" */
- RtlInitCountedUnicodeString (&udpath, upath.Buffer + 4,
- upath.Length - 4 * sizeof (WCHAR));
- /* Are we below Windows dir? Skip the check for inner
- symlinks. */
- if (RtlEqualUnicodePathPrefix (&udpath, &wpath, TRUE))
- goto skip_inner_syml_check;
- }
-#endif /* __i386__ */
- PFILE_NAME_INFORMATION pfni;
-
- pfni = (PFILE_NAME_INFORMATION) tp.c_get ();
- if (NT_SUCCESS (NtQueryInformationFile (h, &io, pfni, NT_MAX_PATH,
- FileNameInformation)))
- {
- UNICODE_STRING npath;
-
- RtlInitCountedUnicodeString (&npath, pfni->FileName,
- pfni->FileNameLength);
- if (!RtlEqualUnicodePathSuffix (&upath, &npath, !!ci_flag))
- {
- fileattr = INVALID_FILE_ATTRIBUTES;
- set_error (ENOENT);
- break;
- }
- }
-#ifdef __i386__
- skip_inner_syml_check:
- ;
-#endif /* __i386__ */
- }
}
if (!NT_SUCCESS (status))
{
--
2.31.1

View File

@ -1,183 +0,0 @@
From 56841ec45372877dc2692f5e9cbe0380197cda02 Mon Sep 17 00:00:00 2001
From: Corinna Vinschen <corinna@vinschen.de>
Date: Mon, 19 Apr 2021 14:49:14 +0200
Subject: [PATCH 35/N] Reapply Cygwin: path_conv: Try to handle native
symlinks more sanely
For local paths, add a check if the inner path components contain native
symlinks or junctions. Compare the incoming path with the path returned
by NtQueryInformationFile(FileNameInformation). If they differ, there
must be at least one native symlink or junction in the path. If so,
treat the currently evaluated file as non-existant. This forces
path_conv::check to backtrack inner path components until we eliminated
all native symlinks or junctions and have a normalized path.
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
(cherry picked from commits 456c3a46386f38887407603b2c64b7f63a4871c5,
13fd26ecf5ca8417146d57b45aed0133435c3497 and
19d59ce75d5301ae167b421111d77615eb307aa7)
---
winsup/cygwin/dcrt0.cc | 6 +++
winsup/cygwin/globals.cc | 2 +
winsup/cygwin/path.cc | 107 +++++++++++++++++++++++++++++++++++----
3 files changed, 105 insertions(+), 10 deletions(-)
diff --git a/winsup/cygwin/dcrt0.cc b/winsup/cygwin/dcrt0.cc
index 4683972..579158a 100644
--- a/winsup/cygwin/dcrt0.cc
+++ b/winsup/cygwin/dcrt0.cc
@@ -742,6 +742,12 @@ init_windows_system_directory ()
system_wow64_directory[system_wow64_directory_length++] = L'\\';
system_wow64_directory[system_wow64_directory_length] = L'\0';
}
+ /* We need the Windows dir in path.cc. */
+ wcscpy (windows_directory, windows_system_directory);
+ windows_directory_length = windows_system_directory_length - 1;
+ windows_directory[windows_directory_length] = L'\0';
+ while (windows_directory[windows_directory_length - 1] != L'\\')
+ windows_directory[--windows_directory_length] = L'\0';
#endif /* __i386__ */
}
}
diff --git a/winsup/cygwin/globals.cc b/winsup/cygwin/globals.cc
index 67103f4..a729e70 100644
--- a/winsup/cygwin/globals.cc
+++ b/winsup/cygwin/globals.cc
@@ -26,6 +26,8 @@ UINT windows_system_directory_length;
#ifdef __i386__
WCHAR system_wow64_directory[MAX_PATH];
UINT system_wow64_directory_length;
+WCHAR windows_directory[MAX_PATH];
+UINT windows_directory_length;
#endif /* __i386__ */
WCHAR global_progname[NT_MAX_PATH];
diff --git a/winsup/cygwin/path.cc b/winsup/cygwin/path.cc
index 561d1ac..4ebaf4d 100644
--- a/winsup/cygwin/path.cc
+++ b/winsup/cygwin/path.cc
@@ -1017,17 +1017,25 @@ path_conv::check (const char *src, unsigned opt,
}
goto out; // file found
}
- /* Found a symlink if symlen > 0. If component == 0, then the
- src path itself was a symlink. If !follow_mode then
- we're done. Otherwise we have to insert the path found
- into the full path that we are building and perform all of
- these operations again on the newly derived path. */
- else if (symlen > 0)
+ /* Found a symlink if symlen > 0 or short-circuited a native
+ symlink or junction point if symlen < 0.
+ If symlen > 0 and component == 0, then the src path itself
+ was a symlink. If !follow_mode then we're done. Otherwise
+ we have to insert the path found into the full path that we
+ are building and perform all of these operations again on the
+ newly derived path. */
+ else if (symlen)
{
- if (component == 0
- && (!(opt & PC_SYM_FOLLOW)
- || (is_winapi_reparse_point ()
- && (opt & PC_SYM_NOFOLLOW_REP))))
+ /* if symlen is negativ, the actual native symlink or
+ junction point is an inner path component. Just fix up
+ symlen to be positive and don't try any PC_SYM_FOLLOW
+ handling. */
+ if (symlen < 0)
+ symlen = -symlen;
+ else if (component == 0
+ && (!(opt & PC_SYM_FOLLOW)
+ || (is_winapi_reparse_point ()
+ && (opt & PC_SYM_NOFOLLOW_REP))))
{
/* Usually a trailing slash requires to follow a symlink,
even with PC_SYM_NOFOLLOW. The reason is that "foo/"
@@ -3596,6 +3604,85 @@ restart:
break;
}
+ /* Check if the inner path components contain native symlinks or
+ junctions, or if the drive is a virtual drive. Compare incoming
+ path with path returned by GetFinalPathNameByHandleA. If they
+ differ, return the final path as symlink content and set symlen
+ to a negative value. This forces path_conv::check to restart
+ symlink evaluation with the new path. */
+#ifdef __i386__
+ /* On WOW64, ignore any potential problems if the path is inside
+ the Windows dir to avoid false positives for stuff under File
+ System Redirector control. Believe it or not, but even
+ GetFinalPathNameByHandleA returns the converted path for the
+ Sysnative dir. I. e.
+
+ C:\Windows\Sysnative --> C:\Windows\System32
+
+ This is obviously wrong when using this path for further
+ file manipulation because the non-final path points to another
+ file than the final path. Oh well... */
+ if (!fs.is_remote_drive () && wincap.is_wow64 ())
+ {
+ static UNICODE_STRING wpath;
+ UNICODE_STRING udpath;
+
+ /* Create UNICODE_STRING for Windows dir. */
+ RtlInitCountedUnicodeString (&wpath, windows_directory,
+ windows_directory_length * sizeof (WCHAR));
+ /* Create a UNICODE_STRING from incoming path, splitting
+ off the leading "\\??\\" */
+ RtlInitCountedUnicodeString (&udpath, upath.Buffer + 4,
+ upath.Length - 4 * sizeof (WCHAR));
+ /* Are we below Windows dir? Skip the check for inner
+ symlinks. */
+ if (RtlEqualUnicodePathPrefix (&udpath, &wpath, TRUE))
+ goto file_not_symlink;
+ }
+#endif /* __i386__ */
+ {
+ PWCHAR fpbuf = tp.w_get ();
+ DWORD ret;
+
+ ret = GetFinalPathNameByHandleW (h, fpbuf, NT_MAX_PATH, 0);
+ if (ret)
+ {
+ UNICODE_STRING fpath;
+
+ RtlInitCountedUnicodeString (&fpath, fpbuf, ret * sizeof (WCHAR));
+ fpbuf[1] = L'?'; /* \\?\ --> \??\ */
+ if (!RtlEqualUnicodeString (&upath, &fpath, !!ci_flag))
+ {
+ issymlink = true;
+ /* upath.Buffer is big enough and unused from this point on.
+ Reuse it here, avoiding yet another buffer allocation. */
+ char *nfpath = (char *) upath.Buffer;
+ sys_wcstombs (nfpath, NT_MAX_PATH, fpbuf);
+ res = posixify (nfpath);
+
+ /* If the incoming path consisted of a drive prefix only,
+ we just handle a virtual drive, created with, e.g.
+
+ subst X: C:\foo\bar
+
+ Treat it like a symlink. This is required to tell an
+ lstat caller that the "drive" is actually pointing
+ somewhere else, thus, it's a symlink in POSIX speak. */
+ if (upath.Length == 14) /* \??\X:\ */
+ {
+ fileattr &= ~FILE_ATTRIBUTE_DIRECTORY;
+ path_flags |= PATH_SYMLINK;
+ }
+ /* For final paths differing in inner path components return
+ length as negative value. This informs path_conv::check
+ to skip realpath handling on the last path component. */
+ else
+ res = -res;
+ break;
+ }
+ }
+ }
+
/* Normal file. */
file_not_symlink:
issymlink = false;
--
2.31.1

View File

@ -1,37 +0,0 @@
From 1d63878e2fd83bfa6caeb3661e9efa57feeeb12e Mon Sep 17 00:00:00 2001
From: Jeremy Drake <cygwin@jdrake.com>
Date: Wed, 19 May 2021 14:40:23 +0200
Subject: [PATCH 36/N] Cygwin: Handle virtual drives as non-symlinks
This avoids MAX_PATH-related problems in native tools in case the
virtual drive points to a deep directory
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
---
winsup/cygwin/path.cc | 9 ++-------
1 file changed, 2 insertions(+), 7 deletions(-)
diff --git a/winsup/cygwin/path.cc b/winsup/cygwin/path.cc
index 4ebaf4d..1b50ed5 100644
--- a/winsup/cygwin/path.cc
+++ b/winsup/cygwin/path.cc
@@ -3665,14 +3665,9 @@ restart:
subst X: C:\foo\bar
- Treat it like a symlink. This is required to tell an
- lstat caller that the "drive" is actually pointing
- somewhere else, thus, it's a symlink in POSIX speak. */
+ Treat it as a normal file. */
if (upath.Length == 14) /* \??\X:\ */
- {
- fileattr &= ~FILE_ATTRIBUTE_DIRECTORY;
- path_flags |= PATH_SYMLINK;
- }
+ goto file_not_symlink;
/* For final paths differing in inner path components return
length as negative value. This informs path_conv::check
to skip realpath handling on the last path component. */
--
2.31.1

View File

@ -1,72 +0,0 @@
From 25d1543b0c579a74938a1b428902ce5a951371db Mon Sep 17 00:00:00 2001
From: Jeremy Drake <cygwin@jdrake.com>
Date: Wed, 19 May 2021 11:43:48 +0200
Subject: [PATCH 37/N] Cygwin: suppress FAST_CWD warnings on ARM64
The old check was insufficient: new insider preview builds of Windows
allow running x86_64 process on ARM64. The IsWow64Process2 function
seems to be the intended way to figure this situation out.
---
winsup/cygwin/autoload.cc | 1 +
winsup/cygwin/path.cc | 33 +++++++++------------------------
2 files changed, 10 insertions(+), 24 deletions(-)
diff --git a/winsup/cygwin/autoload.cc b/winsup/cygwin/autoload.cc
index 61c2808..0813e74 100644
--- a/winsup/cygwin/autoload.cc
+++ b/winsup/cygwin/autoload.cc
@@ -587,6 +587,7 @@ LoadDLLfuncEx (GetLogicalProcessorInformationEx, 12, kernel32, 1)
LoadDLLfuncEx (GetProcessGroupAffinity, 12, kernel32, 1)
LoadDLLfunc (GetSystemTimePreciseAsFileTime, 4, kernel32)
LoadDLLfuncEx (GetThreadGroupAffinity, 8, kernel32, 1)
+LoadDLLfuncEx (IsWow64Process2, 12, kernel32, 1)
LoadDLLfuncEx (PrefetchVirtualMemory, 16, kernel32, 1)
LoadDLLfunc (SetThreadGroupAffinity, 12, kernel32)
diff --git a/winsup/cygwin/path.cc b/winsup/cygwin/path.cc
index 1b50ed5..85605cf 100644
--- a/winsup/cygwin/path.cc
+++ b/winsup/cygwin/path.cc
@@ -4939,30 +4939,15 @@ find_fast_cwd ()
if (!f_cwd_ptr)
{
bool warn = 1;
-
-#ifndef __x86_64__
- #ifndef PROCESSOR_ARCHITECTURE_ARM64
- #define PROCESSOR_ARCHITECTURE_ARM64 12
- #endif
-
- SYSTEM_INFO si;
-
- /* Check if we're running in WOW64 on ARM64. Skip the warning as long as
- there's no solution for finding the FAST_CWD pointer on that system.
-
- 2018-07-12: Apparently current ARM64 WOW64 has a bug:
- It's GetNativeSystemInfo returns PROCESSOR_ARCHITECTURE_INTEL in
- wProcessorArchitecture. Since that's an invalid value (a 32 bit
- host system hosting a 32 bit emulator for itself?) we can use this
- value as an indicator to skip the message as well. */
- if (wincap.is_wow64 ())
- {
- GetNativeSystemInfo (&si);
- if (si.wProcessorArchitecture == PROCESSOR_ARCHITECTURE_ARM64
- || si.wProcessorArchitecture == PROCESSOR_ARCHITECTURE_INTEL)
- warn = 0;
- }
-#endif /* !__x86_64__ */
+ USHORT emulated, hosted;
+
+ /* Check if we're running in WOW64 on ARM64. Check on 64 bit as well,
+ given that ARM64 Windows 10 provides a x86_64 emulation soon. Skip
+ warning as long as there's no solution for finding the FAST_CWD
+ pointer on that system. */
+ if (IsWow64Process2 (GetCurrentProcess (), &emulated, &hosted)
+ && hosted == IMAGE_FILE_MACHINE_ARM64)
+ warn = 0;
if (warn)
small_printf ("Cygwin WARNING:\n"
--
2.31.1

View File

@ -1,31 +0,0 @@
From d77a022baf5b1f6e8ce7f04ce294a60df1d13519 Mon Sep 17 00:00:00 2001
From: Corinna Vinschen <corinna@vinschen.de>
Date: Thu, 20 May 2021 10:03:34 +0200
Subject: [PATCH 38/N] Cygwin: Add missing IsWow64Process2 declaration
The previous patch is accidentally missing the declaration of
IsWow64Process2. Add it belatedly.
Fixes: 1865a41cb383 ("Cygwin: suppress FAST_CWD warnings on ARM64")
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
---
winsup/cygwin/winlean.h | 3 +++
1 file changed, 3 insertions(+)
diff --git a/winsup/cygwin/winlean.h b/winsup/cygwin/winlean.h
index 2e2308e..3382686 100644
--- a/winsup/cygwin/winlean.h
+++ b/winsup/cygwin/winlean.h
@@ -110,6 +110,9 @@ extern "C" {
executed on systems that support it (a run-time condition). */
PVOID WINAPI VirtualAlloc2 (HANDLE, PVOID, SIZE_T, ULONG, ULONG,
PMEM_EXTENDED_PARAMETER, ULONG);
+/* IsWow64Process2 should be declared in <w32api/wow64apiset.h> but
+ isn't yet. */
+BOOL WINAPI IsWow64Process2(HANDLE, USHORT *, USHORT *);
#ifdef __cplusplus
}
--
2.31.1

View File

@ -1,86 +0,0 @@
From 54c3ecbf787d9d9d5646842802c3f1ea7855834f Mon Sep 17 00:00:00 2001
From: Jeremy Drake <github@jdrake.com>
Date: Mon, 21 Jun 2021 12:27:02 -0700
Subject: [PATCH 42/N] Fix 64 vs 32-bit type confusion in swprintf.
kill_via_console_helper: use %u instead of %ld for DWORD.
It appears that cygwin's swprintf is acting like LP64 instead of Windows
LLP64, and expecting a 64-bit long. DWORDs are 32-bit unsigned.
Add check to avoid closing the handle from the input paramter. It may
well be that the caller still intends to use it.
Minor fixes for Ctrl-C handling code.
From my post-merge review at https://github.com/msys2/msys2-runtime/pull/31#pullrequestreview-688771861
---
winsup/cygwin/include/cygwin/exit_process.h | 19 ++++++++++++-------
1 file changed, 12 insertions(+), 7 deletions(-)
diff --git a/winsup/cygwin/include/cygwin/exit_process.h b/winsup/cygwin/include/cygwin/exit_process.h
index 19b8e60..5f926c9 100644
--- a/winsup/cygwin/include/cygwin/exit_process.h
+++ b/winsup/cygwin/include/cygwin/exit_process.h
@@ -75,13 +75,14 @@ kill_via_console_helper (HANDLE process, wchar_t *function_name, int exit_code,
STARTUPINFOW si = {};
PROCESS_INFORMATION pi;
- size_t len = wcslen (wbuf) + wcslen (function_name) + 3 /* exit code */
- + 1 /* space */ + 10 /* process ID, i.e. DWORD */ + 1 /* NUL */;
+ size_t len = wcslen (wbuf) + 1 /* space */ + wcslen (function_name)
+ + 1 /* space */ + 3 /* exit code */ + 1 /* space */
+ + 10 /* process ID, i.e. DWORD */ + 1 /* NUL */;
WCHAR cmd[len + 1];
WCHAR title[] = L"cygwin-console-helper";
DWORD process_exit;
- swprintf (cmd, len + 1, L"%S %S %d %ld", wbuf, function_name, exit_code,
+ swprintf (cmd, len + 1, L"%S %S %d %u", wbuf, function_name, exit_code,
pid);
si.cb = sizeof (si);
@@ -194,10 +195,10 @@ exit_process_tree (HANDLE main_process, int exit_code)
PROCESSENTRY32 entry;
DWORD pids[16384];
int max_len = sizeof (pids) / sizeof (*pids), i, len, ret = 0;
- pid_t pid = GetProcessId (main_process);
+ DWORD pid = GetProcessId (main_process);
int signo = exit_code & 0x7f;
- pids[0] = (DWORD)pid;
+ pids[0] = pid;
len = 1;
/*
@@ -249,6 +250,8 @@ exit_process_tree (HANDLE main_process, int exit_code)
break;
}
+ CloseHandle (snapshot);
+
for (i = len - 1; i >= 0; i--)
{
HANDLE process;
@@ -262,7 +265,9 @@ exit_process_tree (HANDLE main_process, int exit_code)
| PROCESS_VM_OPERATION | PROCESS_VM_WRITE | PROCESS_VM_READ,
FALSE, pids[i]);
if (!process)
- process = OpenProcess (PROCESS_TERMINATE, FALSE, pids[i]);
+ process = OpenProcess (
+ PROCESS_QUERY_LIMITED_INFORMATION | PROCESS_TERMINATE,
+ FALSE, pids[i]);
}
DWORD code;
@@ -272,7 +277,7 @@ exit_process_tree (HANDLE main_process, int exit_code)
if (!exit_process (process, exit_code))
ret = -1;
}
- if (process)
+ if (process && process != main_process)
CloseHandle (process);
}
--
2.32.0.windows.1

View File

@ -1,93 +0,0 @@
From 281acd22a0fdfe48a87230ad212b4f372dee0d49 Mon Sep 17 00:00:00 2001
From: Naveen M K <naveen521kk@gmail.com>
Date: Tue, 22 Jun 2021 13:57:45 +0530
Subject: [PATCH 43/N] Don't fall back to ExitProcess if process handled
Ctrl-C event
I have experimented with the mysterious kernel32!CtrlRoutine that
it returns 0 if the CtrlHandlers set using SetConsoleCtrlHandler
handled it correctly. So, now rather than defaulting to move to
ExitProcess if the process isn't killed by CtrlRoutine, it will
check only if the the ctrl event is handled correctly and falls
back to ExitProcess only when CtrlRoutine fails.
This should possibly allow python interactive mode.
Signed-off-by: Naveen M K <naveen521kk@gmail.com>
---
winsup/cygwin/include/cygwin/exit_process.h | 6 +++--
winsup/utils/getprocaddr.c | 29 ++++++++++++++++-----
2 files changed, 26 insertions(+), 9 deletions(-)
diff --git a/winsup/cygwin/include/cygwin/exit_process.h b/winsup/cygwin/include/cygwin/exit_process.h
index 5f926c9..5e04c0f 100644
--- a/winsup/cygwin/include/cygwin/exit_process.h
+++ b/winsup/cygwin/include/cygwin/exit_process.h
@@ -163,10 +163,12 @@ exit_process (HANDLE process, int exit_code)
{
case SIGINT:
case SIGQUIT:
+ /* We are not going to kill them but simply say that Ctrl+C
+ is pressed. If the processes want they can exit or else
+ just wait.*/
if (kill_via_console_helper (
process, L"CtrlRoutine",
- signo == SIGINT ? CTRL_C_EVENT : CTRL_BREAK_EVENT, pid) &&
- GetExitCodeProcess(process, &code) && code != STILL_ACTIVE)
+ signo == SIGINT ? CTRL_C_EVENT : CTRL_BREAK_EVENT, pid))
return 0;
/* fall-through */
case SIGTERM:
diff --git a/winsup/utils/getprocaddr.c b/winsup/utils/getprocaddr.c
index 80b399c..d5ecd35 100644
--- a/winsup/utils/getprocaddr.c
+++ b/winsup/utils/getprocaddr.c
@@ -40,12 +40,23 @@ inject_remote_thread_into_process (HANDLE process,
{
/*
* Wait up to 10 seconds (arbitrary constant) for the thread to finish;
- * After that grace period, fall back to exit with an exit code
- * indicating failure.
+ * Maybe we should wait forever? I have seen Cmd does so, but well...
*/
- if (WaitForSingleObject (thread, 10000) == WAIT_OBJECT_0 &&
- GetExitCodeThread(thread, &code) && code != STILL_ACTIVE)
+ if (WaitForSingleObject (thread, 10000) == WAIT_OBJECT_0)
res = 0;
+ /*
+ According to the docs at MSDN for GetExitCodeThread, it will
+ get the return value from the function, here CtrlRoutine. So, this
+ checks if the Ctrl Event is handled correctly by the process.
+
+ By some testing I could see CtrlRoutine returns 0 in case where
+ CtrlEvent set by SetConsoleCtrlHandler is handled correctly, in all
+ other cases it returns something non-zero(not sure what it that).
+ */
+ GetExitCodeThread (thread, &code);
+ if (code != 0)
+ res = code;
+
CloseHandle (thread);
}
@@ -123,10 +134,14 @@ ctrl_handler (DWORD ctrl_type)
return 1;
}
/* Inject the remote thread only when asked to */
- if (inject_remote_thread_into_process (h, address, exit_code) < 0)
+ int t = inject_remote_thread_into_process (h, address, exit_code);
+ if (t != 0)
{
- fprintf (stderr, "Could not inject thread into process %d\n", pid);
- return 1;
+ fprintf (stderr,
+ "Error while injecting remote thread %d for pid(%d)\n", t,
+ pid);
+ exit (1); /*We should exit immediately or else there will a 10s hang
+ waiting for the event to happen.*/
}
}
SymCleanup (process);
--
2.31.1

View File

@ -1,305 +0,0 @@
From a63ea7e338cabc315b58b2356a004c8772ac0f6c Mon Sep 17 00:00:00 2001
From: Jeremy Drake <github@jdrake.com>
Date: Tue, 22 Jun 2021 22:06:26 -0700
Subject: [PATCH 44/N] getprocaddr: refactor/cleanup
Look in kernel32 and kernelbase for CtrlRoutine before breaking out the
big guns and trying to find it in the call stack. Fixes #51.
The change to look at the return code of the thread caused the program
to act as though ExitProcess failed to inject. Deal with this by
passing the thread exit code as an OUT param, and only looking at it
when calling the CtrlRoutine.
While I was there, I noticed a potential race between CreateEvent and
the ctrl_handler function that uses it, so cleaned that up. Also the
event doesn't need to be named, so don't name it to avoid potential
collisions with other processes.
Fixed a couple of printf type warnings. As this is mingw, it should be
safe to use %lu for DWORDs.
---
winsup/utils/getprocaddr.c | 202 +++++++++++++++++++++----------------
1 file changed, 116 insertions(+), 86 deletions(-)
diff --git a/winsup/utils/getprocaddr.c b/winsup/utils/getprocaddr.c
index d5ecd35..25814c7 100644
--- a/winsup/utils/getprocaddr.c
+++ b/winsup/utils/getprocaddr.c
@@ -27,13 +27,14 @@ static HANDLE CtrlEvent;
static int
inject_remote_thread_into_process (HANDLE process,
LPTHREAD_START_ROUTINE address,
- uintptr_t exit_code)
+ uintptr_t exit_code,
+ DWORD *thread_return)
{
int res = -1;
if (!address)
return res;
- DWORD thread_id, code;
+ DWORD thread_id;
HANDLE thread = CreateRemoteThread (process, NULL, 1024 * 1024, address,
(PVOID)exit_code, 0, &thread_id);
if (thread)
@@ -53,9 +54,8 @@ inject_remote_thread_into_process (HANDLE process,
CtrlEvent set by SetConsoleCtrlHandler is handled correctly, in all
other cases it returns something non-zero(not sure what it that).
*/
- GetExitCodeThread (thread, &code);
- if (code != 0)
- res = code;
+ if (thread_return != NULL)
+ GetExitCodeThread (thread, thread_return);
CloseHandle (thread);
}
@@ -80,6 +80,7 @@ ctrl_handler (DWORD ctrl_type)
HANDLE process;
PSYMBOL_INFOW info;
DWORD64 displacement;
+ DWORD thread_return = 0;
count = CaptureStackBackTrace (1l /* skip this function */,
1l /* return only one trace item */, &address,
@@ -134,15 +135,18 @@ ctrl_handler (DWORD ctrl_type)
return 1;
}
/* Inject the remote thread only when asked to */
- int t = inject_remote_thread_into_process (h, address, exit_code);
- if (t != 0)
+ if (inject_remote_thread_into_process (h, address, exit_code,
+ &thread_return) < 0)
{
fprintf (stderr,
- "Error while injecting remote thread %d for pid(%d)\n", t,
- pid);
+ "Error while injecting remote thread for pid(%lu)\n", pid);
exit (1); /*We should exit immediately or else there will a 10s hang
waiting for the event to happen.*/
}
+ if (thread_return)
+ fprintf (stderr,
+ "Injected remote thread for pid(%lu) returned %lu\n", pid,
+ thread_return);
}
SymCleanup (process);
if (!SetEvent (CtrlEvent))
@@ -150,77 +154,16 @@ ctrl_handler (DWORD ctrl_type)
fprintf (stderr, "SetEvent failed (%ld)\n", GetLastError ());
return 1;
}
- exit (0);
+ exit (thread_return != 0);
}
-int
-main (int argc, char **argv)
+/* The easy route for finding the address of CtrlRoutine
+ * would be use GetProcAddress() but this isn't viable
+ * here because that symbol isn't exported.
+ */
+static int
+find_ctrl_routine_the_hard_way ()
{
- char *end;
-
- if (argc == 4)
- {
- exit_code = atoi (argv[2]);
- pid = strtoul (argv[3], NULL, 0);
- }
- else if (argc == 2)
- {
- pid = 0;
- }
- else
- {
- fprintf (stderr, "Need a function name, exit code and pid\n"
- "Or needs a function name.\n");
- return 1;
- }
-
- /* The easy route for finding the address of CtrlRoutine
- * would be use GetProcAddress() but this isn't viable
- * because here because that symbol isn't exported.
- */
-
- if (strcmp (argv[1], "CtrlRoutine"))
- {
- HINSTANCE kernel32 = GetModuleHandle ("kernel32");
- if (!kernel32)
- return 1;
- void *address = (void *)GetProcAddress (kernel32, argv[1]);
-
- if (!address)
- {
- fprintf (stderr, "Could not find address in stack\n");
- return 1;
- }
-
- if (pid == 0)
- {
- printf ("%p\n", address);
- fflush (stdout);
- return 0;
- }
- HANDLE h = OpenProcess (PROCESS_CREATE_THREAD |
- PROCESS_QUERY_INFORMATION | PROCESS_VM_OPERATION |
- PROCESS_VM_WRITE | PROCESS_VM_READ, FALSE, pid);
- if (h == NULL)
- {
- fprintf (stderr, "OpenProcess failed: %ld\n", GetLastError ());
- return 1;
- }
- /* Inject the remote thread */
- if (inject_remote_thread_into_process (h, (LPTHREAD_START_ROUTINE)address,
- exit_code) < 0)
- {
- fprintf (stderr, "Could not inject thread into process %d\n", pid);
- return 1;
- }
- return 0;
- }
- if (argc > 4)
- {
- fprintf (stderr, "Unhandled option: %s\n", argv[4]);
- return 1;
- }
-
/*
* Avoid terminating all processes attached to the current console;
* This would happen if we used the same console as the caller, though,
@@ -249,32 +192,119 @@ main (int argc, char **argv)
}
}
+ CtrlEvent = CreateEvent (NULL, // default security attributes
+ TRUE, // manual-reset event
+ FALSE, // initial state is nonsignaled
+ NULL // object name
+ );
+
+ if (CtrlEvent == NULL)
+ {
+ fprintf (stderr, "CreateEvent failed (%ld)\n", GetLastError ());
+ return 1;
+ }
+
+
if (!SetConsoleCtrlHandler (ctrl_handler, TRUE))
{
fprintf (stderr, "Could not register Ctrl handler\n");
return 1;
}
+
if (!GenerateConsoleCtrlEvent (CTRL_BREAK_EVENT, 0))
{
fprintf (stderr, "Could not simulate Ctrl+Break\n");
return 1;
}
- CtrlEvent = CreateEvent (NULL, // default security attributes
- TRUE, // manual-reset event
- FALSE, // initial state is nonsignaled
- TEXT ("CtrlEvent") // object name
- );
- if (CtrlEvent == NULL)
+ if (WaitForSingleObject (CtrlEvent, 10000 /* 10 seconds*/) != WAIT_OBJECT_0)
{
- fprintf (stderr, "CreateEvent failed (%ld)\n", GetLastError ());
+ fprintf (stderr, "WaitForSingleObject failed (%ld)\n", GetLastError ());
return 1;
}
+ return 0;
+}
- if (WaitForSingleObject (CtrlEvent, 10000 /* 10 seconds*/) != WAIT_OBJECT_0)
+static void *
+get_proc_addr (const char * module_name, const char * function_name)
+{
+ HMODULE module = GetModuleHandle (module_name);
+ if (!module)
+ return NULL;
+ return (void *)GetProcAddress (module, function_name);
+}
+
+int
+main (int argc, char **argv)
+{
+ char *end;
+ void *address;
+ BOOL is_ctrl_routine;
+ DWORD thread_return = 0;
+
+ if (argc == 4)
{
- fprintf (stderr, "WaitForSingleObject failed (%ld)\n", GetLastError ());
+ exit_code = atoi (argv[2]);
+ pid = strtoul (argv[3], NULL, 0);
+ }
+ else if (argc == 2)
+ {
+ pid = 0;
+ }
+ else
+ {
+ fprintf (stderr, "Need a function name, exit code and pid\n"
+ "Or needs a function name.\n");
+ return 1;
+ }
+
+ is_ctrl_routine = strcmp (argv[1], "CtrlRoutine") == 0;
+ address = get_proc_addr ("kernel32", argv[1]);
+ if (is_ctrl_routine && !address)
+ {
+ /* CtrlRoutine is undocumented, and has been seen in both
+ * kernel32 and kernelbase
+ */
+ address = get_proc_addr ("kernelbase", argv[1]);
+ if (!address)
+ return find_ctrl_routine_the_hard_way ();
+ }
+
+ if (!address)
+ {
+ fprintf (stderr, "Could not get proc address\n");
+ return 1;
+ }
+
+ if (pid == 0)
+ {
+ printf ("%p\n", address);
+ fflush (stdout);
+ return 0;
+ }
+ HANDLE h = OpenProcess (PROCESS_CREATE_THREAD |
+ PROCESS_QUERY_INFORMATION | PROCESS_VM_OPERATION |
+ PROCESS_VM_WRITE | PROCESS_VM_READ, FALSE, pid);
+ if (h == NULL)
+ {
+ fprintf (stderr, "OpenProcess failed: %ld\n", GetLastError ());
+ return 1;
+ }
+ /* Inject the remote thread */
+ if (inject_remote_thread_into_process (h, (LPTHREAD_START_ROUTINE)address,
+ exit_code, &thread_return) < 0)
+ {
+ fprintf (stderr, "Could not inject thread into process %lu\n", pid);
return 1;
}
+
+ if (is_ctrl_routine && thread_return)
+ {
+ fprintf (stderr,
+ "Injected remote thread for pid %lu returned %lu\n", pid,
+ thread_return);
+ return 1;
+ }
+
return 0;
}
--
2.32.0.windows.1

View File

@ -1,197 +0,0 @@
From 0fa367cc1d8c135c35a6a68fafeb8eb85efb2e41 Mon Sep 17 00:00:00 2001
From: Jeremy Drake <github@jdrake.com>
Date: Fri, 18 Jun 2021 15:39:24 -0700
Subject: [PATCH 45/N] use IsWow64Process2 to detect arm cases.
kill doesn't appear to have the cygwin autoload stuff, so use
GetProcAddress manually
Unfortunately, IsWow64Process2 doesn't consider x86_64 processes on
ARM64 to be Wow64, and returns exactly the same information as it does
for native ARM64 processes. Use
GetProcessInformation/ProcessMachineTypeInfo to further refine the
answer in that case, when available (see #8991)
add exe names for arm, but they are not built as the tooling for
targeting arm is complicated.
---
winsup/cygwin/include/cygwin/exit_process.h | 131 +++++++++++++++-----
1 file changed, 103 insertions(+), 28 deletions(-)
diff --git a/winsup/cygwin/include/cygwin/exit_process.h b/winsup/cygwin/include/cygwin/exit_process.h
index 5e04c0f..0486a0c 100644
--- a/winsup/cygwin/include/cygwin/exit_process.h
+++ b/winsup/cygwin/include/cygwin/exit_process.h
@@ -46,7 +46,7 @@
#define small_printf(...) fprintf (stderr, __VA_ARGS__)
#endif
-static BOOL get_wow (HANDLE process, BOOL &is_wow, int &bitness);
+static BOOL get_wow (HANDLE process, BOOL &is_wow, USHORT &process_arch);
static int exit_process_tree (HANDLE main_process, int exit_code);
static BOOL
@@ -54,24 +54,36 @@ kill_via_console_helper (HANDLE process, wchar_t *function_name, int exit_code,
DWORD pid)
{
BOOL is_wow;
- int bitness;
- if (!get_wow (process, is_wow, bitness))
+ USHORT process_arch;
+ if (!get_wow (process, is_wow, process_arch))
{
return FALSE;
}
const char *name;
- if (bitness == 32)
- name = "/usr/libexec/getprocaddr32.exe";
- else if (bitness == 64)
- name = "/usr/libexec/getprocaddr64.exe";
- else
- return NULL; /* what?!? */
+ switch (process_arch)
+ {
+ case IMAGE_FILE_MACHINE_I386:
+ name = "/usr/libexec/getprocaddr32.exe";
+ break;
+ case IMAGE_FILE_MACHINE_AMD64:
+ name = "/usr/libexec/getprocaddr64.exe";
+ break;
+ /* TODO: provide exes for these */
+ case IMAGE_FILE_MACHINE_ARMNT:
+ name = "/usr/libexec/getprocaddrarm32.exe";
+ break;
+ case IMAGE_FILE_MACHINE_ARM64:
+ name = "/usr/libexec/getprocaddrarm64.exe";
+ break;
+ default:
+ return FALSE; /* what?!? */
+ }
wchar_t wbuf[PATH_MAX];
if (cygwin_conv_path (CCP_POSIX_TO_WIN_W, name, wbuf, PATH_MAX)
|| GetFileAttributesW (wbuf) == INVALID_FILE_ATTRIBUTES)
- return NULL;
+ return FALSE;
STARTUPINFOW si = {};
PROCESS_INFORMATION pi;
@@ -116,33 +128,96 @@ kill_via_console_helper (HANDLE process, wchar_t *function_name, int exit_code,
static int current_is_wow = -1;
static int is_32_bit_os = -1;
+typedef BOOL (WINAPI * IsWow64Process2_t) (HANDLE, USHORT *, USHORT *);
+static bool wow64process2initialized = false;
+static IsWow64Process2_t pIsWow64Process2 /* = NULL */;
+
+typedef BOOL (WINAPI * GetProcessInformation_t) (HANDLE,
+ PROCESS_INFORMATION_CLASS,
+ LPVOID, DWORD);
+static bool getprocessinfoinitialized = false;
+static GetProcessInformation_t pGetProcessInformation /* = NULL */;
+
static BOOL
-get_wow (HANDLE process, BOOL &is_wow, int &bitness)
+get_wow (HANDLE process, BOOL &is_wow, USHORT &process_arch)
{
- if (is_32_bit_os == -1)
+ USHORT native_arch = IMAGE_FILE_MACHINE_UNKNOWN;
+ if (!wow64process2initialized)
{
- SYSTEM_INFO info;
-
- GetNativeSystemInfo (&info);
- if (info.wProcessorArchitecture == 0)
- is_32_bit_os = 1;
- else if (info.wProcessorArchitecture == 9)
- is_32_bit_os = 0;
- else
- is_32_bit_os = -2;
+ pIsWow64Process2 = (IsWow64Process2_t)
+ GetProcAddress (GetModuleHandle ("KERNEL32"),
+ "IsWow64Process2");
+ MemoryBarrier ();
+ wow64process2initialized = true;
}
+ if (!pIsWow64Process2)
+ {
+ if (is_32_bit_os == -1)
+ {
+ SYSTEM_INFO info;
+
+ GetNativeSystemInfo (&info);
+ if (info.wProcessorArchitecture == 0)
+ is_32_bit_os = 1;
+ else if (info.wProcessorArchitecture == 9)
+ is_32_bit_os = 0;
+ else
+ is_32_bit_os = -2;
+ }
- if (current_is_wow == -1
- && !IsWow64Process (GetCurrentProcess (), &current_is_wow))
- current_is_wow = -2;
+ if (current_is_wow == -1
+ && !IsWow64Process (GetCurrentProcess (), &current_is_wow))
+ current_is_wow = -2;
- if (is_32_bit_os == -2 || current_is_wow == -2)
- return FALSE;
+ if (is_32_bit_os == -2 || current_is_wow == -2)
+ return FALSE;
+
+ if (!IsWow64Process (process, &is_wow))
+ return FALSE;
+
+ process_arch = is_32_bit_os || is_wow ? IMAGE_FILE_MACHINE_I386 :
+ IMAGE_FILE_MACHINE_AMD64;
+ return TRUE;
+ }
- if (!IsWow64Process (process, &is_wow))
+ if (!pIsWow64Process2 (process, &process_arch, &native_arch))
return FALSE;
- bitness = is_32_bit_os || is_wow ? 32 : 64;
+ /* The value will be IMAGE_FILE_MACHINE_UNKNOWN if the target process
+ * is not a WOW64 process
+ */
+ if (process_arch == IMAGE_FILE_MACHINE_UNKNOWN)
+ {
+ struct /* _PROCESS_MACHINE_INFORMATION */
+ {
+ /* 0x0000 */ USHORT ProcessMachine;
+ /* 0x0002 */ USHORT Res0;
+ /* 0x0004 */ DWORD MachineAttributes;
+ } /* size: 0x0008 */ process_machine_info;
+
+ is_wow = FALSE;
+ /* However, x86_64 on ARM64 claims not to be WOW64, so we have to
+ * dig harder... */
+ if (!getprocessinfoinitialized)
+ {
+ pGetProcessInformation = (GetProcessInformation_t)
+ GetProcAddress (GetModuleHandle ("KERNEL32"),
+ "GetProcessInformation");
+ MemoryBarrier ();
+ getprocessinfoinitialized = true;
+ }
+ /*#define ProcessMachineTypeInfo 9*/
+ if (pGetProcessInformation &&
+ pGetProcessInformation (process, (PROCESS_INFORMATION_CLASS)9,
+ &process_machine_info, sizeof (process_machine_info)))
+ process_arch = process_machine_info.ProcessMachine;
+ else
+ process_arch = native_arch;
+ }
+ else
+ {
+ is_wow = TRUE;
+ }
return TRUE;
}
--
2.32.0.windows.1

View File

@ -1,34 +0,0 @@
From 64a769a67a94d8d6f1dc262a33e50fccbb404d23 Mon Sep 17 00:00:00 2001
From: Jeremy Drake <cygwin@jdrake.com>
Date: Sat, 29 May 2021 13:17:08 -0700
Subject: [PATCH 46/N] Revert "Cygwin: Handle virtual drives as non-symlinks"
This reverts commit c8949d04001e3dbc03651475b6cd1c5623400835.
---
winsup/cygwin/path.cc | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/winsup/cygwin/path.cc b/winsup/cygwin/path.cc
index 85605cf..68b0a8d 100644
--- a/winsup/cygwin/path.cc
+++ b/winsup/cygwin/path.cc
@@ -3665,9 +3665,14 @@ restart:
subst X: C:\foo\bar
- Treat it as a normal file. */
+ Treat it like a symlink. This is required to tell an
+ lstat caller that the "drive" is actually pointing
+ somewhere else, thus, it's a symlink in POSIX speak. */
if (upath.Length == 14) /* \??\X:\ */
- goto file_not_symlink;
+ {
+ fileattr &= ~FILE_ATTRIBUTE_DIRECTORY;
+ path_flags |= PATH_SYMLINK;
+ }
/* For final paths differing in inner path components return
length as negative value. This informs path_conv::check
to skip realpath handling on the last path component. */
--
2.32.0.windows.2

View File

@ -1,123 +0,0 @@
From 54d3664fe0e78823128ea39ffff8a22b52a1e71a Mon Sep 17 00:00:00 2001
From: Jeremy Drake <cygwin@jdrake.com>
Date: Sat, 29 May 2021 11:48:11 -0700
Subject: [PATCH 47/N] Cygwin: respect PC_SYM_FOLLOW and PC_SYM_NOFOLLOW_REP
with inner links.
The new GetFinalPathNameW handling for native symlinks in inner path
components is disabled if caller doesn't want to follow symlinks, or
doesn't want to follow reparse points.
---
winsup/cygwin/path.cc | 86 ++++++++++++++++++++++---------------------
1 file changed, 44 insertions(+), 42 deletions(-)
diff --git a/winsup/cygwin/path.cc b/winsup/cygwin/path.cc
index 68b0a8d..67124bb 100644
--- a/winsup/cygwin/path.cc
+++ b/winsup/cygwin/path.cc
@@ -723,9 +723,10 @@ path_conv::check (const char *src, unsigned opt,
int symlen = 0;
/* Make sure to check certain flags on last component only. */
- for (unsigned pc_flags = opt & (PC_NO_ACCESS_CHECK | PC_KEEP_HANDLE);
+ for (unsigned pc_flags = opt & (PC_NO_ACCESS_CHECK | PC_KEEP_HANDLE
+ | PC_SYM_FOLLOW | PC_SYM_NOFOLLOW_REP);
;
- pc_flags = 0)
+ pc_flags = opt & (PC_SYM_FOLLOW | PC_SYM_NOFOLLOW_REP))
{
const suffix_info *suff;
char *full_path;
@@ -3640,48 +3641,49 @@ restart:
goto file_not_symlink;
}
#endif /* __i386__ */
- {
- PWCHAR fpbuf = tp.w_get ();
- DWORD ret;
+ if ((pc_flags & (PC_SYM_FOLLOW | PC_SYM_NOFOLLOW_REP)) == PC_SYM_FOLLOW)
+ {
+ PWCHAR fpbuf = tp.w_get ();
+ DWORD ret;
- ret = GetFinalPathNameByHandleW (h, fpbuf, NT_MAX_PATH, 0);
- if (ret)
- {
- UNICODE_STRING fpath;
+ ret = GetFinalPathNameByHandleW (h, fpbuf, NT_MAX_PATH, 0);
+ if (ret)
+ {
+ UNICODE_STRING fpath;
- RtlInitCountedUnicodeString (&fpath, fpbuf, ret * sizeof (WCHAR));
- fpbuf[1] = L'?'; /* \\?\ --> \??\ */
- if (!RtlEqualUnicodeString (&upath, &fpath, !!ci_flag))
- {
- issymlink = true;
- /* upath.Buffer is big enough and unused from this point on.
- Reuse it here, avoiding yet another buffer allocation. */
- char *nfpath = (char *) upath.Buffer;
- sys_wcstombs (nfpath, NT_MAX_PATH, fpbuf);
- res = posixify (nfpath);
-
- /* If the incoming path consisted of a drive prefix only,
- we just handle a virtual drive, created with, e.g.
-
- subst X: C:\foo\bar
-
- Treat it like a symlink. This is required to tell an
- lstat caller that the "drive" is actually pointing
- somewhere else, thus, it's a symlink in POSIX speak. */
- if (upath.Length == 14) /* \??\X:\ */
- {
- fileattr &= ~FILE_ATTRIBUTE_DIRECTORY;
- path_flags |= PATH_SYMLINK;
- }
- /* For final paths differing in inner path components return
- length as negative value. This informs path_conv::check
- to skip realpath handling on the last path component. */
- else
- res = -res;
- break;
- }
- }
- }
+ RtlInitCountedUnicodeString (&fpath, fpbuf, ret * sizeof (WCHAR));
+ fpbuf[1] = L'?'; /* \\?\ --> \??\ */
+ if (!RtlEqualUnicodeString (&upath, &fpath, !!ci_flag))
+ {
+ issymlink = true;
+ /* upath.Buffer is big enough and unused from this point on.
+ Reuse it here, avoiding yet another buffer allocation. */
+ char *nfpath = (char *) upath.Buffer;
+ sys_wcstombs (nfpath, NT_MAX_PATH, fpbuf);
+ res = posixify (nfpath);
+
+ /* If the incoming path consisted of a drive prefix only,
+ we just handle a virtual drive, created with, e.g.
+
+ subst X: C:\foo\bar
+
+ Treat it like a symlink. This is required to tell an
+ lstat caller that the "drive" is actually pointing
+ somewhere else, thus, it's a symlink in POSIX speak. */
+ if (upath.Length == 14) /* \??\X:\ */
+ {
+ fileattr &= ~FILE_ATTRIBUTE_DIRECTORY;
+ path_flags |= PATH_SYMLINK;
+ }
+ /* For final paths differing in inner path components return
+ length as negative value. This informs path_conv::check
+ to skip realpath handling on the last path component. */
+ else
+ res = -res;
+ break;
+ }
+ }
+ }
/* Normal file. */
file_not_symlink:
--
2.32.0.windows.2

View File

@ -3,8 +3,8 @@
pkgbase=msys2-runtime
pkgname=('msys2-runtime' 'msys2-runtime-devel')
pkgver=3.2.0
pkgrel=15
pkgver=3.3.2
pkgrel=1
pkgdesc="Cygwin POSIX emulation engine"
arch=('i686' 'x86_64')
url="https://www.cygwin.com/"
@ -46,80 +46,50 @@ source=('msys2-runtime'::git://sourceware.org/git/newlib-cygwin.git#tag=cygwin-$
0021-Introduce-the-enable_pcon-value-for-MSYS.patch
0022-popen-call-usr-bin-sh-instead-of-bin-sh.patch
0023-CI-add-a-GHA-for-doing-a-basic-build-test.patch
0024-CI-Upload-the-build-artifacts.patch
0025-Set-up-a-GitHub-Action-to-keep-in-sync-with-Cygwin.patch
0026-recursiveCopy-Always-close-the-used-handle-with-Find.patch
0027-Expose-full-command-lines-to-other-Win32-processes-b.patch
0028-Disable-the-cygwin-GitHub-workflow.patch
0029-Do-not-show-Error-dialogs-by-default.patch
0030-uname-limit-sysname-to-MSYS-or-MINGW.patch
0031-CI-give-the-cygwin-sync-job-explicit-write-permissio.patch
0032-Cygwin-path_conv-Try-to-handle-native-symlinks-more-.patch
0033-Cygwin-console-Fix-race-issue-regarding-cons_master_.patch
0034-Revert-Cygwin-path_conv-Try-to-handle-native-symlink.patch
0035-Reapply-Cygwin-path_conv-Try-to-handle-native-symlin.patch
0036-Cygwin-Handle-virtual-drives-as-non-symlinks.patch
0037-Cygwin-suppress-FAST_CWD-warnings-on-ARM64.patch
0038-Cygwin-Add-missing-IsWow64Process2-declaration.patch
0039-Add-a-helper-to-obtain-a-function-s-address-in-kerne.patch
0040-Emulate-GenerateConsoleCtrlEvent-upon-Ctrl-C.patch
0041-kill-kill-Win32-processes-more-gently.patch
0042-Fix-64-vs-32-bit-type-confusion-in-swprintf.patch
0043-Don-t-fall-back-to-ExitProcess-if-process-handled-Ct.patch
0044-getprocaddr-refactor-cleanup.patch
0045-use-IsWow64Process2-to-detect-arm-cases.patch
0046-Revert-Cygwin-Handle-virtual-drives-as-non-symlinks.patch
0047-Cygwin-respect-PC_SYM_FOLLOW-and-PC_SYM_NOFOLLOW_REP.patch
0048-Cygwin-make-option-for-native-inner-link-handling.patch)
0024-Set-up-a-GitHub-Action-to-keep-in-sync-with-Cygwin.patch
0025-Expose-full-command-lines-to-other-Win32-processes-b.patch
0026-Disable-the-cygwin-GitHub-workflow.patch
0027-Do-not-show-Error-dialogs-by-default.patch
0028-Add-a-helper-to-obtain-a-function-s-address-in-kerne.patch
0029-Emulate-GenerateConsoleCtrlEvent-upon-Ctrl-C.patch
0030-kill-kill-Win32-processes-more-gently.patch
0031-Cygwin-make-option-for-native-inner-link-handling.patch
0032-docs-skip-building-texinfo-and-PDF-files.patch
0033-install-libs-depend-on-the-toollibs.patch)
sha256sums=('SKIP'
'605f3f31dcca983fad2659f2d8f3531217e3f133757b40b0977e6a17c406c147'
'5d120d24ce55ef08bf459781610e32c4a8e5e0eac73971a60e80590c6432d940'
'06edd4fef57a3a77c0542dbabedb4f35cf0e64fccb5edaeb2dbd5ab305a5e001'
'1a28f4fd164215332b081e405def363af157b1abc91b0d98550dccbf84a9b682'
'7698d6afc29103701cc213caaa0eaab429f791bbd8595ad82fe1c0416ac807d6'
'f022cee7fe1fc4149fb02b95256fe86e12361cfb5e66040eac9dbf7f162e4a4f'
'7d17457c9b3a7a8a3cc8d5e313d56f013ad899e6756f3816c575ee31b2bc299e'
'ce0dc0502fdce4cad50a71fcc27c175dac193603c2dc4c8a701f43ffa63d39a6'
'e08513c22a68e627324ce942f6cac3980f42a972e3c119da0b0a03d728a0701e'
'21f2592d3fa4b836eee8b2a01a84b069442e99af4181d5298e147d461c81468a'
'786126329d6bcd1e2cd6ca8a118049784e3db033e80566fde8341729701d4da9'
'47d566113baf08c56a8a7f4d516e5ce817d7936cb1b796032b30c65acce39dda'
'04eddbcddb02c8026dde666b7388cd1871fdeb9072ff36b6270c101fb3cebb88'
'314ab067f049c48de232e518539752404aca6980faf4e3a6f26679a64f1eac51'
'a6028b372da7ef8010788b5c22e66096c2c968b6a0bf944b90fbdd9e8c0d354e'
'7d24ae6654b8dce1d1c641c239e84d3c518c564c1dcbca46a7a03c75771ca634'
'e9de713a0996ed18a5d1c3dce8b2d905375b715e3e8945ba354206d61dc43f09'
'3d0822b9c68968d7db2f6750cca0619ff4eedba3b8b9b784d5848f6d041a960b'
'c9252d30813a080a7f124c383c941be97535abd31babc55e17b33f666678f140'
'65b665e16b096ea1a7476a8fcd83a3287f9427cbe781f52dc6a2a186afc165b3'
'81bab02c5930d01e813cb295099bdc8a10e84e1a38dabae3e99eb9b5ec50d401'
'c4831a348e83c30d17af54a637558986e50b34bb49be063d32df850a4e23a580'
'ab99f9903b5a8d785e0a7e0a6cc15f1de79d7d9b2bbff513e05c5b524bec845e'
'de6e6f9e8a94eccf016617a4925a04a4c18ba5cfd3acdfc3f26325963b111e56'
'4853cdfd022e6f6b58d564e24e16094b916ab5646cefab3192d90807b6775bc2'
'a6b342c1a58ac83004c10933a58b5533a3d157d2d3336ac2019183d7e6c87d65'
'6a2dffa890ea1694a76333388bfcdb5bcc67d3a431e70064342002662909d366'
'd18402a2c75e099a9cafd0ce7eba01476728c825812d4516ebc240e3c494fe4e'
'969ace2675ebec747d0ccfe2540210ebac9974973b8b93325aecb53351514b76'
'301422428472f693ad3a659b1279c969d5457eaab77be4dc0a389b2f5c5b6a55'
'acbf8e7fea8089d474a63d8e12fd68e13f33967911eb785895183619c4307092'
'ab78d325691fa6af631a73c3292537263b58a53eb0ab35c65d431a8536e8e12c'
'679c11a3c6f96aa99c7d6bf6529d7cd22fbb23b24a06196ab06a9dfec82355fe'
'109e3b9fedfa8809e67fdd43cf73d55568016409654e51386073c5542dded8a0'
'a5110bbaa001eac34af2f524badc818cb373d266ecd05001788cadca069ca5a3'
'665103d7d6313327126f73fec6abd63573b534a36068c383e030e579e5c6fdef'
'82de99d61139f19929ed2c4faf8da3d84767dc5d8f609a00f9bd8dea3c594e7d'
'82385daeed795666cf9e2e26a97e13417b714eba1011765285866f5467a4f0cf'
'8475880df4ae8f109ed006c81177d50da5c5067bb63cb2dd7c2718993dd6b74d'
'460adc6de940e25332efec7a6615bb95088ae0652870a1c0b4f37c72671444fe'
'cc0bfded281675af09ce94d847e814f77fd5cbcd86b09b7436a0e91b7697b8f4'
'04ee4b9ca58bfa8a3c0370d1cecadf50c9c02daf6a4e5ccd4610336155538b71'
'34f9a822fd2cbfd3a556f30ccea6f1dd6bb66b9edf0cd506c0cbb69b6ae437d7'
'54dd5a62e0b9491ed3d1e2ac934297864001c0d6751723342c92a332f105d603'
'526a6466d84e6aa83e0efccded72caaea398f9f2388f6752abaadc011635aa00'
'39735120e3e4316e2683a831bea08f292aaf79201fe2a0c67bdf34be284a056d'
'7795780219829aef7388de9e9877fb9fc5d5dc48243ff27354c70af4b993f581'
'93325dc9cf26f1e6e9d41d3487c3a4151d75a8202e3245822bef4e9efe44803e')
'3e789ba55d1aa296dac8462518d5d7a3be4df8a835d93884f5740a3a18db67cb'
'260d12dc8c23d13b2c5cf728bf1902a3d56e0e4d67ee50e60a43d84bb097089d'
'34c068eef8c369aa928873252a2ed17db80e6c999531c414d2487e03ea507978'
'685b4d9296fb70d82f25cc378f45d43f5d19a22e69c92b50aaf29e9093b4822b'
'90918031c45d8cb65fb62d8a6dbdcfbcdd18cf6a0c719dab1fb48f1ff4842eca'
'84802cd8a6c62527b8875b5036e58c05e8057b8aa7e6ffbbe95cd6be5277ed9b'
'04b5c7ebfc9983a06644c27562658285ceedbc47f67920af2e0dcbf32262dd12'
'31703942b3e79f43be7a1123941e9c209d1d750233186a6d525089d7978b0672'
'7cef73a50097d3b344ae65bcfe78aaf96151cf73fb72c325431e3b2e84acac42'
'199d8d7af909d295cfb3b5b68d09d6ebeb4ad70f0f588642948ffbb3a6cad76c'
'676962defbd5089d752294c3a750b54fadd78276ea084efa5e242b27e1b47bbf'
'1e2919651ee5b087153683d09054604344d452753a151723b43ef3723e42ae9a'
'561b7d7dec69c9f58281ea37c5841e5029a0f367cb510287798d4e17cd6236d2'
'7796d68231b665bc3e8bb6cf36dda65c6675ebf641252cbd2a3b370e79ca6cff'
'2596c924775817fed95809264faa5072e0e3854428aba4d3247a1a67083e50e6'
'e5f2b05dff632b91780c5463a1408054b89e1dd43d72e767b35b03e6bc4b6112'
'cb01206a759881ee1a08866396e1eb38a48137146ff07c1af9b408d1066b86d6'
'6ba8bb1875e9933e0cf33250edde576c5af81e9b92f67321f22788679306cdc8'
'ae1022aab5bff2bc479b483114784c1b7de9d499eb765ca3cb1532fc4cfb7cc3'
'73f6c2a123db3d5e0f5b337697ed2ea1ac7f56acdc37dd9174fbe0687054bef4'
'774d276b6cdd890b3a32aae081db2204ed7a3d2a56634aab730d280b7ed13f25'
'9eeabfd8db9543890c600415f52bbb9c2befcaa97ceb2dd68a7f7c4f182a3e2a'
'39d2a0229a7cf0ea9387423cac4dbcdf90c65c3664e35c89b991927c19271980'
'2154af41495e3cba9d7f097f2bba169838cb61fa3dc780c094918453ef0bb7f2'
'229821adf7e8fddf223262fa6157703943651d8625c7fc5fca14cb9bbb540066'
'623df1c43459c3971839a5e186475b6ec26a875d40cc7af3e31f9e03f8d756b2'
'a03beeb1ce71e84ada13008c6f60f740d42a3026d65fe5428fa583cef3049f3a'
'c498f1940f3cf4a6cb12e934d9bc9896d94cbdae2c707bdcb0914d2e264d2aa1'
'66add325fb3daa332d01d144f6aaaffe74847b4582645c678cbebeec11e54675'
'f9de71c2ea029b5d6832ed3d75eeddeabcde837d956fcc02d7c34c10b93a06fe'
'e8d957f1fe9b0a8c539f6052ddb34d829881f5f63f56980b8efe068dfb670af5'
'01b6ea9d8a36df326d3e8f184a3bb6cefe69563619226e7261a2fca7a6d7e139'
'a4fad4f3c048cf4387826b3e0e3090fd16493dbb768c460d5c7baf3c26b32cf3')
# Helper macros to help make tasks easier #
apply_patch_with_msg() {
@ -180,31 +150,16 @@ prepare() {
0021-Introduce-the-enable_pcon-value-for-MSYS.patch \
0022-popen-call-usr-bin-sh-instead-of-bin-sh.patch \
0023-CI-add-a-GHA-for-doing-a-basic-build-test.patch \
0024-CI-Upload-the-build-artifacts.patch \
0025-Set-up-a-GitHub-Action-to-keep-in-sync-with-Cygwin.patch \
0026-recursiveCopy-Always-close-the-used-handle-with-Find.patch \
0027-Expose-full-command-lines-to-other-Win32-processes-b.patch \
0028-Disable-the-cygwin-GitHub-workflow.patch \
0029-Do-not-show-Error-dialogs-by-default.patch \
0030-uname-limit-sysname-to-MSYS-or-MINGW.patch \
0031-CI-give-the-cygwin-sync-job-explicit-write-permissio.patch \
0032-Cygwin-path_conv-Try-to-handle-native-symlinks-more-.patch \
0033-Cygwin-console-Fix-race-issue-regarding-cons_master_.patch \
0034-Revert-Cygwin-path_conv-Try-to-handle-native-symlink.patch \
0035-Reapply-Cygwin-path_conv-Try-to-handle-native-symlin.patch \
0036-Cygwin-Handle-virtual-drives-as-non-symlinks.patch \
0037-Cygwin-suppress-FAST_CWD-warnings-on-ARM64.patch \
0038-Cygwin-Add-missing-IsWow64Process2-declaration.patch \
0039-Add-a-helper-to-obtain-a-function-s-address-in-kerne.patch \
0040-Emulate-GenerateConsoleCtrlEvent-upon-Ctrl-C.patch \
0041-kill-kill-Win32-processes-more-gently.patch \
0042-Fix-64-vs-32-bit-type-confusion-in-swprintf.patch \
0043-Don-t-fall-back-to-ExitProcess-if-process-handled-Ct.patch \
0044-getprocaddr-refactor-cleanup.patch \
0045-use-IsWow64Process2-to-detect-arm-cases.patch \
0046-Revert-Cygwin-Handle-virtual-drives-as-non-symlinks.patch \
0047-Cygwin-respect-PC_SYM_FOLLOW-and-PC_SYM_NOFOLLOW_REP.patch \
0048-Cygwin-make-option-for-native-inner-link-handling.patch
0024-Set-up-a-GitHub-Action-to-keep-in-sync-with-Cygwin.patch \
0025-Expose-full-command-lines-to-other-Win32-processes-b.patch \
0026-Disable-the-cygwin-GitHub-workflow.patch \
0027-Do-not-show-Error-dialogs-by-default.patch \
0028-Add-a-helper-to-obtain-a-function-s-address-in-kerne.patch \
0029-Emulate-GenerateConsoleCtrlEvent-upon-Ctrl-C.patch \
0030-kill-kill-Win32-processes-more-gently.patch \
0031-Cygwin-make-option-for-native-inner-link-handling.patch \
0032-docs-skip-building-texinfo-and-PDF-files.patch \
0033-install-libs-depend-on-the-toollibs.patch
}
build() {
@ -224,6 +179,8 @@ build() {
CFLAGS="$OPTIM -pipe -ggdb -Wno-error=deprecated -Wno-error=stringop-truncation -Wno-error=missing-attributes -Wno-error=maybe-uninitialized" #-Wno-error=class-memaccess
CXXFLAGS="$OPTIM -pipe -ggdb -Wno-error=deprecated -Wno-error=stringop-truncation -Wno-error=missing-attributes -Wno-error=maybe-uninitialized" #-Wno-error=class-memaccess
(cd "${srcdir}/msys2-runtime/winsup" && ./autogen.sh)
"${srcdir}"/msys2-runtime/configure \
--prefix=/usr \
--build=${CHOST} \