Add msys2-runtime-3.4
This will be the msys2-runtime variant that still works on Win7.
This commit is contained in:
parent
9d35d93c1b
commit
14e5524bed
@ -1,4 +1,5 @@
|
||||
msys2-runtime
|
||||
msys2-runtime-3.3
|
||||
msys2-runtime-3.4
|
||||
msys2-runtime-3.5
|
||||
bash
|
||||
|
||||
849
msys2-runtime-3.4/0001-Add-MSYS2-triplet.patch
Normal file
849
msys2-runtime-3.4/0001-Add-MSYS2-triplet.patch
Normal file
@ -0,0 +1,849 @@
|
||||
From ea4541258abac6b47a0dfaf0ed48e07cc7d19caa 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
|
||||
Subject: [PATCH 01/N] Add MSYS2 triplet
|
||||
|
||||
---
|
||||
compile | 4 ++--
|
||||
config.guess | 3 +++
|
||||
config.rpath | 8 +++----
|
||||
config/dfp.m4 | 3 ++-
|
||||
config/elf.m4 | 2 +-
|
||||
config/lthostflags.m4 | 2 +-
|
||||
config/mmap.m4 | 4 ++--
|
||||
config/picflag.m4 | 2 ++
|
||||
config/tcl.m4 | 4 ++--
|
||||
configure | 22 +++++++++---------
|
||||
configure.ac | 20 ++++++++---------
|
||||
libtool.m4 | 36 +++++++++++++++++-------------
|
||||
ltmain.sh | 52 +++++++++++++++++++++----------------------
|
||||
ltoptions.m4 | 2 +-
|
||||
newlib/configure | 2 +-
|
||||
newlib/configure.host | 8 +++----
|
||||
16 files changed, 93 insertions(+), 81 deletions(-)
|
||||
|
||||
diff --git a/compile b/compile
|
||||
index a85b723..a4ecdb2 100755
|
||||
--- a/compile
|
||||
+++ b/compile
|
||||
@@ -53,7 +53,7 @@ func_file_conv ()
|
||||
MINGW*)
|
||||
file_conv=mingw
|
||||
;;
|
||||
- CYGWIN*)
|
||||
+ CYGWIN*|MSYS*)
|
||||
file_conv=cygwin
|
||||
;;
|
||||
*)
|
||||
@@ -67,7 +67,7 @@ func_file_conv ()
|
||||
mingw/*)
|
||||
file=`cmd //C echo "$file " | sed -e 's/"\(.*\) " *$/\1/'`
|
||||
;;
|
||||
- cygwin/*)
|
||||
+ cygwin/*|msys/*)
|
||||
file=`cygpath -m "$file" || echo "$file"`
|
||||
;;
|
||||
wine/*)
|
||||
diff --git a/config.guess b/config.guess
|
||||
index 1972fda..a922fa3 100755
|
||||
--- a/config.guess
|
||||
+++ b/config.guess
|
||||
@@ -914,6 +914,9 @@ EOF
|
||||
amd64:CYGWIN*:*:* | x86_64:CYGWIN*:*:*)
|
||||
echo x86_64-pc-cygwin
|
||||
exit ;;
|
||||
+ amd64:MSYS*:*:* | x86_64:MSYS*:*:*)
|
||||
+ echo x86_64-unknown-msys
|
||||
+ exit ;;
|
||||
prep*:SunOS:5.*:*)
|
||||
echo powerpcle-unknown-solaris2"$(echo "$UNAME_RELEASE"|sed -e 's/[^.]*//')"
|
||||
exit ;;
|
||||
diff --git a/config.rpath b/config.rpath
|
||||
index 4dea759..4f12c27 100755
|
||||
--- a/config.rpath
|
||||
+++ b/config.rpath
|
||||
@@ -109,7 +109,7 @@ hardcode_direct=no
|
||||
hardcode_minus_L=no
|
||||
|
||||
case "$host_os" in
|
||||
- cygwin* | mingw* | pw32*)
|
||||
+ cygwin* | msys* | mingw* | pw32*)
|
||||
# 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++.
|
||||
@@ -149,7 +149,7 @@ if test "$with_gnu_ld" = yes; then
|
||||
ld_shlibs=no
|
||||
fi
|
||||
;;
|
||||
- cygwin* | mingw* | pw32*)
|
||||
+ cygwin* | msys* | mingw* | pw32*)
|
||||
# hardcode_libdir_flag_spec is actually meaningless, as there is
|
||||
# no search path for DLLs.
|
||||
hardcode_libdir_flag_spec='-L$libdir'
|
||||
@@ -268,7 +268,7 @@ else
|
||||
;;
|
||||
bsdi4*)
|
||||
;;
|
||||
- cygwin* | mingw* | pw32*)
|
||||
+ cygwin* | msys* | mingw* | pw32*)
|
||||
# When not using gcc, we currently assume that we are using
|
||||
# Microsoft Visual C++.
|
||||
# hardcode_libdir_flag_spec is actually meaningless, as there is
|
||||
@@ -437,7 +437,7 @@ case "$host_os" in
|
||||
;;
|
||||
bsdi4*)
|
||||
;;
|
||||
- cygwin* | mingw* | pw32*)
|
||||
+ cygwin* | msys* | mingw* | pw32*)
|
||||
shrext=.dll
|
||||
;;
|
||||
darwin* | rhapsody*)
|
||||
diff --git a/config/dfp.m4 b/config/dfp.m4
|
||||
index 5b29089..b03bcf0 100644
|
||||
--- a/config/dfp.m4
|
||||
+++ b/config/dfp.m4
|
||||
@@ -23,7 +23,8 @@ Valid choices are 'yes', 'bid', 'dpd', and 'no'.]) ;;
|
||||
powerpc*-*-linux* | i?86*-*-linux* | x86_64*-*-linux* | s390*-*-linux* | \
|
||||
i?86*-*-elfiamcu | i?86*-*-gnu* | \
|
||||
i?86*-*-mingw* | x86_64*-*-mingw* | \
|
||||
- i?86*-*-cygwin* | x86_64*-*-cygwin*)
|
||||
+ i?86*-*-cygwin* | x86_64*-*-cygwin* | \
|
||||
+ i?86*-*-msys* | x86_64*-*-msys*)
|
||||
enable_decimal_float=yes
|
||||
;;
|
||||
*)
|
||||
diff --git a/config/elf.m4 b/config/elf.m4
|
||||
index 5f5cd88..b8491de 100644
|
||||
--- a/config/elf.m4
|
||||
+++ b/config/elf.m4
|
||||
@@ -15,7 +15,7 @@ AC_REQUIRE([AC_CANONICAL_TARGET])
|
||||
|
||||
target_elf=no
|
||||
case $target in
|
||||
- *-darwin* | *-aix* | *-cygwin* | *-mingw* | *-aout* | *-*coff* | \
|
||||
+ *-darwin* | *-aix* | *-cygwin* | *-msys* | *-mingw* | *-aout* | *-*coff* | \
|
||||
*-msdosdjgpp* | *-vms* | *-wince* | *-*-pe* | \
|
||||
alpha*-dec-osf* | hppa[[12]]*-*-hpux* | \
|
||||
nvptx-*-none)
|
||||
diff --git a/config/lthostflags.m4 b/config/lthostflags.m4
|
||||
index bc0f59e..ad977d4 100644
|
||||
--- a/config/lthostflags.m4
|
||||
+++ b/config/lthostflags.m4
|
||||
@@ -13,7 +13,7 @@ AC_DEFUN([ACX_LT_HOST_FLAGS], [
|
||||
AC_REQUIRE([AC_CANONICAL_SYSTEM])
|
||||
|
||||
case $host in
|
||||
- *-cygwin* | *-mingw*)
|
||||
+ *-cygwin* | *-msys* | *-mingw*)
|
||||
# 'host' will be top-level target in the case of a target lib,
|
||||
# we must compare to with_cross_host to decide if this is a native
|
||||
# or cross-compiler and select where to install dlls appropriately.
|
||||
diff --git a/config/mmap.m4 b/config/mmap.m4
|
||||
index fba0d9d..df2c778 100644
|
||||
--- a/config/mmap.m4
|
||||
+++ b/config/mmap.m4
|
||||
@@ -42,7 +42,7 @@ else
|
||||
# Systems known to be in this category are Windows (all variants),
|
||||
# VMS, and Darwin.
|
||||
case "$host_os" in
|
||||
- *vms* | cygwin* | pe | mingw* | darwin* | ultrix* | hpux10* | hpux11.00)
|
||||
+ *vms* | cygwin* | msys* | pe | mingw* | darwin* | ultrix* | hpux10* | hpux11.00)
|
||||
gcc_cv_func_mmap_dev_zero=no ;;
|
||||
*)
|
||||
gcc_cv_func_mmap_dev_zero=yes;;
|
||||
@@ -74,7 +74,7 @@ else
|
||||
# above for use of /dev/zero.
|
||||
# Systems known to be in this category are Windows, VMS, and SCO Unix.
|
||||
case "$host_os" in
|
||||
- *vms* | cygwin* | pe | mingw* | sco* | udk* )
|
||||
+ *vms* | cygwin* | msys* | pe | mingw* | sco* | udk* )
|
||||
gcc_cv_func_mmap_anon=no ;;
|
||||
*)
|
||||
gcc_cv_func_mmap_anon=yes;;
|
||||
diff --git a/config/picflag.m4 b/config/picflag.m4
|
||||
index 614421d..9d507ba 100644
|
||||
--- a/config/picflag.m4
|
||||
+++ b/config/picflag.m4
|
||||
@@ -25,6 +25,8 @@ case "${$2}" in
|
||||
;;
|
||||
i[[34567]]86-*-cygwin* | x86_64-*-cygwin*)
|
||||
;;
|
||||
+ i[[34567]]86-*-msys* | x86_64-*-msys*)
|
||||
+ ;;
|
||||
i[[34567]]86-*-mingw* | x86_64-*-mingw*)
|
||||
;;
|
||||
i[[34567]]86-*-nto-qnx*)
|
||||
diff --git a/config/tcl.m4 b/config/tcl.m4
|
||||
index 4542a4b..209bd8d 100644
|
||||
--- a/config/tcl.m4
|
||||
+++ b/config/tcl.m4
|
||||
@@ -33,7 +33,7 @@ AC_DEFUN([SC_PATH_TCLCONFIG], [
|
||||
|
||||
# First check to see if --with-tcl was specified.
|
||||
case "${host}" in
|
||||
- *-*-cygwin*) platDir="win" ;;
|
||||
+ *-*-cygwin* | *-*-msys*) platDir="win" ;;
|
||||
*) platDir="unix" ;;
|
||||
esac
|
||||
if test x"${with_tclconfig}" != x ; then
|
||||
@@ -165,7 +165,7 @@ AC_DEFUN([SC_PATH_TKCONFIG], [
|
||||
|
||||
# then check for a private Tk library
|
||||
case "${host}" in
|
||||
- *-*-cygwin*) platDir="win" ;;
|
||||
+ *-*-cygwin* | *-*-msys*) platDir="win" ;;
|
||||
*) platDir="unix" ;;
|
||||
esac
|
||||
if test x"${ac_cv_c_tkconfig}" = x ; then
|
||||
diff --git a/configure b/configure
|
||||
index eb0ba84..0badc34 100755
|
||||
--- a/configure
|
||||
+++ b/configure
|
||||
@@ -3074,7 +3074,7 @@ fi
|
||||
# Configure extra directories which are host specific
|
||||
|
||||
case "${host}" in
|
||||
- *-cygwin*)
|
||||
+ *-cygwin* | *-msys*)
|
||||
configdirs="$configdirs libtermcap" ;;
|
||||
esac
|
||||
|
||||
@@ -3595,7 +3595,7 @@ esac
|
||||
# Disable the go frontend on systems where it is known to not work. Please keep
|
||||
# this in sync with contrib/config-list.mk.
|
||||
case "${target}" in
|
||||
-*-*-darwin* | *-*-cygwin* | *-*-mingw* | *-*-aix*)
|
||||
+*-*-darwin* | *-*-cygwin* | *-*-msys* | *-*-mingw* | *-*-aix*)
|
||||
unsupported_languages="$unsupported_languages go"
|
||||
;;
|
||||
esac
|
||||
@@ -3608,7 +3608,7 @@ if test x$enable_libgo = x; then
|
||||
# PR 46986
|
||||
noconfigdirs="$noconfigdirs target-libgo"
|
||||
;;
|
||||
- *-*-cygwin* | *-*-mingw*)
|
||||
+ *-*-cygwin* | *-*-msys* | *-*-mingw*)
|
||||
noconfigdirs="$noconfigdirs target-libgo"
|
||||
;;
|
||||
*-*-aix*)
|
||||
@@ -3880,7 +3880,7 @@ case "${target}" in
|
||||
i[3456789]86-*-mingw*)
|
||||
target_configdirs="$target_configdirs target-winsup"
|
||||
;;
|
||||
- *-*-cygwin*)
|
||||
+ *-*-cygwin* | *-*-msys*)
|
||||
target_configdirs="$target_configdirs target-libtermcap target-winsup"
|
||||
noconfigdirs="$noconfigdirs target-libgloss"
|
||||
# always build newlib if winsup directory is present.
|
||||
@@ -4024,7 +4024,7 @@ case "${host}" in
|
||||
i[3456789]86-*-msdosdjgpp*)
|
||||
host_makefile_frag="config/mh-djgpp"
|
||||
;;
|
||||
- *-cygwin*)
|
||||
+ *-cygwin* | *-msys*)
|
||||
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking to see if cat works as expected" >&5
|
||||
$as_echo_n "checking to see if cat works as expected... " >&6; }
|
||||
@@ -6192,7 +6192,7 @@ fi
|
||||
|
||||
target_elf=no
|
||||
case $target in
|
||||
- *-darwin* | *-aix* | *-cygwin* | *-mingw* | *-aout* | *-*coff* | \
|
||||
+ *-darwin* | *-aix* | *-cygwin* | *-msys* | *-mingw* | *-aout* | *-*coff* | \
|
||||
*-msdosdjgpp* | *-vms* | *-wince* | *-*-pe* | \
|
||||
alpha*-dec-osf* | hppa[12]*-*-hpux* | \
|
||||
nvptx-*-none)
|
||||
@@ -6210,7 +6210,7 @@ if test $target_elf = yes; then :
|
||||
else
|
||||
if test x"$default_enable_lto" = x"yes" ; then
|
||||
case $target in
|
||||
- *-apple-darwin9* | *-cygwin* | *-mingw* | *djgpp*) ;;
|
||||
+ *-apple-darwin9* | *-cygwin* | *-msys* | *-mingw* | *djgpp*) ;;
|
||||
# On other non-ELF platforms, LTO has yet to be validated.
|
||||
*) enable_lto=no ;;
|
||||
esac
|
||||
@@ -6221,7 +6221,7 @@ else
|
||||
# warn during gcc/ subconfigure; unless you're bootstrapping with
|
||||
# -flto it won't be needed until after installation anyway.
|
||||
case $target in
|
||||
- *-cygwin* | *-mingw* | *-apple-darwin* | *djgpp*) ;;
|
||||
+ *-cygwin* | *-msys* | *-mingw* | *-apple-darwin* | *djgpp*) ;;
|
||||
*) if test x"$enable_lto" = x"yes"; then
|
||||
as_fn_error $? "LTO support is not enabled for this target." "$LINENO" 5
|
||||
fi
|
||||
@@ -6231,7 +6231,7 @@ else
|
||||
# Among non-ELF, only Windows platforms support the lto-plugin so far.
|
||||
# Build it unless LTO was explicitly disabled.
|
||||
case $target in
|
||||
- *-cygwin* | *-mingw*) build_lto_plugin=$enable_lto ;;
|
||||
+ *-cygwin* | *-msys* | *-mingw*) build_lto_plugin=$enable_lto ;;
|
||||
*) ;;
|
||||
esac
|
||||
|
||||
@@ -7102,7 +7102,7 @@ rm -f conftest*
|
||||
case "${host}" in
|
||||
*-*-hpux*) RPATH_ENVVAR=SHLIB_PATH ;;
|
||||
*-*-darwin*) RPATH_ENVVAR=DYLD_LIBRARY_PATH ;;
|
||||
- *-*-mingw* | *-*-cygwin ) RPATH_ENVVAR=PATH ;;
|
||||
+ *-*-mingw* | *-*-cygwin | *-msys ) RPATH_ENVVAR=PATH ;;
|
||||
*) RPATH_ENVVAR=LD_LIBRARY_PATH ;;
|
||||
esac
|
||||
|
||||
@@ -7620,7 +7620,7 @@ case " $target_configdirs " in
|
||||
case " $target_configargs " in
|
||||
*" --with-newlib "*)
|
||||
case "$target" in
|
||||
- *-cygwin*)
|
||||
+ *-cygwin* | *-msys*)
|
||||
FLAGS_FOR_TARGET=$FLAGS_FOR_TARGET' -L$$r/$(TARGET_SUBDIR)/winsup/cygwin -isystem $$s/winsup/cygwin/include'
|
||||
;;
|
||||
esac
|
||||
diff --git a/configure.ac b/configure.ac
|
||||
index f1bb721..f7fc8e9 100644
|
||||
--- a/configure.ac
|
||||
+++ b/configure.ac
|
||||
@@ -409,7 +409,7 @@ AC_ARG_ENABLE(compressed_debug_sections,
|
||||
# Configure extra directories which are host specific
|
||||
|
||||
case "${host}" in
|
||||
- *-cygwin*)
|
||||
+ *-cygwin* | *-msys*)
|
||||
configdirs="$configdirs libtermcap" ;;
|
||||
esac
|
||||
|
||||
@@ -893,7 +893,7 @@ esac
|
||||
# Disable the go frontend on systems where it is known to not work. Please keep
|
||||
# this in sync with contrib/config-list.mk.
|
||||
case "${target}" in
|
||||
-*-*-darwin* | *-*-cygwin* | *-*-mingw* | *-*-aix*)
|
||||
+*-*-darwin* | *-*-cygwin* | *-*-msys* | *-*-mingw* | *-*-aix*)
|
||||
unsupported_languages="$unsupported_languages go"
|
||||
;;
|
||||
esac
|
||||
@@ -906,7 +906,7 @@ if test x$enable_libgo = x; then
|
||||
# PR 46986
|
||||
noconfigdirs="$noconfigdirs target-libgo"
|
||||
;;
|
||||
- *-*-cygwin* | *-*-mingw*)
|
||||
+ *-*-cygwin* | *-*-msys* | *-*-mingw*)
|
||||
noconfigdirs="$noconfigdirs target-libgo"
|
||||
;;
|
||||
*-*-aix*)
|
||||
@@ -1178,7 +1178,7 @@ case "${target}" in
|
||||
i[[3456789]]86-*-mingw*)
|
||||
target_configdirs="$target_configdirs target-winsup"
|
||||
;;
|
||||
- *-*-cygwin*)
|
||||
+ *-*-cygwin* | *-*-msys*)
|
||||
target_configdirs="$target_configdirs target-libtermcap target-winsup"
|
||||
noconfigdirs="$noconfigdirs target-libgloss"
|
||||
# always build newlib if winsup directory is present.
|
||||
@@ -1322,7 +1322,7 @@ case "${host}" in
|
||||
i[[3456789]]86-*-msdosdjgpp*)
|
||||
host_makefile_frag="config/mh-djgpp"
|
||||
;;
|
||||
- *-cygwin*)
|
||||
+ *-cygwin* | *-msys*)
|
||||
ACX_CHECK_CYGWIN_CAT_WORKS
|
||||
host_makefile_frag="config/mh-cygwin"
|
||||
;;
|
||||
@@ -1809,7 +1809,7 @@ ACX_ELF_TARGET_IFELSE([# ELF platforms build the lto-plugin always.
|
||||
build_lto_plugin=yes
|
||||
],[if test x"$default_enable_lto" = x"yes" ; then
|
||||
case $target in
|
||||
- *-apple-darwin9* | *-cygwin* | *-mingw* | *djgpp*) ;;
|
||||
+ *-apple-darwin9* | *-cygwin* | *-msys* | *-mingw* | *djgpp*) ;;
|
||||
# On other non-ELF platforms, LTO has yet to be validated.
|
||||
*) enable_lto=no ;;
|
||||
esac
|
||||
@@ -1820,7 +1820,7 @@ ACX_ELF_TARGET_IFELSE([# ELF platforms build the lto-plugin always.
|
||||
# warn during gcc/ subconfigure; unless you're bootstrapping with
|
||||
# -flto it won't be needed until after installation anyway.
|
||||
case $target in
|
||||
- *-cygwin* | *-mingw* | *-apple-darwin* | *djgpp*) ;;
|
||||
+ *-cygwin* | *-msys*| *-mingw* | *-apple-darwin* | *djgpp*) ;;
|
||||
*) if test x"$enable_lto" = x"yes"; then
|
||||
AC_MSG_ERROR([LTO support is not enabled for this target.])
|
||||
fi
|
||||
@@ -1830,7 +1830,7 @@ ACX_ELF_TARGET_IFELSE([# ELF platforms build the lto-plugin always.
|
||||
# Among non-ELF, only Windows platforms support the lto-plugin so far.
|
||||
# Build it unless LTO was explicitly disabled.
|
||||
case $target in
|
||||
- *-cygwin* | *-mingw*) build_lto_plugin=$enable_lto ;;
|
||||
+ *-cygwin* | *-msys* | *-mingw*) build_lto_plugin=$enable_lto ;;
|
||||
*) ;;
|
||||
esac
|
||||
])
|
||||
@@ -2644,7 +2644,7 @@ rm -f conftest*
|
||||
case "${host}" in
|
||||
*-*-hpux*) RPATH_ENVVAR=SHLIB_PATH ;;
|
||||
*-*-darwin*) RPATH_ENVVAR=DYLD_LIBRARY_PATH ;;
|
||||
- *-*-mingw* | *-*-cygwin ) RPATH_ENVVAR=PATH ;;
|
||||
+ *-*-mingw* | *-*-cygwin | *-*-msys ) RPATH_ENVVAR=PATH ;;
|
||||
*) RPATH_ENVVAR=LD_LIBRARY_PATH ;;
|
||||
esac
|
||||
|
||||
@@ -3157,7 +3157,7 @@ case " $target_configdirs " in
|
||||
case " $target_configargs " in
|
||||
*" --with-newlib "*)
|
||||
case "$target" in
|
||||
- *-cygwin*)
|
||||
+ *-cygwin* | *-msys*)
|
||||
FLAGS_FOR_TARGET=$FLAGS_FOR_TARGET' -L$$r/$(TARGET_SUBDIR)/winsup/cygwin -isystem $$s/winsup/cygwin/include'
|
||||
;;
|
||||
esac
|
||||
diff --git a/libtool.m4 b/libtool.m4
|
||||
index a216bb1..0d6d17a 100644
|
||||
--- a/libtool.m4
|
||||
+++ b/libtool.m4
|
||||
@@ -1521,7 +1521,7 @@ AC_CACHE_VAL([lt_cv_sys_max_cmd_len], [dnl
|
||||
lt_cv_sys_max_cmd_len=-1;
|
||||
;;
|
||||
|
||||
- cygwin* | mingw* | cegcc*)
|
||||
+ cygwin* | msys* | mingw* | cegcc*)
|
||||
# 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,
|
||||
@@ -1763,7 +1763,7 @@ else
|
||||
lt_cv_dlopen_libs=
|
||||
;;
|
||||
|
||||
- cygwin*)
|
||||
+ cygwin* | msys*)
|
||||
lt_cv_dlopen="dlopen"
|
||||
lt_cv_dlopen_libs=
|
||||
;;
|
||||
@@ -2234,14 +2234,14 @@ bsdi[[45]]*)
|
||||
# libtool to hard-code these into programs
|
||||
;;
|
||||
|
||||
-cygwin* | mingw* | pw32* | cegcc*)
|
||||
+cygwin* | msys* | mingw* | pw32* | cegcc*)
|
||||
version_type=windows
|
||||
shrext_cmds=".dll"
|
||||
need_version=no
|
||||
need_lib_prefix=no
|
||||
|
||||
case $GCC,$host_os in
|
||||
- yes,cygwin* | yes,mingw* | yes,pw32* | yes,cegcc*)
|
||||
+ yes,cygwin* | yes,msys* | yes,mingw* | yes,pw32* | yes,cegcc*)
|
||||
library_names_spec='$libname.dll.a'
|
||||
# DLL is installed to $(libdir)/../bin by postinstall_cmds
|
||||
postinstall_cmds='base_file=`basename \${file}`~
|
||||
@@ -2262,6 +2262,12 @@ cygwin* | mingw* | pw32* | cegcc*)
|
||||
cygwin*)
|
||||
# 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}'
|
||||
+m4_if([$1], [],[
|
||||
+ sys_lib_search_path_spec="$sys_lib_search_path_spec /usr/lib/w32api"])
|
||||
+ ;;
|
||||
+ msys*)
|
||||
+ # Msys DLLs use 'msys-' prefix rather than 'lib'
|
||||
+ soname_spec='`echo ${libname} | sed -e 's/^lib/msys-/'``echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}'
|
||||
m4_if([$1], [],[
|
||||
sys_lib_search_path_spec="$sys_lib_search_path_spec /usr/lib/w32api"])
|
||||
;;
|
||||
@@ -3021,7 +3027,7 @@ bsdi[[45]]*)
|
||||
lt_cv_file_magic_test_file=/shlib/libc.so
|
||||
;;
|
||||
|
||||
-cygwin*)
|
||||
+cygwin* | msys*)
|
||||
# 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'
|
||||
@@ -3307,7 +3313,7 @@ AC_DEFUN([LT_LIB_M],
|
||||
[AC_REQUIRE([AC_CANONICAL_HOST])dnl
|
||||
LIBM=
|
||||
case $host in
|
||||
-*-*-beos* | *-*-cegcc* | *-*-cygwin* | *-*-haiku* | *-*-pw32* | *-*-darwin*)
|
||||
+*-*-beos* | *-*-cegcc* | *-*-cygwin* | *-*-msys* | *-*-haiku* | *-*-pw32* | *-*-darwin*)
|
||||
# These system don't have libm, or don't need it
|
||||
;;
|
||||
*-ncr-sysv4.3*)
|
||||
@@ -3382,7 +3388,7 @@ case $host_os in
|
||||
aix*)
|
||||
symcode='[[BCDT]]'
|
||||
;;
|
||||
-cygwin* | mingw* | pw32* | cegcc*)
|
||||
+cygwin* | msys* | mingw* | pw32* | cegcc*)
|
||||
symcode='[[ABCDGISTW]]'
|
||||
;;
|
||||
hpux*)
|
||||
@@ -3629,7 +3635,7 @@ m4_if([$1], [CXX], [
|
||||
beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*)
|
||||
# PIC is the default for these OSes.
|
||||
;;
|
||||
- mingw* | cygwin* | os2* | pw32* | cegcc*)
|
||||
+ mingw* | cygwin* | msys* | os2* | pw32* | cegcc*)
|
||||
# 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
|
||||
@@ -3942,7 +3948,7 @@ m4_if([$1], [CXX], [
|
||||
# PIC is the default for these OSes.
|
||||
;;
|
||||
|
||||
- mingw* | cygwin* | pw32* | os2* | cegcc*)
|
||||
+ mingw* | cygwin* | msys* | pw32* | os2* | cegcc*)
|
||||
# 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
|
||||
@@ -4025,7 +4031,7 @@ m4_if([$1], [CXX], [
|
||||
fi
|
||||
;;
|
||||
|
||||
- mingw* | cygwin* | pw32* | os2* | cegcc*)
|
||||
+ mingw* | cygwin* | msys* | pw32* | os2* | cegcc*)
|
||||
# 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).
|
||||
m4_if([$1], [GCJ], [],
|
||||
@@ -4258,7 +4264,7 @@ m4_if([$1], [CXX], [
|
||||
pw32*)
|
||||
_LT_TAGVAR(export_symbols_cmds, $1)="$ltdll_cmds"
|
||||
;;
|
||||
- cygwin* | mingw* | cegcc*)
|
||||
+ cygwin* | msys* | mingw* | cegcc*)
|
||||
_LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGRS]][[ ]]/s/.*[[ ]]\([[^ ]]*\)/\1 DATA/;/^.*[[ ]]__nm__/s/^.*[[ ]]__nm__\([[^ ]]*\)[[ ]][[^ ]]*/\1 DATA/;/^I[[ ]]/d;/^[[AITW]][[ ]]/s/.* //'\'' | sort | uniq > $export_symbols'
|
||||
;;
|
||||
*)
|
||||
@@ -4310,7 +4316,7 @@ dnl Note also adjust exclude_expsyms for C++ above.
|
||||
extract_expsyms_cmds=
|
||||
|
||||
case $host_os in
|
||||
- cygwin* | mingw* | pw32* | cegcc*)
|
||||
+ cygwin* | msys* | mingw* | pw32* | cegcc*)
|
||||
# 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++.
|
||||
@@ -4425,7 +4431,7 @@ _LT_EOF
|
||||
fi
|
||||
;;
|
||||
|
||||
- cygwin* | mingw* | pw32* | cegcc*)
|
||||
+ cygwin* | msys* | mingw* | pw32* | cegcc*)
|
||||
# _LT_TAGVAR(hardcode_libdir_flag_spec, $1) is actually meaningless,
|
||||
# as there is no search path for DLLs.
|
||||
_LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
|
||||
@@ -4798,7 +4804,7 @@ _LT_EOF
|
||||
_LT_TAGVAR(export_dynamic_flag_spec, $1)=-rdynamic
|
||||
;;
|
||||
|
||||
- cygwin* | mingw* | pw32* | cegcc*)
|
||||
+ cygwin* | msys* | mingw* | pw32* | cegcc*)
|
||||
# When not using gcc, we currently assume that we are using
|
||||
# Microsoft Visual C++.
|
||||
# hardcode_libdir_flag_spec is actually meaningless, as there is
|
||||
@@ -5742,7 +5748,7 @@ if test "$_lt_caught_CXX_error" != yes; then
|
||||
esac
|
||||
;;
|
||||
|
||||
- cygwin* | mingw* | pw32* | cegcc*)
|
||||
+ cygwin* | msys* | mingw* | pw32* | cegcc*)
|
||||
# _LT_TAGVAR(hardcode_libdir_flag_spec, $1) is actually meaningless,
|
||||
# as there is no search path for DLLs.
|
||||
_LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
|
||||
diff --git a/ltmain.sh b/ltmain.sh
|
||||
index 9503ec8..307a339 100644
|
||||
--- a/ltmain.sh
|
||||
+++ b/ltmain.sh
|
||||
@@ -976,7 +976,7 @@ func_enable_tag ()
|
||||
|
||||
|
||||
case $host in
|
||||
- *cygwin* | *mingw* | *pw32* | *cegcc* | *solaris2* )
|
||||
+ *cygwin* | *msys* | *mingw* | *pw32* | *cegcc* | *solaris2* )
|
||||
# don't eliminate duplications in $postdeps and $predeps
|
||||
opt_duplicate_compiler_generated_deps=:
|
||||
;;
|
||||
@@ -1453,7 +1453,7 @@ func_mode_compile ()
|
||||
|
||||
# On Cygwin there's no "real" PIC flag so we must build both object types
|
||||
case $host_os in
|
||||
- cygwin* | mingw* | pw32* | os2* | cegcc*)
|
||||
+ cygwin* | msys* | mingw* | pw32* | os2* | cegcc*)
|
||||
pic_mode=default
|
||||
;;
|
||||
esac
|
||||
@@ -2279,7 +2279,7 @@ func_mode_install ()
|
||||
'exit $?'
|
||||
tstripme="$stripme"
|
||||
case $host_os in
|
||||
- cygwin* | mingw* | pw32* | cegcc*)
|
||||
+ cygwin* | msys* | mingw* | pw32* | cegcc*)
|
||||
case $realname in
|
||||
*.dll.a)
|
||||
tstripme=""
|
||||
@@ -2385,7 +2385,7 @@ func_mode_install ()
|
||||
|
||||
# Do a test to see if this is really a libtool program.
|
||||
case $host in
|
||||
- *cygwin* | *mingw*)
|
||||
+ *cygwin* | *msys* | *mingw*)
|
||||
if func_ltwrapper_executable_p "$file"; then
|
||||
func_ltwrapper_scriptname "$file"
|
||||
wrapper=$func_ltwrapper_scriptname_result
|
||||
@@ -2460,7 +2460,7 @@ func_mode_install ()
|
||||
# remove .exe since cygwin /usr/bin/install will append another
|
||||
# one anyway
|
||||
case $install_prog,$host in
|
||||
- */usr/bin/install*,*cygwin*)
|
||||
+ */usr/bin/install*,*cygwin*|*/usr/bin/install*,*msys*)
|
||||
case $file:$destfile in
|
||||
*.exe:*.exe)
|
||||
# this is ok
|
||||
@@ -2595,7 +2595,7 @@ extern \"C\" {
|
||||
$RM $export_symbols
|
||||
${SED} -n -e '/^: @PROGRAM@ $/d' -e 's/^.* \(.*\)$/\1/p' < "$nlist" > "$export_symbols"
|
||||
case $host in
|
||||
- *cygwin* | *mingw* | *cegcc* )
|
||||
+ *cygwin* | *msys* | *mingw* | *cegcc* )
|
||||
echo EXPORTS > "$output_objdir/$outputname.def"
|
||||
cat "$export_symbols" >> "$output_objdir/$outputname.def"
|
||||
;;
|
||||
@@ -2607,7 +2607,7 @@ extern \"C\" {
|
||||
$GREP -f "$output_objdir/$outputname.exp" < "$nlist" > "$nlist"T
|
||||
$MV "$nlist"T "$nlist"
|
||||
case $host in
|
||||
- *cygwin* | *mingw* | *cegcc* )
|
||||
+ *cygwin* | *msys* | *mingw* | *cegcc* )
|
||||
echo EXPORTS > "$output_objdir/$outputname.def"
|
||||
cat "$nlist" >> "$output_objdir/$outputname.def"
|
||||
;;
|
||||
@@ -2663,7 +2663,7 @@ typedef struct {
|
||||
} lt_dlsymlist;
|
||||
"
|
||||
case $host in
|
||||
- *cygwin* | *mingw* | *cegcc* )
|
||||
+ *cygwin* | *msys* | *mingw* | *cegcc* )
|
||||
echo >> "$output_objdir/$my_dlsyms" "\
|
||||
/* DATA imports from DLLs on WIN32 con't be const, because
|
||||
runtime relocations are performed -- see ld's documentation
|
||||
@@ -2749,7 +2749,7 @@ static const void *lt_preloaded_setup() {
|
||||
# Transform the symbol file into the correct name.
|
||||
symfileobj="$output_objdir/${my_outputname}S.$objext"
|
||||
case $host in
|
||||
- *cygwin* | *mingw* | *cegcc* )
|
||||
+ *cygwin* | *msys* | *mingw* | *cegcc* )
|
||||
if test -f "$output_objdir/$my_outputname.def"; then
|
||||
compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"`
|
||||
finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"`
|
||||
@@ -3192,7 +3192,7 @@ func_to_host_path ()
|
||||
func_to_host_path_result=`( cmd //c echo "$1" ) 2>/dev/null |
|
||||
$SED -e 's/[ ]*$//' -e "$lt_sed_naive_backslashify"`
|
||||
;;
|
||||
- *cygwin* )
|
||||
+ *cygwin* | *msys* )
|
||||
func_to_host_path_result=`cygpath -w "$1" |
|
||||
$SED -e "$lt_sed_naive_backslashify"`
|
||||
;;
|
||||
@@ -3265,7 +3265,7 @@ func_to_host_pathlist ()
|
||||
( cmd //c echo "$func_to_host_pathlist_tmp1" ) 2>/dev/null |
|
||||
$SED -e 's/[ ]*$//' -e "$lt_sed_naive_backslashify"`
|
||||
;;
|
||||
- *cygwin* )
|
||||
+ *cygwin* | *msys* )
|
||||
func_to_host_pathlist_result=`cygpath -w -p "$func_to_host_pathlist_tmp1" |
|
||||
$SED -e "$lt_sed_naive_backslashify"`
|
||||
;;
|
||||
@@ -3571,7 +3571,7 @@ main (int argc, char *argv[])
|
||||
{
|
||||
EOF
|
||||
case "$host" in
|
||||
- *mingw* | *cygwin* )
|
||||
+ *mingw* | *cygwin* | *msys* )
|
||||
# make stdout use "unix" line endings
|
||||
echo " setmode(1,_O_BINARY);"
|
||||
;;
|
||||
@@ -4233,7 +4233,7 @@ func_mode_link ()
|
||||
{
|
||||
$opt_debug
|
||||
case $host in
|
||||
- *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*)
|
||||
+ *-*-cygwin* | *-*-msys* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*)
|
||||
# It is impossible to link a dll without this setting, and
|
||||
# we shouldn't force the makefile maintainer to figure out
|
||||
# which system we are compiling for in order to pass an extra
|
||||
@@ -4713,7 +4713,7 @@ func_mode_link ()
|
||||
;;
|
||||
esac
|
||||
case $host in
|
||||
- *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*)
|
||||
+ *-*-cygwin* | *-*-msys* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*)
|
||||
testbindir=`$ECHO "$dir" | $SED 's*/lib$*/bin*'`
|
||||
case :$dllsearchpath: in
|
||||
*":$dir:"*) ;;
|
||||
@@ -4733,7 +4733,7 @@ func_mode_link ()
|
||||
-l*)
|
||||
if test "X$arg" = "X-lc" || test "X$arg" = "X-lm"; then
|
||||
case $host in
|
||||
- *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-beos* | *-cegcc* | *-*-haiku*)
|
||||
+ *-*-cygwin* | *-*-msys* | *-*-mingw* | *-*-pw32* | *-*-beos* | *-cegcc* | *-*-haiku*)
|
||||
# These systems don't actually have a C or math library (as such)
|
||||
continue
|
||||
;;
|
||||
@@ -4813,7 +4813,7 @@ func_mode_link ()
|
||||
|
||||
-no-install)
|
||||
case $host in
|
||||
- *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-darwin* | *-cegcc*)
|
||||
+ *-*-cygwin* | *-*-msys* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-darwin* | *-cegcc*)
|
||||
# The PATH hackery in wrapper scripts is required on Windows
|
||||
# and Darwin in order for the loader to find any dlls it needs.
|
||||
func_warning "\`-no-install' is ignored for $host"
|
||||
@@ -5772,7 +5772,7 @@ func_mode_link ()
|
||||
if test -n "$library_names" &&
|
||||
{ test "$use_static_libs" = no || test -z "$old_library"; }; then
|
||||
case $host in
|
||||
- *cygwin* | *mingw* | *cegcc*)
|
||||
+ *cygwin* | *msys* | *mingw* | *cegcc*)
|
||||
# No point in relinking DLLs because paths are not encoded
|
||||
notinst_deplibs="$notinst_deplibs $lib"
|
||||
need_relink=no
|
||||
@@ -5842,7 +5842,7 @@ func_mode_link ()
|
||||
elif test -n "$soname_spec"; then
|
||||
# bleh windows
|
||||
case $host in
|
||||
- *cygwin* | mingw* | *cegcc*)
|
||||
+ *cygwin* | msys* | mingw* | *cegcc*)
|
||||
func_arith $current - $age
|
||||
major=$func_arith_result
|
||||
versuffix="-$major"
|
||||
@@ -6693,7 +6693,7 @@ func_mode_link ()
|
||||
if test "$build_libtool_libs" = yes; then
|
||||
if test -n "$rpath"; then
|
||||
case $host in
|
||||
- *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-beos* | *-cegcc* | *-*-haiku*)
|
||||
+ *-*-cygwin* | *-*-msys* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-beos* | *-cegcc* | *-*-haiku*)
|
||||
# these systems don't actually have a c library (as such)!
|
||||
;;
|
||||
*-*-rhapsody* | *-*-darwin1.[012])
|
||||
@@ -7194,7 +7194,7 @@ EOF
|
||||
|
||||
orig_export_symbols=
|
||||
case $host_os in
|
||||
- cygwin* | mingw* | cegcc*)
|
||||
+ cygwin* | msys* | mingw* | cegcc*)
|
||||
if test -n "$export_symbols" && test -z "$export_symbols_regex"; then
|
||||
# exporting using user supplied symfile
|
||||
if test "x`$SED 1q $export_symbols`" != xEXPORTS; then
|
||||
@@ -7710,7 +7710,7 @@ EOF
|
||||
|
||||
prog)
|
||||
case $host in
|
||||
- *cygwin*) func_stripname '' '.exe' "$output"
|
||||
+ *cygwin* | *msys*) func_stripname '' '.exe' "$output"
|
||||
output=$func_stripname_result.exe;;
|
||||
esac
|
||||
test -n "$vinfo" && \
|
||||
@@ -7823,7 +7823,7 @@ EOF
|
||||
esac
|
||||
fi
|
||||
case $host in
|
||||
- *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*)
|
||||
+ *-*-cygwin* | *-*-msys* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*)
|
||||
testbindir=`${ECHO} "$libdir" | ${SED} -e 's*/lib$*/bin*'`
|
||||
case :$dllsearchpath: in
|
||||
*":$libdir:"*) ;;
|
||||
@@ -7901,7 +7901,7 @@ EOF
|
||||
# Disable wrappers for cegcc and mingw32ce hosts, we are cross compiling anyway.
|
||||
wrappers_required=no
|
||||
;;
|
||||
- *cygwin* | *mingw* )
|
||||
+ *cygwin* | *msys* | *mingw* )
|
||||
if test "$build_libtool_libs" != yes; then
|
||||
wrappers_required=no
|
||||
fi
|
||||
@@ -8029,14 +8029,14 @@ EOF
|
||||
esac
|
||||
# test for cygwin because mv fails w/o .exe extensions
|
||||
case $host in
|
||||
- *cygwin*)
|
||||
+ *cygwin* | *msys*)
|
||||
exeext=.exe
|
||||
func_stripname '' '.exe' "$outputname"
|
||||
outputname=$func_stripname_result ;;
|
||||
*) exeext= ;;
|
||||
esac
|
||||
case $host in
|
||||
- *cygwin* | *mingw* )
|
||||
+ *cygwin* | *msys* | *mingw* )
|
||||
func_dirname_and_basename "$output" "" "."
|
||||
output_name=$func_basename_result
|
||||
output_path=$func_dirname_result
|
||||
@@ -8343,7 +8343,7 @@ EOF
|
||||
# tests/bindir.at for full details.
|
||||
tdlname=$dlname
|
||||
case $host,$output,$installed,$module,$dlname in
|
||||
- *cygwin*,*lai,yes,no,*.dll | *mingw*,*lai,yes,no,*.dll | *cegcc*,*lai,yes,no,*.dll)
|
||||
+ *cygwin*,*lai,yes,no,*.dll | *msys*,*lai,yes,no,*.dll | *mingw*,*lai,yes,no,*.dll | *cegcc*,*lai,yes,no,*.dll)
|
||||
# If a -bindir argument was supplied, place the dll there.
|
||||
if test "x$bindir" != x ;
|
||||
then
|
||||
diff --git a/ltoptions.m4 b/ltoptions.m4
|
||||
index 5ef12ce..5e7bc34 100644
|
||||
--- a/ltoptions.m4
|
||||
+++ b/ltoptions.m4
|
||||
@@ -126,7 +126,7 @@ LT_OPTION_DEFINE([LT_INIT], [win32-dll],
|
||||
[enable_win32_dll=yes
|
||||
|
||||
case $host in
|
||||
-*-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-cegcc*)
|
||||
+*-*-cygwin* | *-*-msys* | *-*-mingw* | *-*-pw32* | *-*-cegcc*)
|
||||
AC_CHECK_TOOL(AS, as, false)
|
||||
AC_CHECK_TOOL(DLLTOOL, dlltool, false)
|
||||
AC_CHECK_TOOL(OBJDUMP, objdump, false)
|
||||
diff --git a/newlib/configure b/newlib/configure
|
||||
index 0b6ec15..d3171b4 100755
|
||||
--- a/newlib/configure
|
||||
+++ b/newlib/configure
|
||||
@@ -4269,7 +4269,7 @@ else
|
||||
fi
|
||||
|
||||
|
||||
-ac_ext=c
|
||||
+:cn
|
||||
ac_cpp='$CPP $CPPFLAGS'
|
||||
ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
|
||||
ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
|
||||
diff --git a/newlib/configure.host b/newlib/configure.host
|
||||
index 32d1436..4e4c393 100644
|
||||
--- a/newlib/configure.host
|
||||
+++ b/newlib/configure.host
|
||||
@@ -194,7 +194,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*)
|
||||
;;
|
||||
*)
|
||||
mach_add_setjmp=true
|
||||
@@ -399,7 +399,7 @@ fi
|
||||
|
||||
if [ "x${newlib_mb}" = "x" ]; then
|
||||
case "${host}" in
|
||||
- *-*-cygwin*)
|
||||
+ *-*-cygwin*|*-*-msys*)
|
||||
newlib_mb=yes
|
||||
;;
|
||||
esac
|
||||
@@ -418,7 +418,7 @@ fi
|
||||
# THIS TABLE IS ALPHA SORTED. KEEP IT THAT WAY.
|
||||
|
||||
case "${host}" in
|
||||
- *-*-cygwin*)
|
||||
+ *-*-cygwin* | *-*-msys*)
|
||||
posix_dir=posix
|
||||
xdr_dir=xdr
|
||||
;;
|
||||
@@ -578,7 +578,7 @@ esac
|
||||
# THIS TABLE IS ALPHA SORTED. KEEP IT THAT WAY.
|
||||
|
||||
case "${host}" in
|
||||
- *-*-cygwin*)
|
||||
+ *-*-cygwin* | *-*-msys*)
|
||||
test -z "$cygwin_srcdir" && cygwin_srcdir="${abs_newlib_basedir}/../winsup/cygwin"
|
||||
export cygwin_srcdir
|
||||
default_newlib_io_c99_formats="yes"
|
||||
@ -0,0 +1,26 @@
|
||||
From 4fdf75c097dde04f825e2a8a433d28f7cf54e3ae 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
|
||||
|
||||
Cygwin's speclib doesn't handle dashes or dots. However, we are about to
|
||||
rename the output file name from `cygwin1.dll` to `msys-2.0.dll`.
|
||||
|
||||
Let's preemptively fix up all the import libraries that would link
|
||||
against `msys_2_0.dll` to correctly link against `msys-2.0.dll` instead.
|
||||
---
|
||||
winsup/cygwin/scripts/speclib | 1 +
|
||||
1 file changed, 1 insertion(+)
|
||||
|
||||
diff --git a/winsup/cygwin/scripts/speclib b/winsup/cygwin/scripts/speclib
|
||||
index e6d4d8e..4dcadcb 100755
|
||||
--- a/winsup/cygwin/scripts/speclib
|
||||
+++ b/winsup/cygwin/scripts/speclib
|
||||
@@ -38,6 +38,7 @@ while (<$nm_fd>) {
|
||||
study;
|
||||
if (/ I _?(.*)_dll_iname/o) {
|
||||
$dllname = $1;
|
||||
+ $dllname =~ s/_2_0/-2.0/;
|
||||
} else {
|
||||
my ($file, $member, $symbol) = m%^([^:]*):([^:]*(?=:))?.* T (.*)%o;
|
||||
next if !defined($symbol) || $symbol =~ $exclude_regex;
|
||||
1265
msys2-runtime-3.4/0003-Rename-dll-from-cygwin-to-msys.patch
Normal file
1265
msys2-runtime-3.4/0003-Rename-dll-from-cygwin-to-msys.patch
Normal file
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,192 @@
|
||||
From ba290ba7180fa545ed76df92c7ada1d4bae77d67 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
|
||||
Subject: [PATCH 05/N] Add functionality for changing OS name via MSYSTEM
|
||||
environment variables.
|
||||
|
||||
---
|
||||
winsup/cygserver/cygserver-config | 4 ++--
|
||||
winsup/cygwin/environ.cc | 36 +++++++++++++++++++++++++----
|
||||
winsup/cygwin/include/sys/utsname.h | 2 +-
|
||||
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
|
||||
--- a/winsup/cygserver/cygserver-config
|
||||
+++ b/winsup/cygserver/cygserver-config
|
||||
@@ -86,7 +86,7 @@ done
|
||||
|
||||
# Check if running on NT
|
||||
_sys="`uname`"
|
||||
-_nt=`expr "${_sys}" : "CYGWIN_NT"`
|
||||
+_nt=`expr "${_sys}" : "MSYS_NT"`
|
||||
|
||||
# Check for running cygserver processes first.
|
||||
if ps -ef | grep -v grep | grep -q ${service_name}
|
||||
@@ -178,7 +178,7 @@ then
|
||||
echo "Do you want to install cygserver as service?"
|
||||
if request "(Say \"no\" if it's already installed as service)"
|
||||
then
|
||||
- if ! cygrunsrv -I ${service_name} -d "CYGWIN cygserver" -p /usr/sbin/cygserver
|
||||
+ if ! cygrunsrv -I ${service_name} -d "MSYS cygserver" -p /usr/sbin/cygserver
|
||||
then
|
||||
echo
|
||||
echo "Installation of cygserver as service failed. Please check the"
|
||||
diff --git a/winsup/cygwin/environ.cc b/winsup/cygwin/environ.cc
|
||||
index 25be7a7..568bb34 100644
|
||||
--- a/winsup/cygwin/environ.cc
|
||||
+++ b/winsup/cygwin/environ.cc
|
||||
@@ -191,7 +191,11 @@ parse_options (const char *inbuf)
|
||||
if (export_settings)
|
||||
{
|
||||
debug_printf ("%s", newbuf + 1);
|
||||
+#ifdef __MSYS__
|
||||
+ setenv ("MSYS", newbuf + 1, 1);
|
||||
+#else
|
||||
setenv ("CYGWIN", newbuf + 1, 1);
|
||||
+#endif
|
||||
}
|
||||
return;
|
||||
}
|
||||
@@ -650,7 +654,7 @@ _addenv (const char *name, const char *value, int overwrite)
|
||||
win_env *spenv;
|
||||
if ((spenv = getwinenv (envhere)))
|
||||
spenv->add_cache (value);
|
||||
- if (strcmp (name, "CYGWIN") == 0)
|
||||
+ if (strcmp (name, "MSYS") == 0)
|
||||
parse_options (value);
|
||||
|
||||
return 0;
|
||||
@@ -753,6 +757,9 @@ static struct renv {
|
||||
} renv_arr[] = {
|
||||
{ NL("COMMONPROGRAMFILES=") }, // 0
|
||||
{ NL("COMSPEC=") },
|
||||
+#ifdef __MSYS__
|
||||
+ { NL("MSYSTEM=") }, // 2
|
||||
+#endif /* __MSYS__ */
|
||||
{ NL("PATH=") }, // 2
|
||||
{ NL("PROGRAMFILES=") },
|
||||
{ NL("SYSTEMDRIVE=") }, // 4
|
||||
@@ -764,10 +771,21 @@ static struct renv {
|
||||
#define RENV_SIZE (sizeof (renv_arr) / sizeof (renv_arr[0]))
|
||||
|
||||
/* Set of first characters of the above list of variables. */
|
||||
-static const char idx_arr[] = "CPSTW";
|
||||
+static const char idx_arr[] =
|
||||
+#ifdef __MSYS__
|
||||
+ "CMPSTW";
|
||||
+#else
|
||||
+ "CPSTW";
|
||||
+#endif
|
||||
/* Index into renv_arr at which the variables with this specific character
|
||||
starts. */
|
||||
-static const int start_at[] = { 0, 2, 4, 6, 8 };
|
||||
+static const int start_at[] = {
|
||||
+#ifdef __MSYS__
|
||||
+ 0, 2, 3, 5, 7, 9
|
||||
+#else
|
||||
+ 0, 2, 4, 6, 8
|
||||
+#endif
|
||||
+ };
|
||||
|
||||
/* Turn environment variable part of a=b string into uppercase - for some
|
||||
environment variables only. */
|
||||
@@ -834,7 +852,11 @@ environ_init (char **envp, int envc)
|
||||
environ = envp;
|
||||
if (envp_passed_in)
|
||||
{
|
||||
+#ifdef __MSYS__
|
||||
+ p = getenv ("MSYS");
|
||||
+#else
|
||||
p = getenv ("CYGWIN");
|
||||
+#endif
|
||||
if (p)
|
||||
parse_options (p);
|
||||
}
|
||||
@@ -881,8 +903,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;
|
||||
+#ifdef __MSYS__
|
||||
+ else if (*newp == 'M' && strncmp (newp, "MSYS=", 5) == 0)
|
||||
+ parse_options (newp + 5);
|
||||
+#else
|
||||
else if (*newp == 'C' && strncmp (newp, "CYGWIN=", 7) == 0)
|
||||
parse_options (newp + 7);
|
||||
+#endif
|
||||
if (*eq && posify)
|
||||
posify_maybe (envp + i, *++eq ? eq : --eq, tmpbuf);
|
||||
debug_printf ("%p: %s", envp[i], envp[i]);
|
||||
@@ -951,12 +978,13 @@ struct spenv
|
||||
static NO_COPY spenv spenvs[] =
|
||||
{
|
||||
#ifdef DEBUGGING
|
||||
- {NL ("CYGWIN_DEBUG="), false, true, NULL},
|
||||
+ {NL ("MSYS_DEBUG="), false, true, NULL},
|
||||
#endif
|
||||
{NL ("HOMEDRIVE="), false, false, &cygheap_user::env_homedrive},
|
||||
{NL ("HOMEPATH="), false, false, &cygheap_user::env_homepath},
|
||||
{NL ("LOGONSERVER="), false, false, &cygheap_user::env_logsrv},
|
||||
{NL ("PATH="), false, true, NULL},
|
||||
+ {NL ("MSYSTEM="), true, true, NULL},
|
||||
{NL ("SYSTEMDRIVE="), false, true, NULL},
|
||||
{NL ("SYSTEMROOT="), true, true, &cygheap_user::env_systemroot},
|
||||
{NL ("USERDOMAIN="), false, false, &cygheap_user::env_domain},
|
||||
diff --git a/winsup/cygwin/include/sys/utsname.h b/winsup/cygwin/include/sys/utsname.h
|
||||
index d6b3be9..730cb73 100644
|
||||
--- a/winsup/cygwin/include/sys/utsname.h
|
||||
+++ b/winsup/cygwin/include/sys/utsname.h
|
||||
@@ -17,7 +17,7 @@ extern "C" {
|
||||
|
||||
struct utsname
|
||||
{
|
||||
- char sysname[_UTSNAME_LENGTH];
|
||||
+ char sysname[_UTSNAME_LENGTH + 1];
|
||||
char nodename[_UTSNAME_LENGTH];
|
||||
char release[_UTSNAME_LENGTH];
|
||||
char version[_UTSNAME_LENGTH];
|
||||
diff --git a/winsup/cygwin/uname.cc b/winsup/cygwin/uname.cc
|
||||
index dd41601..0d0c5aa 100644
|
||||
--- a/winsup/cygwin/uname.cc
|
||||
+++ b/winsup/cygwin/uname.cc
|
||||
@@ -36,7 +36,12 @@ uname_x (struct utsname *name)
|
||||
|
||||
memset (name, 0, sizeof (*name));
|
||||
/* sysname */
|
||||
- __small_sprintf (name->sysname, "CYGWIN_%s-%u",
|
||||
+ char* msystem = getenv("MSYSTEM");
|
||||
+ 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",
|
||||
+ msystem_sysname,
|
||||
wincap.osname (), wincap.build_number ());
|
||||
/* nodename */
|
||||
memset (buf, 0, sizeof buf);
|
||||
@@ -88,7 +93,7 @@ uname_x (struct utsname *name)
|
||||
/* Old entrypoint for applications up to API 334 */
|
||||
struct old_utsname
|
||||
{
|
||||
- char sysname[20];
|
||||
+ char sysname[21];
|
||||
char nodename[20];
|
||||
char release[20];
|
||||
char version[20];
|
||||
@@ -102,7 +107,15 @@ uname (struct utsname *in_name)
|
||||
__try
|
||||
{
|
||||
memset (name, 0, sizeof (*name));
|
||||
+#ifdef __MSYS__
|
||||
+ char* msystem = getenv("MSYSTEM");
|
||||
+ 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
|
||||
|
||||
/* Computer name */
|
||||
cygwin_gethostname (name->nodename, sizeof (name->nodename) - 1);
|
||||
@ -0,0 +1,398 @@
|
||||
From f814d1890b61e83b7d51780d0fe2eb09875d6f0d 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
|
||||
Subject: [PATCH 06/N] - Move root to /usr. - Change sorting mount points. -
|
||||
By default mount without ACLs. - Can read /etc/fstab with short mount point
|
||||
format.
|
||||
|
||||
---
|
||||
winsup/cygwin/local_includes/mount.h | 3 +-
|
||||
winsup/cygwin/mm/cygheap.cc | 12 +-
|
||||
winsup/cygwin/mount.cc | 185 +++++++++++++++++++++++----
|
||||
winsup/cygwin/uinfo.cc | 2 +-
|
||||
4 files changed, 174 insertions(+), 28 deletions(-)
|
||||
|
||||
diff --git a/winsup/cygwin/local_includes/mount.h b/winsup/cygwin/local_includes/mount.h
|
||||
index 5bb84b9..cb48a68 100644
|
||||
--- a/winsup/cygwin/local_includes/mount.h
|
||||
+++ b/winsup/cygwin/local_includes/mount.h
|
||||
@@ -170,7 +170,6 @@ class mount_info
|
||||
mount_item mount[MAX_MOUNTS];
|
||||
|
||||
static bool got_usr_bin;
|
||||
- static bool got_usr_lib;
|
||||
static int root_idx;
|
||||
|
||||
/* cygdrive_prefix is used as the root of the path automatically
|
||||
@@ -182,6 +181,8 @@ class mount_info
|
||||
private:
|
||||
int posix_sorted[MAX_MOUNTS];
|
||||
int native_sorted[MAX_MOUNTS];
|
||||
+ int longest_posix_sorted[MAX_MOUNTS];
|
||||
+ int shortest_native_sorted[MAX_MOUNTS];
|
||||
|
||||
public:
|
||||
void init (bool);
|
||||
diff --git a/winsup/cygwin/mm/cygheap.cc b/winsup/cygwin/mm/cygheap.cc
|
||||
index 4fda29d..b1d5acb 100644
|
||||
--- a/winsup/cygwin/mm/cygheap.cc
|
||||
+++ b/winsup/cygwin/mm/cygheap.cc
|
||||
@@ -218,14 +218,22 @@ init_cygheap::init_installation_root ()
|
||||
|
||||
/* Strip off last path component ("\\cygwin1.dll") */
|
||||
PWCHAR w = wcsrchr (installation_root_buf, L'\\');
|
||||
+#ifdef __MSYS__
|
||||
+ /* Back two folders to get root as we have all stuff in usr subfolder */
|
||||
+ for (int i=1; i >=0; --i)
|
||||
+ {
|
||||
+#endif
|
||||
if (w)
|
||||
{
|
||||
*w = L'\0';
|
||||
w = wcsrchr (installation_root_buf, L'\\');
|
||||
}
|
||||
if (!w)
|
||||
- api_fatal ("Can't initialize Cygwin installation root dir.\n"
|
||||
+ api_fatal ("Can't initialize MSYS2 installation root dir.\n"
|
||||
"Invalid DLL path");
|
||||
+#ifdef __MSYS__
|
||||
+ }
|
||||
+#endif
|
||||
|
||||
/* Copy result into installation_dir before stripping off "bin" dir and
|
||||
revert to Win32 path. This path is added to the Windows environment
|
||||
@@ -250,6 +258,7 @@ init_cygheap::init_installation_root ()
|
||||
RtlInitUnicodeString (&installation_root, installation_root_buf);
|
||||
RtlInitUnicodeString (&installation_dir, installation_dir_buf);
|
||||
|
||||
+#ifndef __MSYS__
|
||||
for (int i = 1; i >= 0; --i)
|
||||
{
|
||||
reg_key r (i, KEY_WRITE, _WIDE (CYGWIN_INFO_INSTALLATIONS_NAME),
|
||||
@@ -258,6 +267,7 @@ init_cygheap::init_installation_root ()
|
||||
installation_root_buf)))
|
||||
break;
|
||||
}
|
||||
+#endif
|
||||
}
|
||||
|
||||
/* Initialize bucket_val. The value is the max size of a block
|
||||
diff --git a/winsup/cygwin/mount.cc b/winsup/cygwin/mount.cc
|
||||
index 14c1ac7..939578a 100644
|
||||
--- a/winsup/cygwin/mount.cc
|
||||
+++ b/winsup/cygwin/mount.cc
|
||||
@@ -39,7 +39,6 @@ details. */
|
||||
(path_prefix_p (proc, (path), proc_len, false))
|
||||
|
||||
bool NO_COPY mount_info::got_usr_bin;
|
||||
-bool NO_COPY mount_info::got_usr_lib;
|
||||
int NO_COPY mount_info::root_idx = -1;
|
||||
|
||||
/* is_native_path: Return non-zero if PATH starts with \??\[a-zA-Z] or
|
||||
@@ -354,7 +353,6 @@ fs_info::update (PUNICODE_STRING upath, HANDLE in_vol)
|
||||
#define MINIMAL_WIN_NTFS_FLAGS (FILE_CASE_SENSITIVE_SEARCH \
|
||||
| FILE_CASE_PRESERVED_NAMES \
|
||||
| FILE_UNICODE_ON_DISK \
|
||||
- | FILE_PERSISTENT_ACLS \
|
||||
| FILE_FILE_COMPRESSION \
|
||||
| FILE_VOLUME_QUOTAS \
|
||||
| FILE_SUPPORTS_SPARSE_FILES \
|
||||
@@ -495,13 +493,13 @@ mount_info::create_root_entry (const PWCHAR root)
|
||||
sys_wcstombs (native_root, PATH_MAX, root);
|
||||
assert (*native_root != '\0');
|
||||
if (add_item (native_root, "/",
|
||||
- MOUNT_SYSTEM | MOUNT_IMMUTABLE | MOUNT_AUTOMATIC)
|
||||
+ MOUNT_SYSTEM | MOUNT_IMMUTABLE | MOUNT_AUTOMATIC | MOUNT_NOACL)
|
||||
< 0)
|
||||
api_fatal ("add_item (\"%s\", \"/\", ...) failed, errno %d", native_root, errno);
|
||||
/* Create a default cygdrive entry. Note that this is a user entry.
|
||||
This allows to override it with mount, unless the sysadmin created
|
||||
a cygdrive entry in /etc/fstab. */
|
||||
- cygdrive_flags = MOUNT_NOPOSIX | MOUNT_CYGDRIVE;
|
||||
+ cygdrive_flags = MOUNT_NOPOSIX | MOUNT_CYGDRIVE | MOUNT_NOACL;
|
||||
strcpy (cygdrive, CYGWIN_INFO_CYGDRIVE_DEFAULT_PREFIX "/");
|
||||
cygdrive_len = strlen (cygdrive);
|
||||
}
|
||||
@@ -521,22 +519,14 @@ mount_info::init (bool user_init)
|
||||
pathend = wcpcpy (pathend, L"\\etc\\fstab");
|
||||
from_fstab (user_init, path, pathend);
|
||||
|
||||
- if (!user_init && (!got_usr_bin || !got_usr_lib))
|
||||
+ if (!user_init && !got_usr_bin)
|
||||
{
|
||||
char native[PATH_MAX];
|
||||
if (root_idx < 0)
|
||||
- api_fatal ("root_idx %d, user_shared magic %y, nmounts %d", root_idx, user_shared->version, nmounts);
|
||||
+ api_fatal ("root_idx %d, user_shared magic %y, nmounts %d", root_idx, user_shared->version, nmounts);
|
||||
char *p = stpcpy (native, mount[root_idx].native_path);
|
||||
- if (!got_usr_bin)
|
||||
- {
|
||||
- stpcpy (p, "\\bin");
|
||||
- add_item (native, "/usr/bin", MOUNT_SYSTEM | MOUNT_AUTOMATIC);
|
||||
- }
|
||||
- if (!got_usr_lib)
|
||||
- {
|
||||
- stpcpy (p, "\\lib");
|
||||
- add_item (native, "/usr/lib", MOUNT_SYSTEM | MOUNT_AUTOMATIC);
|
||||
- }
|
||||
+ stpcpy (p, "\\usr\\bin");
|
||||
+ add_item (native, "/bin", MOUNT_SYSTEM | MOUNT_AUTOMATIC | MOUNT_NOACL);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -617,6 +607,7 @@ mount_info::conv_to_win32_path (const char *src_path, char *dst, device& dev,
|
||||
/* See if this is a cygwin "device" */
|
||||
if (win32_device_name (src_path, dst, dev))
|
||||
{
|
||||
+ debug_printf ("win32_device_name (%s)", src_path);
|
||||
*flags = 0;
|
||||
rc = 0;
|
||||
goto out_no_chroot_check;
|
||||
@@ -647,6 +638,7 @@ mount_info::conv_to_win32_path (const char *src_path, char *dst, device& dev,
|
||||
}
|
||||
if (isproc (src_path))
|
||||
{
|
||||
+ debug_printf ("isproc (%s)", src_path);
|
||||
dev = *proc_dev;
|
||||
dev = fhandler_proc::get_proc_fhandler (src_path);
|
||||
if (dev == FH_NADA)
|
||||
@@ -668,6 +660,7 @@ mount_info::conv_to_win32_path (const char *src_path, char *dst, device& dev,
|
||||
off the prefix and transform it into an MS-DOS path. */
|
||||
else if (iscygdrive (src_path))
|
||||
{
|
||||
+ debug_printf ("iscygdrive (%s) mount_table->cygdrive %s", src_path, mount_table->cygdrive);
|
||||
int n = mount_table->cygdrive_len - 1;
|
||||
int unit;
|
||||
|
||||
@@ -679,11 +672,15 @@ mount_info::conv_to_win32_path (const char *src_path, char *dst, device& dev,
|
||||
}
|
||||
else if (cygdrive_win32_path (src_path, dst, unit))
|
||||
{
|
||||
+ debug_printf ("cygdrive_win32_path (%s)", src_path);
|
||||
*flags = cygdrive_flags;
|
||||
goto out;
|
||||
}
|
||||
else if (mount_table->cygdrive_len > 1)
|
||||
- return ENOENT;
|
||||
+ {
|
||||
+ debug_printf ("mount_table->cygdrive_len > 1 (%s)", src_path);
|
||||
+ return ENOENT;
|
||||
+ }
|
||||
}
|
||||
|
||||
int chroot_pathlen;
|
||||
@@ -694,7 +691,9 @@ mount_info::conv_to_win32_path (const char *src_path, char *dst, device& dev,
|
||||
const char *path;
|
||||
int len;
|
||||
|
||||
- mi = mount + posix_sorted[i];
|
||||
+ mi = mount + shortest_native_sorted[i];
|
||||
+ debug_printf (" mount[%d] .. checking %s -> %s ", i, mi->posix_path, mi->native_path);
|
||||
+
|
||||
if (!cygheap->root.exists ()
|
||||
|| (mi->posix_pathlen == 1 && mi->posix_path[0] == '/'))
|
||||
{
|
||||
@@ -934,7 +933,8 @@ mount_info::conv_to_posix_path (const char *src_path, char *posix_path,
|
||||
int pathbuflen = tail - pathbuf;
|
||||
for (int i = 0; i < nmounts; ++i)
|
||||
{
|
||||
- mount_item &mi = mount[native_sorted[i]];
|
||||
+ mount_item &mi = mount[longest_posix_sorted[i]];
|
||||
+ debug_printf (" mount[%d] .. checking %s -> %s ", i, mi.posix_path, mi.native_path);
|
||||
if (!path_prefix_p (mi.native_path, pathbuf, mi.native_pathlen,
|
||||
mi.flags & MOUNT_NOPOSIX))
|
||||
continue;
|
||||
@@ -1147,8 +1147,17 @@ mount_info::from_fstab_line (char *line, bool user)
|
||||
if (!*c)
|
||||
return true;
|
||||
cend = find_ws (c);
|
||||
- *cend = '\0';
|
||||
posix_path = conv_fstab_spaces (c);
|
||||
+ if (!*cend)
|
||||
+ {
|
||||
+ unsigned mount_flags = MOUNT_SYSTEM | MOUNT_NOPOSIX | MOUNT_NOACL;
|
||||
+
|
||||
+ int res = mount_table->add_item (native_path, posix_path, mount_flags);
|
||||
+ if (res && get_errno () == EMFILE)
|
||||
+ return false;
|
||||
+ return true;
|
||||
+ }
|
||||
+ *cend = '\0';
|
||||
/* Third field: FS type. */
|
||||
c = skip_ws (cend + 1);
|
||||
if (!*c)
|
||||
@@ -1377,16 +1386,145 @@ sort_by_native_name (const void *a, const void *b)
|
||||
return res;
|
||||
}
|
||||
|
||||
+/* sort_by_longest_posix_name: qsort callback to sort the mount entries.
|
||||
+ Sort user mounts ahead of system mounts to the same POSIX path. */
|
||||
+/* FIXME: should the user should be able to choose whether to
|
||||
+ prefer user or system mounts??? */
|
||||
+static int
|
||||
+sort_by_longest_posix_name (const void *a, const void *b)
|
||||
+{
|
||||
+ mount_item *ap = mounts_for_sort + (*((int*) a));
|
||||
+ mount_item *bp = mounts_for_sort + (*((int*) b));
|
||||
+
|
||||
+ /* Base weighting on the conversion that would give the longest
|
||||
+ posix path. */
|
||||
+ ssize_t alen = (ssize_t) strlen (ap->posix_path) - (ssize_t) strlen (ap->native_path);
|
||||
+ ssize_t blen = (ssize_t) strlen (bp->posix_path) - (ssize_t) strlen (bp->native_path);
|
||||
+
|
||||
+ int res = blen - alen;
|
||||
+
|
||||
+ if (res)
|
||||
+ return res; /* Path lengths differed */
|
||||
+
|
||||
+ /* The two paths were the same length, so just determine normal
|
||||
+ lexical sorted order. */
|
||||
+ res = strcmp (ap->posix_path, bp->posix_path);
|
||||
+
|
||||
+ if (res == 0)
|
||||
+ {
|
||||
+ /* need to select between user and system mount to same POSIX path */
|
||||
+ if (!(bp->flags & MOUNT_SYSTEM)) /* user mount */
|
||||
+ return 1;
|
||||
+ else
|
||||
+ return -1;
|
||||
+ }
|
||||
+
|
||||
+ return res;
|
||||
+}
|
||||
+
|
||||
+/* sort_by_shortest_native_name: qsort callback to sort the mount entries.
|
||||
+ Sort user mounts ahead of system mounts to the same POSIX path. */
|
||||
+/* FIXME: should the user should be able to choose whether to
|
||||
+ prefer user or system mounts??? */
|
||||
+static int
|
||||
+sort_by_shortest_native_name (const void *a, const void *b)
|
||||
+{
|
||||
+ mount_item *ap = mounts_for_sort + (*((int*) a));
|
||||
+ mount_item *bp = mounts_for_sort + (*((int*) b));
|
||||
+
|
||||
+ /* Base weighting on the conversion that would give the shortest
|
||||
+ native path. */
|
||||
+ ssize_t alen = (ssize_t) strlen (ap->native_path);
|
||||
+ ssize_t blen = (ssize_t) strlen (bp->native_path);
|
||||
+
|
||||
+ int res = alen - blen;
|
||||
+
|
||||
+ if (res)
|
||||
+ return res; /* Path lengths differed */
|
||||
+
|
||||
+ /* The two paths were the same length, so just determine normal
|
||||
+ lexical sorted order. */
|
||||
+ res = strcmp (ap->native_path, bp->native_path);
|
||||
+
|
||||
+ if (res == 0)
|
||||
+ {
|
||||
+ /* need to select between user and system mount to same POSIX path */
|
||||
+ if (!(bp->flags & MOUNT_SYSTEM)) /* user mount */
|
||||
+ return 1;
|
||||
+ else
|
||||
+ return -1;
|
||||
+ }
|
||||
+
|
||||
+ return res;
|
||||
+}
|
||||
+
|
||||
+static int
|
||||
+sort_posix_subdirs_before_parents (const void *a, const void *b)
|
||||
+{
|
||||
+ mount_item *ap = mounts_for_sort + (*((int*) a));
|
||||
+ mount_item *bp = mounts_for_sort + (*((int*) b));
|
||||
+
|
||||
+ if (ap->posix_pathlen > bp->posix_pathlen)
|
||||
+ {
|
||||
+ if (!memcmp (bp->posix_path, ap->posix_path, bp->posix_pathlen))
|
||||
+ {
|
||||
+ // bp is a subdir of ap (bp must be moved in-front)
|
||||
+ return -1;
|
||||
+ }
|
||||
+ }
|
||||
+ else if (ap->posix_pathlen < bp->posix_pathlen)
|
||||
+ {
|
||||
+ if (!memcmp (ap->posix_path, bp->posix_path, ap->posix_pathlen))
|
||||
+ {
|
||||
+ // ap is a subdir of bp (good as we are)
|
||||
+ return 1;
|
||||
+ }
|
||||
+ }
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+#define DISABLE_NEW_STUFF 0
|
||||
+#define ONLY_USE_NEW_STUFF 1
|
||||
+
|
||||
void
|
||||
mount_info::sort ()
|
||||
{
|
||||
for (int i = 0; i < nmounts; i++)
|
||||
- native_sorted[i] = posix_sorted[i] = i;
|
||||
+ native_sorted[i] = posix_sorted[i] = shortest_native_sorted[i] = longest_posix_sorted[i] = i;
|
||||
/* Sort them into reverse length order, otherwise we won't
|
||||
be able to look for /foo in /. */
|
||||
mounts_for_sort = mount; /* ouch. */
|
||||
qsort (posix_sorted, nmounts, sizeof (posix_sorted[0]), sort_by_posix_name);
|
||||
qsort (native_sorted, nmounts, sizeof (native_sorted[0]), sort_by_native_name);
|
||||
+ qsort (longest_posix_sorted, nmounts, sizeof (longest_posix_sorted[0]), sort_by_longest_posix_name);
|
||||
+ qsort (shortest_native_sorted, nmounts, sizeof (shortest_native_sorted[0]), sort_by_shortest_native_name);
|
||||
+ qsort (shortest_native_sorted, nmounts, sizeof (shortest_native_sorted[0]), sort_posix_subdirs_before_parents);
|
||||
+ /* Disabling my new crap. */
|
||||
+ #if DISABLE_NEW_STUFF
|
||||
+ for (int i = 0; i < nmounts; i++)
|
||||
+ {
|
||||
+ longest_posix_sorted[i] = native_sorted[i];
|
||||
+ shortest_native_sorted[i] = posix_sorted[i];
|
||||
+ }
|
||||
+ #else
|
||||
+ #if ONLY_USE_NEW_STUFF
|
||||
+ for (int i = 0; i < nmounts; i++)
|
||||
+ {
|
||||
+ native_sorted[i] = longest_posix_sorted[i];
|
||||
+ posix_sorted[i] = shortest_native_sorted[i];
|
||||
+ }
|
||||
+ #endif
|
||||
+ #endif
|
||||
+ for (int i = 0; i < nmounts; i++)
|
||||
+ {
|
||||
+ mount_item *mi = mount + shortest_native_sorted[i];
|
||||
+ debug_printf ("shortest_native_sorted (subdirs before parents)[%d] %12s %12s", i, mi->native_path, mi->posix_path);
|
||||
+ }
|
||||
+ for (int i = 0; i < nmounts; i++)
|
||||
+ {
|
||||
+ mount_item *mi = mount + longest_posix_sorted[i];
|
||||
+ debug_printf ("longest_posix_sorted[%d] %12s %12s", i, mi->native_path, mi->posix_path);
|
||||
+ }
|
||||
}
|
||||
|
||||
/* Add an entry to the mount table.
|
||||
@@ -1477,12 +1615,9 @@ mount_info::add_item (const char *native, const char *posix,
|
||||
if (i == nmounts)
|
||||
nmounts++;
|
||||
|
||||
- if (strcmp (posixtmp, "/usr/bin") == 0)
|
||||
+ if (strcmp (posixtmp, "/bin") == 0)
|
||||
got_usr_bin = true;
|
||||
|
||||
- if (strcmp (posixtmp, "/usr/lib") == 0)
|
||||
- got_usr_lib = true;
|
||||
-
|
||||
if (posixtmp[0] == '/' && posixtmp[1] == '\0' && !(mountflags & MOUNT_CYGDRIVE))
|
||||
root_idx = i;
|
||||
|
||||
diff --git a/winsup/cygwin/uinfo.cc b/winsup/cygwin/uinfo.cc
|
||||
index 6df8c7b..9bbcf1c 100644
|
||||
--- a/winsup/cygwin/uinfo.cc
|
||||
+++ b/winsup/cygwin/uinfo.cc
|
||||
@@ -2678,7 +2678,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,
|
||||
- shell ?: "/bin/bash");
|
||||
+ shell ?: "/usr/bin/bash");
|
||||
if (gecos)
|
||||
free (gecos);
|
||||
if (home)
|
||||
@ -0,0 +1,234 @@
|
||||
From e482cfa56a41a66f1a13fea5221dcaa52eaa8765 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
|
||||
Subject: [PATCH 07/N] Instead of creating Cygwin symlinks, use deep copy by
|
||||
default
|
||||
|
||||
The new `winsymlinks` mode `deepcopy` (which is made the default) lets
|
||||
calls to `symlink()` create (deep) copies of the source file/directory.
|
||||
|
||||
This is necessary because unlike Cygwin, MSYS2 does not try to be its
|
||||
own little ecosystem that lives its life separate from regular Win32
|
||||
programs: the latter have _no idea_ about Cygwin-emulated symbolic links
|
||||
(i.e. system files whose contents start with `!<symlink>\xff\xfe` and
|
||||
the remainder consists of the NUL-terminated, UTF-16LE-encoded symlink
|
||||
target).
|
||||
|
||||
To support Cygwin-style symlinks, the new mode `sysfile` is introduced.
|
||||
|
||||
Co-authored-by: Johannes Schindelin <johannes.schindelin@gmx.de>
|
||||
---
|
||||
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 568bb34..02b47ad 100644
|
||||
--- a/winsup/cygwin/environ.cc
|
||||
+++ b/winsup/cygwin/environ.cc
|
||||
@@ -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;
|
||||
+ else if (ascii_strncasematch (buf, "deepcopy", 8))
|
||||
+ allow_winsymlinks = WSYM_deepcopy;
|
||||
+ else
|
||||
+ allow_winsymlinks = WSYM_sysfile;
|
||||
}
|
||||
|
||||
/* 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 aef4a68..cd907b7 100644
|
||||
--- a/winsup/cygwin/globals.cc
|
||||
+++ b/winsup/cygwin/globals.cc
|
||||
@@ -57,6 +57,7 @@ enum winsym_t
|
||||
WSYM_nativestrict,
|
||||
WSYM_nfs,
|
||||
WSYM_sysfile,
|
||||
+ WSYM_deepcopy
|
||||
};
|
||||
|
||||
exit_states NO_COPY exit_state;
|
||||
@@ -70,7 +71,7 @@ bool ignore_case_with_glob;
|
||||
bool pipe_byte = true; /* Default to byte mode so that C# programs work. */
|
||||
bool reset_com;
|
||||
bool wincmdln;
|
||||
-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 c211395..4a6157d 100644
|
||||
--- a/winsup/cygwin/path.cc
|
||||
+++ b/winsup/cygwin/path.cc
|
||||
@@ -1682,6 +1682,89 @@ conv_path_list (const char *src, char *dst, size_t size,
|
||||
|
||||
/********************** Symbolic Link Support **************************/
|
||||
|
||||
+/*
|
||||
+ Create a deep copy of src as dst, while avoiding descending in origpath.
|
||||
+*/
|
||||
+static int
|
||||
+recursiveCopy (char * src, char * dst, const char * origpath)
|
||||
+{
|
||||
+ WIN32_FIND_DATA dHfile;
|
||||
+ HANDLE dH = INVALID_HANDLE_VALUE;
|
||||
+ BOOL findfiles;
|
||||
+ int srcpos = strlen (src);
|
||||
+ int dstpos = strlen (dst);
|
||||
+ int res = -1;
|
||||
+
|
||||
+ debug_printf("recursiveCopy (%s, %s)", src, dst);
|
||||
+
|
||||
+ /* Create the destination directory */
|
||||
+ if (!CreateDirectoryEx (src, dst, NULL))
|
||||
+ {
|
||||
+ debug_printf("CreateDirectoryEx(%s, %s, 0) failed", src, dst);
|
||||
+ __seterrno ();
|
||||
+ goto done;
|
||||
+ }
|
||||
+ /* Descend into the source directory */
|
||||
+ if (srcpos + 2 >= MAX_PATH || dstpos + 1 >= MAX_PATH)
|
||||
+ {
|
||||
+ set_errno (ENAMETOOLONG);
|
||||
+ goto done;
|
||||
+ }
|
||||
+ strcat (src, "\\*");
|
||||
+ strcat (dst, "\\");
|
||||
+ dH = FindFirstFile (src, &dHfile);
|
||||
+ debug_printf("dHfile(1): %s", dHfile.cFileName);
|
||||
+ findfiles = FindNextFile (dH, &dHfile);
|
||||
+ debug_printf("dHfile(2): %s", dHfile.cFileName);
|
||||
+ findfiles = FindNextFile (dH, &dHfile);
|
||||
+ while (findfiles)
|
||||
+ {
|
||||
+ /* Append the directory item filename to both source and destination */
|
||||
+ int filelen = strlen (dHfile.cFileName);
|
||||
+ debug_printf("dHfile(3): %s", dHfile.cFileName);
|
||||
+ if (srcpos + 1 + filelen >= MAX_PATH ||
|
||||
+ dstpos + 1 + filelen >= MAX_PATH)
|
||||
+ {
|
||||
+ set_errno (ENAMETOOLONG);
|
||||
+ goto done;
|
||||
+ }
|
||||
+ strcpy (&src[srcpos+1], dHfile.cFileName);
|
||||
+ strcpy (&dst[dstpos+1], dHfile.cFileName);
|
||||
+ debug_printf("%s -> %s", src, dst);
|
||||
+ if (dHfile.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)
|
||||
+ {
|
||||
+ /* Recurse into the child directory */
|
||||
+ debug_printf("%s <-> %s", src, origpath);
|
||||
+ if (strcmp (src, origpath)) // avoids endless recursion
|
||||
+ if (recursiveCopy (src, dst, origpath))
|
||||
+ goto done;
|
||||
+ }
|
||||
+ else
|
||||
+ {
|
||||
+ /* Just copy the file */
|
||||
+ if (!CopyFile (src, dst, FALSE))
|
||||
+ {
|
||||
+ __seterrno ();
|
||||
+ goto done;
|
||||
+ }
|
||||
+ }
|
||||
+ findfiles = FindNextFile (dH, &dHfile);
|
||||
+ }
|
||||
+ if (GetLastError() != ERROR_NO_MORE_FILES)
|
||||
+ {
|
||||
+ __seterrno ();
|
||||
+ goto done;
|
||||
+ }
|
||||
+ res = 0;
|
||||
+
|
||||
+done:
|
||||
+
|
||||
+ if (dH != INVALID_HANDLE_VALUE)
|
||||
+ FindClose (dH);
|
||||
+
|
||||
+ return res;
|
||||
+}
|
||||
+
|
||||
/* Create a symlink from FROMPATH to TOPATH. */
|
||||
|
||||
extern "C" int
|
||||
@@ -2219,6 +2302,77 @@ symlink_worker (const char *oldpath, path_conv &win32_newpath, bool isdevice)
|
||||
}
|
||||
else /* wsym_type == WSYM_sysfile */
|
||||
{
|
||||
+ if (wsym_type == WSYM_deepcopy)
|
||||
+ {
|
||||
+ path_conv src_path;
|
||||
+ src_path.check (oldpath, PC_SYM_NOFOLLOW, stat_suffixes);
|
||||
+ if (src_path.error)
|
||||
+ {
|
||||
+ set_errno (src_path.error);
|
||||
+ __leave;
|
||||
+ }
|
||||
+ if (!src_path.isdevice () && !src_path.is_fs_special ())
|
||||
+ {
|
||||
+ /* MSYS copy file instead make symlink */
|
||||
+
|
||||
+ char * real_oldpath;
|
||||
+ if (isabspath (oldpath))
|
||||
+ strcpy (real_oldpath = tp.c_get (), oldpath);
|
||||
+ else
|
||||
+ /* Find the real source path, relative
|
||||
+ to the directory of the destination */
|
||||
+ {
|
||||
+ /* Determine the character position of the last path component */
|
||||
+ const char *newpath = win32_newpath.get_posix();
|
||||
+ int pos = strlen (newpath);
|
||||
+ while (--pos >= 0)
|
||||
+ if (isdirsep (newpath[pos]))
|
||||
+ break;
|
||||
+ /* Append the source path to the directory
|
||||
+ component of the destination */
|
||||
+ if (pos+1+strlen(oldpath) >= MAX_PATH)
|
||||
+ {
|
||||
+ set_errno(ENAMETOOLONG);
|
||||
+ __leave;
|
||||
+ }
|
||||
+ strcpy (real_oldpath = tp.c_get (), newpath);
|
||||
+ strcpy (&real_oldpath[pos+1], oldpath);
|
||||
+ }
|
||||
+
|
||||
+ /* As a MSYS limitation, the source path must exist. */
|
||||
+ path_conv win32_oldpath;
|
||||
+ win32_oldpath.check (real_oldpath, PC_SYM_NOFOLLOW, stat_suffixes);
|
||||
+ if (!win32_oldpath.exists ())
|
||||
+ {
|
||||
+ set_errno (ENOENT);
|
||||
+ __leave;
|
||||
+ }
|
||||
+
|
||||
+ char *w_newpath;
|
||||
+ char *w_oldpath;
|
||||
+ stpcpy (w_newpath = tp.c_get (), win32_newpath.get_win32());
|
||||
+ stpcpy (w_oldpath = tp.c_get (), win32_oldpath.get_win32());
|
||||
+ if (win32_oldpath.isdir())
|
||||
+ {
|
||||
+ char *origpath;
|
||||
+ strcpy (origpath = tp.c_get (), w_oldpath);
|
||||
+ res = recursiveCopy (w_oldpath, w_newpath, origpath);
|
||||
+ }
|
||||
+ else
|
||||
+ {
|
||||
+ if (!CopyFile (w_oldpath, w_newpath, FALSE))
|
||||
+ {
|
||||
+ __seterrno ();
|
||||
+ }
|
||||
+ else
|
||||
+ {
|
||||
+ res = 0;
|
||||
+ }
|
||||
+ }
|
||||
+ __leave;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
/* Default technique creating a symlink. */
|
||||
buf = tp.t_get ();
|
||||
cp = stpcpy (buf, SYMLINK_COOKIE);
|
||||
@ -0,0 +1,36 @@
|
||||
From 21dce32652b4f05908405fdd938af6c0734af91d 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
|
||||
Subject: [PATCH 08/N] Automatically rewrite TERM=msys to TERM=cygwin
|
||||
|
||||
With MSys1, it was necessary to set the TERM variable to "msys". To
|
||||
allow for a smooth transition from MSys1 to MSys2, let's simply handle
|
||||
TERM=msys as if the user had not specified TERM at all and wanted us to
|
||||
use our preferred TERM value.
|
||||
---
|
||||
winsup/cygwin/environ.cc | 11 ++++++++++-
|
||||
1 file changed, 10 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/winsup/cygwin/environ.cc b/winsup/cygwin/environ.cc
|
||||
index 02b47ad..7a4a6ea 100644
|
||||
--- a/winsup/cygwin/environ.cc
|
||||
+++ b/winsup/cygwin/environ.cc
|
||||
@@ -906,7 +906,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)
|
||||
- sawTERM = 1;
|
||||
+ {
|
||||
+ /* backwards compatibility: override TERM=msys by TERM=cygwin */
|
||||
+ if (strcmp (newp + 5, "msys") == 0)
|
||||
+ {
|
||||
+ free(newp);
|
||||
+ i--;
|
||||
+ continue;
|
||||
+ }
|
||||
+ sawTERM = 1;
|
||||
+ }
|
||||
#ifdef __MSYS__
|
||||
else if (*newp == 'M' && strncmp (newp, "MSYS=", 5) == 0)
|
||||
parse_options (newp + 5);
|
||||
@ -0,0 +1,30 @@
|
||||
From a0d3abb609a335fc657ca3e626b57c6395d50d50 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
|
||||
Subject: [PATCH 09/N] Do not convert environment for strace
|
||||
|
||||
Strace is a Windows program so MSYS2 will convert all arguments and environment vars and that makes debugging msys2 software with strace very tricky.
|
||||
---
|
||||
winsup/cygwin/spawn.cc | 4 +++-
|
||||
1 file changed, 3 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/winsup/cygwin/spawn.cc b/winsup/cygwin/spawn.cc
|
||||
index f7af9f7..73e6a00 100644
|
||||
--- a/winsup/cygwin/spawn.cc
|
||||
+++ b/winsup/cygwin/spawn.cc
|
||||
@@ -534,11 +534,13 @@ child_info_spawn::worker (const char *prog_arg, const char *const *argv,
|
||||
bool switch_user = ::cygheap->user.issetuid ()
|
||||
&& (::cygheap->user.saved_uid
|
||||
!= ::cygheap->user.real_uid);
|
||||
+ bool keep_posix = (iscmd (argv[0], "strace.exe")
|
||||
+ || iscmd (argv[0], "strace")) ? true : real_path.iscygexec ();
|
||||
moreinfo->envp = build_env (envp, envblock, moreinfo->envc,
|
||||
real_path.iscygexec (),
|
||||
switch_user ? ::cygheap->user.primary_token ()
|
||||
: NULL,
|
||||
- real_path.iscygexec ());
|
||||
+ keep_posix);
|
||||
if (!moreinfo->envp || !envblock)
|
||||
{
|
||||
set_errno (E2BIG);
|
||||
@ -0,0 +1,57 @@
|
||||
From 6055cf10fa66f74732ec91b4e07e2f8415f2a412 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
|
||||
Subject: [PATCH 10/N] path_conv: special-case root directory to have trailing
|
||||
slash
|
||||
|
||||
When converting `/c/` to `C:\`, the trailing slash is actually really
|
||||
necessary, as `C:` is not an absolute path.
|
||||
|
||||
We must be very careful to do this only for root directories, though. If
|
||||
we kept the trailing slash also for, say, `/y/directory/`, we would run
|
||||
into the following issue: On FAT file systems, the normalized path is
|
||||
used to fake inode numbers. As a result, `Y:\directory\` and
|
||||
`Y:\directory` have different inode numbers!!!
|
||||
|
||||
This would result in very non-obvious symptoms. Back when we were too
|
||||
careless about keeping the trailing slash, it was reported to the Git
|
||||
for Windows project that the `find` and `rm` commands can error out on
|
||||
FAT file systems with very confusing "No such file or directory" errors,
|
||||
for no good reason.
|
||||
|
||||
During the original investigation, Vasil Minkov pointed out in
|
||||
https://github.com/git-for-windows/git/issues/1497#issuecomment-372665870,
|
||||
that this bug had been fixed in Cygwin as early as 1997... and the bug
|
||||
was unfortunately reintroduced into early MSYS2 versions.
|
||||
|
||||
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
|
||||
---
|
||||
winsup/cygwin/path.cc | 7 +++++++
|
||||
1 file changed, 7 insertions(+)
|
||||
|
||||
diff --git a/winsup/cygwin/path.cc b/winsup/cygwin/path.cc
|
||||
index 4a6157d..a84706e 100644
|
||||
--- a/winsup/cygwin/path.cc
|
||||
+++ b/winsup/cygwin/path.cc
|
||||
@@ -709,6 +709,12 @@ path_conv::check (const char *src, unsigned opt,
|
||||
need_directory = 1;
|
||||
*--tail = '\0';
|
||||
}
|
||||
+ /* Special case for "/" must set need_directory, without removing
|
||||
+ trailing slash */
|
||||
+ else if (tail == path_copy + 1 && isslash (tail[-1]))
|
||||
+ {
|
||||
+ need_directory = 1;
|
||||
+ }
|
||||
path_end = tail;
|
||||
|
||||
/* Scan path_copy from right to left looking either for a symlink
|
||||
@@ -1248,6 +1254,7 @@ path_conv::check (const char *src, unsigned opt,
|
||||
cfree (wide_path);
|
||||
wide_path = NULL;
|
||||
}
|
||||
+
|
||||
if (need_directory)
|
||||
{
|
||||
size_t n = strlen (this->path);
|
||||
@ -0,0 +1,77 @@
|
||||
From 8dd6203320a8c33624c7d2e3f0d1d63c6dae3e45 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
|
||||
|
||||
Otherwise if globbing is allowed and we get called from a
|
||||
Windows program, build_argv thinks we've been called from
|
||||
a Cygwin program.
|
||||
---
|
||||
winsup/cygwin/dcrt0.cc | 15 ++++++++-------
|
||||
1 file changed, 8 insertions(+), 7 deletions(-)
|
||||
|
||||
diff --git a/winsup/cygwin/dcrt0.cc b/winsup/cygwin/dcrt0.cc
|
||||
index b40697a..2e6d00a 100644
|
||||
--- a/winsup/cygwin/dcrt0.cc
|
||||
+++ b/winsup/cygwin/dcrt0.cc
|
||||
@@ -154,12 +154,12 @@ isquote (char c)
|
||||
|
||||
/* Step over a run of characters delimited by quotes */
|
||||
static /*__inline*/ char *
|
||||
-quoted (char *cmd, int winshell)
|
||||
+quoted (char *cmd, int winshell, int glob)
|
||||
{
|
||||
char *p;
|
||||
char quote = *cmd;
|
||||
|
||||
- if (!winshell)
|
||||
+ if (!winshell || !glob)
|
||||
{
|
||||
char *p;
|
||||
strcpy (cmd, cmd + 1);
|
||||
@@ -169,8 +169,8 @@ quoted (char *cmd, int winshell)
|
||||
}
|
||||
|
||||
const char *s = quote == '\'' ? "'" : "\\\"";
|
||||
- /* This must have been run from a Windows shell, so preserve
|
||||
- quotes for globify to play with later. */
|
||||
+ /* This must have been run from a Windows shell and globbing is enabled,
|
||||
+ so preserve quotes for globify to play with later. */
|
||||
while (*cmd && *++cmd)
|
||||
if ((p = strpbrk (cmd, s)) == NULL)
|
||||
{
|
||||
@@ -291,7 +291,7 @@ globify (char *word, char **&argv, int &argc, int &argvlen)
|
||||
/* Build argv, argc from string passed from Windows. */
|
||||
|
||||
static void
|
||||
-build_argv (char *cmd, char **&argv, int &argc, int winshell)
|
||||
+build_argv (char *cmd, char **&argv, int &argc, int winshell, int glob)
|
||||
{
|
||||
int argvlen = 0;
|
||||
int nesting = 0; // monitor "nesting" from insert_file
|
||||
@@ -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. */
|
||||
- cmd = quoted (cmd, winshell && argc > 0 && *word != '@');
|
||||
+ cmd = quoted (cmd, winshell && argc > 0 && *word != '@', glob);
|
||||
}
|
||||
if (issep (*cmd)) // End of argument if space
|
||||
break;
|
||||
@@ -351,7 +351,7 @@ build_argv (char *cmd, char **&argv, int &argc, int winshell)
|
||||
}
|
||||
|
||||
/* Add word to argv file after (optional) wildcard expansion. */
|
||||
- if (!winshell || !argc || !globify (word, argv, argc, argvlen))
|
||||
+ if (!glob || !argc || !globify (word, argv, argc, argvlen))
|
||||
{
|
||||
debug_printf ("argv[%d] = '%s'", argc, word);
|
||||
argv[argc++] = word;
|
||||
@@ -903,6 +903,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,
|
||||
+ NOTSTATE (myself, PID_CYGPARENT),
|
||||
NOTSTATE (myself, PID_CYGPARENT) && allow_glob);
|
||||
|
||||
/* Convert argv[0] to posix rules if it's currently blatantly
|
||||
@ -0,0 +1,57 @@
|
||||
From e9b519af4a971d8d804b05906ef8ab1831bb1f05 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
|
||||
differently when dos_spec
|
||||
|
||||
Reverts 25ba8f306f3099caf8397859019e936b90510e8d. I can't figure out what
|
||||
the intention was. I'm sure I'll find out soon enough when everything breaks.
|
||||
|
||||
This change means that input of:
|
||||
'"C:/test.exe SOME_VAR=\"literal quotes\""'
|
||||
|
||||
becomes:
|
||||
'C:/test.exe SOME_VAR="literal quotes"'
|
||||
|
||||
instead of:
|
||||
'C:/test.exe SOME_VAR=\literal quotes\'
|
||||
|
||||
.. which is at least consistent with the result for:
|
||||
'"no_drive_or_colon SOME_VAR=\"literal quotes\""'
|
||||
|
||||
The old result of course resulted in the quoted string being split into
|
||||
two arguments at the space which is clearly not intended.
|
||||
|
||||
I *guess* backslashes in dos paths may have been the issue here?
|
||||
If so I don't care since we should not use them, ever, esp. not at
|
||||
the expense of sensible forward-slash-containing input.
|
||||
---
|
||||
winsup/cygwin/dcrt0.cc | 12 +++++++++++-
|
||||
1 file changed, 11 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/winsup/cygwin/dcrt0.cc b/winsup/cygwin/dcrt0.cc
|
||||
index 2e6d00a..3c977d0 100644
|
||||
--- a/winsup/cygwin/dcrt0.cc
|
||||
+++ b/winsup/cygwin/dcrt0.cc
|
||||
@@ -236,10 +236,20 @@ globify (char *word, char **&argv, int &argc, int &argvlen)
|
||||
char quote = *s;
|
||||
while (*++s && *s != quote)
|
||||
{
|
||||
+ /* This used to be:
|
||||
if (dos_spec || *s != '\\')
|
||||
- /* nothing */;
|
||||
+ // nothing
|
||||
else if (s[1] == quote || s[1] == '\\')
|
||||
s++;
|
||||
+ With commit message:
|
||||
+ dcrt0.cc (globify): Don't use \ quoting when apparently quoting a DOS path
|
||||
+ spec, even within a quoted string.
|
||||
+ But that breaks the "literal quotes" part of '"C:/test.exe SOME_VAR=\"literal quotes\""'
|
||||
+ giving: 'C:/test.exe SOME_VAR=\literal quotes\' (with \'s between each character)
|
||||
+ instead of 'C:/test.exe SOME_VAR="literal quotes"' (with \'s between each character)
|
||||
+ */
|
||||
+ if (*s == '\\' && (s[1] == quote || s[1] == '\\'))
|
||||
+ s++;
|
||||
*p++ = '\\';
|
||||
size_t cnt = isascii (*s) ? 1 : mbtowc (NULL, s, MB_CUR_MAX);
|
||||
if (cnt <= 1 || cnt == (size_t)-1)
|
||||
69
msys2-runtime-3.4/0013-strace.cc-Don-t-set-MSYS-noglob.patch
Normal file
69
msys2-runtime-3.4/0013-strace.cc-Don-t-set-MSYS-noglob.patch
Normal file
@ -0,0 +1,69 @@
|
||||
From e1510e606a89af0890bb6bae8a944eea3d42857c 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
|
||||
|
||||
Commit message for this code was:
|
||||
|
||||
* strace.cc (create_child): Set CYGWIN=noglob when starting new process so that
|
||||
|
||||
Cygwin will leave already-parsed the command line alonw."
|
||||
|
||||
I can see no reason for it and it badly breaks the ability to use
|
||||
strace.exe to investigate calling a Cygwin program from a Windows
|
||||
program, for example:
|
||||
strace mingw32-make.exe
|
||||
.. where mingw32-make.exe finds sh.exe and uses it as the shell.
|
||||
The reason it badly breaks this use-case is because dcrt0.cc depends
|
||||
on globbing to happen to parse commandlines from Windows programs;
|
||||
irrespective of whether they contain any glob patterns or not.
|
||||
|
||||
See quoted () comment:
|
||||
"This must have been run from a Windows shell, so preserve
|
||||
quotes for globify to play with later."
|
||||
---
|
||||
winsup/utils/mingw/strace.cc | 21 ++++++++++++++++++++-
|
||||
1 file changed, 20 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/winsup/utils/mingw/strace.cc b/winsup/utils/mingw/strace.cc
|
||||
index a875bf2..cdfc3d6 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);
|
||||
|
||||
SetConsoleCtrlHandler (NULL, 0);
|
||||
+/* Commit message for this code was:
|
||||
+"* strace.cc (create_child): Set CYGWIN=noglob when starting new process so that
|
||||
+
|
||||
+ Cygwin will leave already-parsed the command line alonw."
|
||||
+
|
||||
+ I can see no reason for it and it badly breaks the ability to use
|
||||
+ strace.exe to investigate calling a Cygwin program from a Windows
|
||||
+ program, for example:
|
||||
+ strace mingw32-make.exe
|
||||
+ .. where mingw32-make.exe finds sh.exe and uses it as the shell.
|
||||
+ The reason it badly breaks this use-case is because dcrt0.cc depends
|
||||
+ on globbing to happen to parse commandlines from Windows programs;
|
||||
+ irrespective of whether they contain any glob patterns or not.
|
||||
+
|
||||
+ See quoted () comment:
|
||||
+ "This must have been run from a Windows shell, so preserve
|
||||
+ quotes for globify to play with later."
|
||||
+
|
||||
const char *cygwin_env = getenv ("MSYS");
|
||||
const char *space;
|
||||
|
||||
- if (cygwin_env && strlen (cygwin_env) <= 256) /* sanity check */
|
||||
+ if (cygwin_env && strlen (cygwin_env) <= 256) // sanity check
|
||||
space = " ";
|
||||
else
|
||||
space = cygwin_env = "";
|
||||
@@ -365,6 +383,7 @@ create_child (char **argv)
|
||||
+ strlen (space) + strlen (cygwin_env));
|
||||
sprintf (newenv, "MSYS=noglob%s%s", space, cygwin_env);
|
||||
_putenv (newenv);
|
||||
+*/
|
||||
ret = CreateProcess (0, one_line.buf, /* command line */
|
||||
NULL, /* Security */
|
||||
NULL, /* thread */
|
||||
22
msys2-runtime-3.4/0014-Add-debugging-for-build_argv.patch
Normal file
22
msys2-runtime-3.4/0014-Add-debugging-for-build_argv.patch
Normal file
@ -0,0 +1,22 @@
|
||||
From b8ef94d438bd0ffe9693e799e1790b88765f7f23 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
|
||||
|
||||
---
|
||||
winsup/cygwin/dcrt0.cc | 2 ++
|
||||
1 file changed, 2 insertions(+)
|
||||
|
||||
diff --git a/winsup/cygwin/dcrt0.cc b/winsup/cygwin/dcrt0.cc
|
||||
index 3c977d0..d7a1b1a 100644
|
||||
--- a/winsup/cygwin/dcrt0.cc
|
||||
+++ b/winsup/cygwin/dcrt0.cc
|
||||
@@ -310,6 +310,8 @@ build_argv (char *cmd, char **&argv, int &argc, int winshell, int glob)
|
||||
argvlen = 0;
|
||||
argv = NULL;
|
||||
|
||||
+ debug_printf ("cmd = '%s', winshell = %d, glob = %d", cmd, winshell, glob);
|
||||
+
|
||||
/* Scan command line until there is nothing left. */
|
||||
while (*cmd)
|
||||
{
|
||||
@ -0,0 +1,21 @@
|
||||
From cebcd4929ecdf1151aabb0bce43bdfbd7c7364a6 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/mingw/strace.cc | 1 +
|
||||
1 file changed, 1 insertion(+)
|
||||
|
||||
diff --git a/winsup/utils/mingw/strace.cc b/winsup/utils/mingw/strace.cc
|
||||
index cdfc3d6..e7ec38e 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;
|
||||
|
||||
make_command_line (one_line, argv);
|
||||
+ printf ("create_child: %s\n", one_line.buf);
|
||||
|
||||
SetConsoleCtrlHandler (NULL, 0);
|
||||
/* Commit message for this code was:
|
||||
@ -0,0 +1,172 @@
|
||||
From 55ffb73568b73d9b3fd5057ef16858fce500ad0e 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
|
||||
MSYS2_ENV_CONV_EXCL
|
||||
|
||||
Works very much like MSYS2_ARG_CONV_EXCL. In fact it uses the same
|
||||
function, arg_heuristic_with_exclusions (). Also refactors parsing
|
||||
the env. variables to use new function, string_split_delimited ().
|
||||
|
||||
The env. that is searched through is the merged (POSIX + Windows)
|
||||
one. It remains to be seen if this should be made an option or not.
|
||||
|
||||
This feature was prompted because the R language (Windows exe) calls
|
||||
bash to run configure.win, which then calls back into R to read its
|
||||
config variables (LOCAL_SOFT) and when this happens, msys2-runtime
|
||||
converts R_ARCH from "/x64" to an absolute Windows path and appends
|
||||
it to another absolute path, R_HOME, forming an invalid path.
|
||||
---
|
||||
winsup/cygwin/environ.cc | 34 +++++++++++++++++-------
|
||||
winsup/cygwin/local_includes/miscfuncs.h | 2 ++
|
||||
winsup/cygwin/miscfuncs.cc | 20 ++++++++++++++
|
||||
winsup/cygwin/path.cc | 1 -
|
||||
winsup/cygwin/spawn.cc | 12 ++-------
|
||||
5 files changed, 48 insertions(+), 21 deletions(-)
|
||||
|
||||
diff --git a/winsup/cygwin/environ.cc b/winsup/cygwin/environ.cc
|
||||
index 7a4a6ea..4a15069 100644
|
||||
--- a/winsup/cygwin/environ.cc
|
||||
+++ b/winsup/cygwin/environ.cc
|
||||
@@ -1171,6 +1171,10 @@ build_env (const char * const *envp, PWCHAR &envblock, int &envc,
|
||||
|
||||
int tl = 0;
|
||||
char **pass_dstp;
|
||||
+#ifdef __MSYS__
|
||||
+ char *msys2_env_conv_excl_env = NULL;
|
||||
+ size_t msys2_env_conv_excl_count = 0;
|
||||
+#endif
|
||||
char **pass_env = (char **) alloca (sizeof (char *)
|
||||
* (n + winnum + SPENVS_SIZE + 1));
|
||||
/* Iterate over input list, generating a new environment list and refreshing
|
||||
@@ -1179,16 +1183,25 @@ build_env (const char * const *envp, PWCHAR &envblock, int &envc,
|
||||
{
|
||||
bool calc_tl = !no_envblock;
|
||||
#ifdef __MSYS__
|
||||
- /* Don't pass timezone environment to non-msys applications */
|
||||
- if (!keep_posix && ascii_strncasematch(*srcp, "TZ=", 3))
|
||||
+ if (!keep_posix)
|
||||
{
|
||||
- const char *v = *srcp + 3;
|
||||
- if (*v == ':')
|
||||
- goto next1;
|
||||
- for (; *v; v++)
|
||||
- if (!isalpha(*v) && !isdigit(*v) &&
|
||||
- *v != '-' && *v != '+' && *v != ':')
|
||||
- goto next1;
|
||||
+ /* Don't pass timezone environment to non-msys applications */
|
||||
+ if (ascii_strncasematch(*srcp, "TZ=", 3))
|
||||
+ {
|
||||
+ const char *v = *srcp + 3;
|
||||
+ if (*v == ':')
|
||||
+ goto next1;
|
||||
+ for (; *v; v++)
|
||||
+ if (!isalpha(*v) && !isdigit(*v) &&
|
||||
+ *v != '-' && *v != '+' && *v != ':')
|
||||
+ goto next1;
|
||||
+ }
|
||||
+ else if (ascii_strncasematch(*srcp, "MSYS2_ENV_CONV_EXCL=", 20))
|
||||
+ {
|
||||
+ msys2_env_conv_excl_env = (char*)alloca (strlen(&(*srcp)[20])+1);
|
||||
+ strcpy (msys2_env_conv_excl_env, &(*srcp)[20]);
|
||||
+ msys2_env_conv_excl_count = string_split_delimited (msys2_env_conv_excl_env, ';');
|
||||
+ }
|
||||
}
|
||||
#endif
|
||||
/* Look for entries that require special attention */
|
||||
@@ -1313,7 +1326,8 @@ build_env (const char * const *envp, PWCHAR &envblock, int &envc,
|
||||
}
|
||||
#ifdef __MSYS__
|
||||
else if (!keep_posix) {
|
||||
- char *win_arg = arg_heuristic(*srcp);
|
||||
+ char *win_arg = arg_heuristic_with_exclusions
|
||||
+ (*srcp, msys2_env_conv_excl_env, msys2_env_conv_excl_count);
|
||||
debug_printf("WIN32_PATH is %s", win_arg);
|
||||
p = cstrdup1(win_arg);
|
||||
if (win_arg != *srcp)
|
||||
diff --git a/winsup/cygwin/local_includes/miscfuncs.h b/winsup/cygwin/local_includes/miscfuncs.h
|
||||
index d52deba..c4dbe02 100644
|
||||
--- a/winsup/cygwin/local_includes/miscfuncs.h
|
||||
+++ b/winsup/cygwin/local_includes/miscfuncs.h
|
||||
@@ -81,6 +81,8 @@ void backslashify (const char *, char *, bool);
|
||||
void slashify (const char *, char *, bool);
|
||||
#define isslash(c) ((c) == '/')
|
||||
|
||||
+size_t string_split_delimited (char * string, char delimiter);
|
||||
+
|
||||
extern void transform_chars (PWCHAR, PWCHAR);
|
||||
extern inline void
|
||||
transform_chars (PUNICODE_STRING upath, USHORT start_idx)
|
||||
diff --git a/winsup/cygwin/miscfuncs.cc b/winsup/cygwin/miscfuncs.cc
|
||||
index 767384f..160c996 100644
|
||||
--- a/winsup/cygwin/miscfuncs.cc
|
||||
+++ b/winsup/cygwin/miscfuncs.cc
|
||||
@@ -311,6 +311,26 @@ NT_readline::gets ()
|
||||
}
|
||||
}
|
||||
|
||||
+/* Searches through string for delimiter replacing each instance with '\0'
|
||||
+ and returning the number of such delimited substrings. This function
|
||||
+ Will return 0 for the NULL string and at least 1 otherwise. */
|
||||
+
|
||||
+size_t
|
||||
+string_split_delimited (char * string, char delimiter)
|
||||
+{
|
||||
+ if ( string == NULL )
|
||||
+ return 0;
|
||||
+ size_t count = 1;
|
||||
+ string = strchr ( string, delimiter );
|
||||
+ while (string)
|
||||
+ {
|
||||
+ *string = '\0';
|
||||
+ ++count;
|
||||
+ string = strchr ( string + 1, delimiter );
|
||||
+ }
|
||||
+ return count;
|
||||
+}
|
||||
+
|
||||
/* Signal the thread name to any attached debugger
|
||||
|
||||
(See "How to: Set a Thread Name in Native Code"
|
||||
diff --git a/winsup/cygwin/path.cc b/winsup/cygwin/path.cc
|
||||
index a84706e..7500854 100644
|
||||
--- a/winsup/cygwin/path.cc
|
||||
+++ b/winsup/cygwin/path.cc
|
||||
@@ -4019,7 +4019,6 @@ arg_heuristic_with_exclusions (char const * const arg, char const * exclusions,
|
||||
return arg_result;
|
||||
}
|
||||
|
||||
- debug_printf("Input value: (%s)", arg);
|
||||
for (size_t excl = 0; excl < exclusions_count; ++excl)
|
||||
{
|
||||
/* 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 73e6a00..99dbe64 100644
|
||||
--- a/winsup/cygwin/spawn.cc
|
||||
+++ b/winsup/cygwin/spawn.cc
|
||||
@@ -282,8 +282,7 @@ child_info_spawn::worker (const char *prog_arg, const char *const *argv,
|
||||
int res = -1;
|
||||
|
||||
/* Environment variable MSYS2_ARG_CONV_EXCL contains a list
|
||||
- of ';' separated argument prefixes to pass un-modified..
|
||||
- It isn't applied to env. variables; only spawn arguments.
|
||||
+ of ';' separated argument prefixes to pass un-modified.
|
||||
A value of * means don't convert any arguments. */
|
||||
char* msys2_arg_conv_excl_env = getenv("MSYS2_ARG_CONV_EXCL");
|
||||
char* msys2_arg_conv_excl = NULL;
|
||||
@@ -292,14 +291,7 @@ child_info_spawn::worker (const char *prog_arg, const char *const *argv,
|
||||
{
|
||||
msys2_arg_conv_excl = (char*)alloca (strlen(msys2_arg_conv_excl_env)+1);
|
||||
strcpy (msys2_arg_conv_excl, msys2_arg_conv_excl_env);
|
||||
- msys2_arg_conv_excl_count = 1;
|
||||
- msys2_arg_conv_excl_env = strchr ( msys2_arg_conv_excl, ';' );
|
||||
- while (msys2_arg_conv_excl_env)
|
||||
- {
|
||||
- *msys2_arg_conv_excl_env = '\0';
|
||||
- ++msys2_arg_conv_excl_count;
|
||||
- msys2_arg_conv_excl_env = strchr ( msys2_arg_conv_excl_env + 1, ';' );
|
||||
- }
|
||||
+ msys2_arg_conv_excl_count = string_split_delimited (msys2_arg_conv_excl, ';');
|
||||
}
|
||||
|
||||
/* Check if we have been called from exec{lv}p or spawn{lv}p and mask
|
||||
@ -0,0 +1,22 @@
|
||||
From 3ed78c6fea6757ed9ce08328d7d3a16dc3570222 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
|
||||
|
||||
---
|
||||
winsup/cygwin/spawn.cc | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/winsup/cygwin/spawn.cc b/winsup/cygwin/spawn.cc
|
||||
index 99dbe64..c77970b 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)
|
||||
|
||||
err = 0;
|
||||
debug_printf ("prog '%s'", prog);
|
||||
- buf.check (prog, PC_SYM_FOLLOW | PC_NULLEMPTY | PC_POSIX,
|
||||
+ buf.check (prog, PC_SYM_FOLLOW | PC_SYM_NOFOLLOW_REP | PC_NULLEMPTY | PC_POSIX,
|
||||
(opt & FE_DLL) ? stat_suffixes : exe_suffixes);
|
||||
|
||||
if (buf.isdir ())
|
||||
37
msys2-runtime-3.4/0018-strace-quiet-be-really-quiet.patch
Normal file
37
msys2-runtime-3.4/0018-strace-quiet-be-really-quiet.patch
Normal file
@ -0,0 +1,37 @@
|
||||
From 135fa9942180eb50a404ddb59b7131b827550b39 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 18/N] strace --quiet: be *really* quiet
|
||||
|
||||
The biggest problem with strace spitting out `create_child: ...` despite
|
||||
being asked to be real quiet is that its output can very well interfere
|
||||
with scripts' operations.
|
||||
|
||||
For example, when running any of Git for Windows' shell scripts with
|
||||
`GIT_STRACE_COMMANDS=/path/to/logfile` (which is sadly an often needed
|
||||
debugging technique while trying to address the many MSYS2 issues Git for
|
||||
Windows faces), any time the output of any command is redirected into a
|
||||
variable, it will include that `create_child: ...` line, wreaking havoc
|
||||
with Git's expectations.
|
||||
|
||||
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/mingw/strace.cc | 3 ++-
|
||||
1 file changed, 2 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/winsup/utils/mingw/strace.cc b/winsup/utils/mingw/strace.cc
|
||||
index e7ec38e..f6186be 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;
|
||||
|
||||
make_command_line (one_line, argv);
|
||||
- printf ("create_child: %s\n", one_line.buf);
|
||||
+ if (!quiet)
|
||||
+ printf ("create_child: %s\n", one_line.buf);
|
||||
|
||||
SetConsoleCtrlHandler (NULL, 0);
|
||||
/* Commit message for this code was:
|
||||
@ -0,0 +1,54 @@
|
||||
From b9373c6e2343625d65d3f4fcea7e3880a845b9c2 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 19/N] Introduce the `enable_pcon` value for `MSYS`
|
||||
|
||||
It is simply the negation of `disable_pcon`, i.e. `MSYS=enable_pcon` is
|
||||
equivalent to `MSYS=nodisable_pcon` (the former is slightly more
|
||||
intuitive than the latter) and likewise `MSYS=noenable_pcon` is
|
||||
equivalent to `MSYS=disable_pcon` (here, the latter is definitely more
|
||||
intuitive than the former).
|
||||
|
||||
This is needed because we just demoted the pseudo console feature to be
|
||||
opt-in instead of opt-out, and it would be awkward to recommend to users
|
||||
to use "nodisable_pcon"... "nodisable" is not even a verb.
|
||||
|
||||
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
|
||||
---
|
||||
winsup/cygwin/environ.cc | 9 +++++++++
|
||||
1 file changed, 9 insertions(+)
|
||||
|
||||
diff --git a/winsup/cygwin/environ.cc b/winsup/cygwin/environ.cc
|
||||
index 4a15069..89e989a 100644
|
||||
--- a/winsup/cygwin/environ.cc
|
||||
+++ b/winsup/cygwin/environ.cc
|
||||
@@ -42,6 +42,7 @@ enum settings
|
||||
isfunc,
|
||||
setdword,
|
||||
setbool,
|
||||
+ setnegbool,
|
||||
setbit
|
||||
};
|
||||
|
||||
@@ -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}}},
|
||||
+ {"enable_pcon", {&disable_pcon}, setnegbool, NULL, {{true}, {false}}},
|
||||
{NULL, {0}, setdword, 0, {{0}, {0}}}
|
||||
};
|
||||
|
||||
@@ -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;
|
||||
+ case setnegbool:
|
||||
+ if (!istrue || !eq)
|
||||
+ *k->setting.b = k->values[istrue].i;
|
||||
+ else
|
||||
+ *k->setting.b = !strtol (eq, NULL, 0);
|
||||
+ debug_printf ("%s%s", !*k->setting.b ? "" : "no", k->name);
|
||||
+ break;
|
||||
case setbit:
|
||||
*k->setting.x &= ~k->values[istrue].i;
|
||||
if (istrue || (eq && strtol (eq, NULL, 0)))
|
||||
@ -0,0 +1,31 @@
|
||||
From 67be933931bfa9ebd02c429cef4d8e1847c016e0 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 20/N] popen: call /usr/bin/sh instead of /bin/sh
|
||||
|
||||
We mount /usr/bin to /bin, but in a chroot this is broken and we
|
||||
have no /bin, so try to use the real path.
|
||||
|
||||
chroot is used by pacman to run install scripts when called with --root
|
||||
and this broke programs in install scripts calling popen()
|
||||
(install-info from texinfo for example)
|
||||
|
||||
There are more paths hardcoded to /bin in cygwin which might also be broken
|
||||
in this scenario, so this maybe should be extended to all of them.
|
||||
---
|
||||
winsup/cygwin/syscalls.cc | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/winsup/cygwin/syscalls.cc b/winsup/cygwin/syscalls.cc
|
||||
index 91b86bf..725def4 100644
|
||||
--- a/winsup/cygwin/syscalls.cc
|
||||
+++ b/winsup/cygwin/syscalls.cc
|
||||
@@ -4342,7 +4342,7 @@ popen (const char *command, const char *in_type)
|
||||
fcntl (stdchild, F_SETFD, stdchild_state | FD_CLOEXEC);
|
||||
|
||||
/* Start a shell process to run the given command without forking. */
|
||||
- pid_t pid = ch_spawn.worker ("/bin/sh", argv, environ, _P_NOWAIT,
|
||||
+ pid_t pid = ch_spawn.worker ("/usr/bin/sh", argv, environ, _P_NOWAIT,
|
||||
__std[0], __std[1]);
|
||||
|
||||
/* Reinstate the close-on-exec state */
|
||||
@ -0,0 +1,53 @@
|
||||
From a609f04755bbbf9b18a5f812d234c467cf351c2f 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 21/N] Expose full command-lines to other Win32 processes by
|
||||
default
|
||||
|
||||
In the Cygwin project, it was decided that the command-line of Cygwin
|
||||
processes, as shown in the output of `wmic process list`, would suffer
|
||||
from being truncated to 32k (and is transmitted to the child process via
|
||||
a different mechanism, anyway), and therefore only the absolute path of
|
||||
the executable is shown by default.
|
||||
|
||||
Users who would like to see the full command-line (even if it is
|
||||
truncated) are expected to set `CYGWIN=wincmdln` (or, in MSYS2's case,
|
||||
`MSYS=wincmdln`).
|
||||
|
||||
Seeing as MSYS2 tries to integrate much better with the surrounding
|
||||
Win32 ecosystem than Cygwin, it makes sense to turn this on by default.
|
||||
|
||||
Users who wish to suppress it can still set `MSYS=nowincmdln`.
|
||||
|
||||
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
|
||||
---
|
||||
winsup/cygwin/globals.cc | 2 +-
|
||||
winsup/doc/cygwinenv.xml | 2 +-
|
||||
2 files changed, 2 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/winsup/cygwin/globals.cc b/winsup/cygwin/globals.cc
|
||||
index cd907b7..1541fa4 100644
|
||||
--- a/winsup/cygwin/globals.cc
|
||||
+++ b/winsup/cygwin/globals.cc
|
||||
@@ -70,7 +70,7 @@ bool allow_glob = true;
|
||||
bool ignore_case_with_glob;
|
||||
bool pipe_byte = true; /* Default to byte mode so that C# programs work. */
|
||||
bool reset_com;
|
||||
-bool wincmdln;
|
||||
+bool wincmdln = true;
|
||||
winsym_t allow_winsymlinks = WSYM_deepcopy;
|
||||
bool disable_pcon;
|
||||
|
||||
diff --git a/winsup/doc/cygwinenv.xml b/winsup/doc/cygwinenv.xml
|
||||
index 5e17404..3051416 100644
|
||||
--- a/winsup/doc/cygwinenv.xml
|
||||
+++ b/winsup/doc/cygwinenv.xml
|
||||
@@ -73,7 +73,7 @@ time and when handles are inherited. Defaults to set.</para>
|
||||
<listitem>
|
||||
<para><envar>(no)wincmdln</envar> - if set, the windows complete command
|
||||
line (truncated to ~32K) will be passed on any processes that it creates
|
||||
-in addition to the normal UNIX argv list. Defaults to not set.</para>
|
||||
+in addition to the normal UNIX argv list. Defaults to set.</para>
|
||||
</listitem>
|
||||
|
||||
<listitem>
|
||||
@ -0,0 +1,65 @@
|
||||
From 7616b8a2e0ffcf068b47e1a66bbb1dbd7d9b5c50 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 22/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
|
||||
kick in (such as registered JIT debuggers). We even agreed that it would
|
||||
make sense to hide this functionality behind a flag, `winjitdebug`.
|
||||
|
||||
However, when this got upstreamed as 21ec498d7f (cygwin: use
|
||||
CREATE_DEFAULT_ERROR_MODE in spawn, 2020-12-09), that flag was deemed
|
||||
unnecessary.
|
||||
|
||||
But it would appear that it _is_ necessary: As reported in
|
||||
https://github.com/msys2/MSYS2-packages/pull/2414#issuecomment-810841296
|
||||
this new behavior is pretty disruptive e.g. in CI scenarios.
|
||||
|
||||
So let's introduce that `winjitdebug` flag (settable via the environment
|
||||
variable `MSYS`) at long last.
|
||||
|
||||
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
|
||||
---
|
||||
winsup/cygwin/environ.cc | 1 +
|
||||
winsup/cygwin/globals.cc | 1 +
|
||||
winsup/cygwin/spawn.cc | 2 +-
|
||||
3 files changed, 3 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/winsup/cygwin/environ.cc b/winsup/cygwin/environ.cc
|
||||
index 89e989a..31ada02 100644
|
||||
--- a/winsup/cygwin/environ.cc
|
||||
+++ b/winsup/cygwin/environ.cc
|
||||
@@ -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}}},
|
||||
+ {"winjitdebug", {&winjitdebug}, setbool, NULL, {{false}, {true}}},
|
||||
{NULL, {0}, setdword, 0, {{0}, {0}}}
|
||||
};
|
||||
|
||||
diff --git a/winsup/cygwin/globals.cc b/winsup/cygwin/globals.cc
|
||||
index 1541fa4..f243aad 100644
|
||||
--- a/winsup/cygwin/globals.cc
|
||||
+++ b/winsup/cygwin/globals.cc
|
||||
@@ -73,6 +73,7 @@ bool reset_com;
|
||||
bool wincmdln = true;
|
||||
winsym_t allow_winsymlinks = WSYM_deepcopy;
|
||||
bool disable_pcon;
|
||||
+bool winjitdebug = false;
|
||||
|
||||
bool NO_COPY in_forkee;
|
||||
|
||||
diff --git a/winsup/cygwin/spawn.cc b/winsup/cygwin/spawn.cc
|
||||
index c77970b..383f5e5 100644
|
||||
--- a/winsup/cygwin/spawn.cc
|
||||
+++ b/winsup/cygwin/spawn.cc
|
||||
@@ -429,7 +429,7 @@ child_info_spawn::worker (const char *prog_arg, const char *const *argv,
|
||||
get the default error mode instead of inheriting the mode Cygwin
|
||||
uses. This allows things like Windows Error Reporting/JIT debugging
|
||||
to work with processes launched from a Cygwin shell. */
|
||||
- if (!real_path.iscygexec ())
|
||||
+ if (winjitdebug && !real_path.iscygexec ())
|
||||
c_flags |= CREATE_DEFAULT_ERROR_MODE;
|
||||
|
||||
/* We're adding the CREATE_BREAKAWAY_FROM_JOB flag here to workaround
|
||||
@ -0,0 +1,382 @@
|
||||
From d0d21acc471b3832648bbf6ad4b69dd46802f383 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 23/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 132028d..bc5c774 100644
|
||||
--- a/winsup/configure.ac
|
||||
+++ b/winsup/configure.ac
|
||||
@@ -106,6 +106,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 c26eef8..d66c226 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;
|
||||
+}
|
||||
@ -0,0 +1,506 @@
|
||||
From 7b32587cf789bf5e5a442153f872393825a6efb6 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 24/N] Emulate GenerateConsoleCtrlEvent() upon Ctrl+C
|
||||
|
||||
This patch is heavily inspired by the Git for Windows' strategy in
|
||||
handling Ctrl+C.
|
||||
|
||||
When a process is terminated via TerminateProcess(), it has no chance to
|
||||
do anything in the way of cleaning up. This is particularly noticeable
|
||||
when a lengthy Git for Windows process tries to update Git's index file
|
||||
and leaves behind an index.lock file. Git's idea is to remove the stale
|
||||
index.lock file in that case, using the signal and atexit handlers
|
||||
available in Linux. But those signal handlers never run.
|
||||
|
||||
Note: this is not an issue for MSYS2 processes because MSYS2 emulates
|
||||
Unix' signal system accurately, both for the process sending the kill
|
||||
signal and the process receiving it. Win32 processes do not have such a
|
||||
signal handler, though, instead MSYS2 shuts them down via
|
||||
`TerminateProcess()`.
|
||||
|
||||
For a while, Git for Windows tried to use a gentler method, described in
|
||||
the Dr Dobb's article "A Safer Alternative to TerminateProcess()" by
|
||||
Andrew Tucker (July 1, 1999),
|
||||
http://www.drdobbs.com/a-safer-alternative-to-terminateprocess/184416547
|
||||
|
||||
Essentially, we injected a new thread into the running process that does
|
||||
nothing else than running the ExitProcess() function.
|
||||
|
||||
However, this was still not in line with the way CMD handles Ctrl+C: it
|
||||
gives processes a chance to do something upon Ctrl+C by calling
|
||||
SetConsoleCtrlHandler(), and ExitProcess() simply never calls that
|
||||
handler.
|
||||
|
||||
So for a while we tried to handle SIGINT/SIGTERM by attaching to the
|
||||
console of the command to interrupt, and generating the very same event
|
||||
as CMD does via GenerateConsoleCtrlEvent().
|
||||
|
||||
This method *still* was not correct, though, as it would interrupt
|
||||
*every* process attached to that Console, not just the process (and its
|
||||
children) that we wanted to signal. A symptom was that hitting Ctrl+C
|
||||
while `git log` was shown in the pager would interrupt *the pager*.
|
||||
|
||||
The method we settled on is to emulate what GenerateConsoleCtrlEvent()
|
||||
does, but on a process by process basis: inject a remote thread and call
|
||||
the (private) function kernel32!CtrlRoutine.
|
||||
|
||||
To obtain said function's address, we use the dbghelp API to generate a
|
||||
stack trace from a handler configured via SetConsoleCtrlHandler() and
|
||||
triggered via GenerateConsoleCtrlEvent(). To avoid killing each and all
|
||||
processes attached to the same Console as the MSYS2 runtime, we modify
|
||||
the cygwin-console-helper to optionally print the address of
|
||||
kernel32!CtrlRoutine to stdout, and then spawn it with a new Console.
|
||||
|
||||
Note that this also opens the door to handling 32-bit process from a
|
||||
64-bit MSYS2 runtime and vice versa, by letting the MSYS2 runtime look
|
||||
for the cygwin-console-helper.exe of the "other architecture" in a
|
||||
specific place (we choose /usr/libexec/, as it seems to be the
|
||||
convention for helper .exe files that are not intended for public
|
||||
consumption).
|
||||
|
||||
The 32-bit helper implicitly links to libgcc_s_dw2.dll and
|
||||
libwinpthread-1.dll, so to avoid cluttering /usr/libexec/, we look for
|
||||
the helped of the "other" architecture in the corresponding mingw32/ or
|
||||
mingw64/ subdirectory.
|
||||
|
||||
Among other bugs, this strategy to handle Ctrl+C fixes the MSYS2 side of
|
||||
the bug where interrupting `git clone https://...` would send the
|
||||
spawned-off `git remote-https` process into the background instead of
|
||||
interrupting it, i.e. the clone would continue and its progress would be
|
||||
reported mercilessly to the console window without the user being able
|
||||
to do anything about it (short of firing up the task manager and killing
|
||||
the appropriate task manually).
|
||||
|
||||
Note that this special-handling is only necessary when *MSYS2* handles
|
||||
the Ctrl+C event, e.g. when interrupting a process started from within
|
||||
MinTTY or any other non-cmd-based terminal emulator. If the process was
|
||||
started from within `cmd.exe`'s terminal window, child processes are
|
||||
already killed appropriately upon Ctrl+C, by `cmd.exe` itself.
|
||||
|
||||
Also, we can't trust the processes to end it's subprocesses upon receiving
|
||||
Ctrl+C. For example, `pip.exe` from `python-pip` doesn't kill the python
|
||||
it lauches (it tries to but fails), and I noticed that in cmd it kills python
|
||||
also correctly, which mean we should kill all the process using
|
||||
`exit_process_tree`.
|
||||
|
||||
Co-authored-by: Naveen M K <naveen@syrusdark.website>
|
||||
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
|
||||
---
|
||||
winsup/cygwin/exceptions.cc | 24 +-
|
||||
winsup/cygwin/include/cygwin/exit_process.h | 364 ++++++++++++++++++++
|
||||
2 files changed, 384 insertions(+), 4 deletions(-)
|
||||
create mode 100644 winsup/cygwin/include/cygwin/exit_process.h
|
||||
|
||||
diff --git a/winsup/cygwin/exceptions.cc b/winsup/cygwin/exceptions.cc
|
||||
index b154a3b..b843063 100644
|
||||
--- a/winsup/cygwin/exceptions.cc
|
||||
+++ b/winsup/cygwin/exceptions.cc
|
||||
@@ -29,6 +29,7 @@ details. */
|
||||
#include "exception.h"
|
||||
#include "posix_timer.h"
|
||||
#include "gcc_seh.h"
|
||||
+#include "cygwin/exit_process.h"
|
||||
|
||||
/* Define macros for CPU-agnostic register access. The _CX_foo
|
||||
macros are for access into CONTEXT, the _MC_foo ones for access into
|
||||
@@ -1511,10 +1512,25 @@ exit_sig:
|
||||
dosig:
|
||||
if (have_execed)
|
||||
{
|
||||
- sigproc_printf ("terminating captive process");
|
||||
- if (::cygheap->ctty)
|
||||
- ::cygheap->ctty->cleanup_before_exit ();
|
||||
- TerminateProcess (ch_spawn, sigExeced = si.si_signo);
|
||||
+ switch (si.si_signo)
|
||||
+ {
|
||||
+ case SIGUSR1:
|
||||
+ case SIGUSR2:
|
||||
+ case SIGCONT:
|
||||
+ case SIGSTOP:
|
||||
+ case SIGTSTP:
|
||||
+ case SIGTTIN:
|
||||
+ case SIGTTOU:
|
||||
+ system_printf ("Suppressing signal %d to win32 process (pid %u)",
|
||||
+ (int)si.si_signo, (unsigned int)GetProcessId(ch_spawn));
|
||||
+ goto done;
|
||||
+ default:
|
||||
+ sigproc_printf ("terminating captive process");
|
||||
+ if (::cygheap->ctty)
|
||||
+ ::cygheap->ctty->cleanup_before_exit ();
|
||||
+ rc = exit_process_tree (ch_spawn, 128 + (sigExeced = si.si_signo));
|
||||
+ goto done;
|
||||
+ }
|
||||
}
|
||||
/* Dispatch to the appropriate function. */
|
||||
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..0486a0c
|
||||
--- /dev/null
|
||||
+++ b/winsup/cygwin/include/cygwin/exit_process.h
|
||||
@@ -0,0 +1,364 @@
|
||||
+#ifndef EXIT_PROCESS_H
|
||||
+#define EXIT_PROCESS_H
|
||||
+
|
||||
+/*
|
||||
+ * This file contains functions to terminate a Win32 process, as gently as
|
||||
+ * possible.
|
||||
+ *
|
||||
+ * If appropriate, we will attempt to emulate a console Ctrl event for the
|
||||
+ * process. Otherwise we will fall back to terminating the process.
|
||||
+ *
|
||||
+ * As we do not want to export this function in the MSYS2 runtime, these
|
||||
+ * functions are marked as file-local.
|
||||
+ *
|
||||
+ * The idea is to inject a thread into the given process that runs either
|
||||
+ * kernel32!CtrlRoutine() (i.e. the work horse of GenerateConsoleCtrlEvent())
|
||||
+ * for SIGINT (Ctrl+C) and SIGQUIT (Ctrl+Break), or ExitProcess() for SIGTERM.
|
||||
+ * This is handled through the console helpers.
|
||||
+ *
|
||||
+ * For SIGKILL, we run TerminateProcess() without injecting anything, and this
|
||||
+ * is also the fall-back when the previous methods are unavailable.
|
||||
+ *
|
||||
+ * Note: as kernel32.dll is loaded before any process, the other process and
|
||||
+ * this process will have ExitProcess() at the same address. The same holds
|
||||
+ * true for kernel32!CtrlRoutine(), of course, but it is an internal API
|
||||
+ * function, so we cannot look it up directly. Instead, we launch
|
||||
+ * getprocaddr.exe to find out and inject the remote thread.
|
||||
+ *
|
||||
+ * This function expects the process handle to have the access rights for
|
||||
+ * CreateRemoteThread(): PROCESS_CREATE_THREAD, PROCESS_QUERY_INFORMATION,
|
||||
+ * PROCESS_VM_OPERATION, PROCESS_VM_WRITE, and PROCESS_VM_READ.
|
||||
+ *
|
||||
+ * The idea for the injected remote thread comes from the Dr Dobb's article "A
|
||||
+ * Safer Alternative to TerminateProcess()" by Andrew Tucker (July 1, 1999),
|
||||
+ * http://www.drdobbs.com/a-safer-alternative-to-terminateprocess/184416547.
|
||||
+ *
|
||||
+ * The idea to use kernel32!CtrlRoutine for the other signals comes from
|
||||
+ * SendSignal (https://github.com/AutoSQA/SendSignal/ and
|
||||
+ * http://stanislavs.org/stopping-command-line-applications-programatically-with-ctrl-c-events-from-net/).
|
||||
+ */
|
||||
+
|
||||
+#include <math.h>
|
||||
+#include <wchar.h>
|
||||
+
|
||||
+#ifndef __INSIDE_CYGWIN__
|
||||
+/* To help debugging via kill.exe */
|
||||
+#define small_printf(...) fprintf (stderr, __VA_ARGS__)
|
||||
+#endif
|
||||
+
|
||||
+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
|
||||
+kill_via_console_helper (HANDLE process, wchar_t *function_name, int exit_code,
|
||||
+ DWORD pid)
|
||||
+{
|
||||
+ BOOL is_wow;
|
||||
+ USHORT process_arch;
|
||||
+ if (!get_wow (process, is_wow, process_arch))
|
||||
+ {
|
||||
+ return FALSE;
|
||||
+ }
|
||||
+
|
||||
+ const char *name;
|
||||
+ 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 FALSE;
|
||||
+
|
||||
+ STARTUPINFOW si = {};
|
||||
+ PROCESS_INFORMATION pi;
|
||||
+ 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 %u", wbuf, function_name, exit_code,
|
||||
+ pid);
|
||||
+
|
||||
+ si.cb = sizeof (si);
|
||||
+ si.dwFlags = STARTF_USESHOWWINDOW | STARTF_USESTDHANDLES;
|
||||
+ si.wShowWindow = SW_HIDE;
|
||||
+ si.lpTitle = title;
|
||||
+ si.hStdInput = si.hStdError = si.hStdOutput = INVALID_HANDLE_VALUE;
|
||||
+
|
||||
+ /* Create a new hidden process. */
|
||||
+ if (!CreateProcessW (NULL, cmd, NULL, NULL, TRUE,
|
||||
+ CREATE_NO_WINDOW | CREATE_NEW_PROCESS_GROUP, NULL, NULL,
|
||||
+ &si, &pi))
|
||||
+ {
|
||||
+ return FALSE;
|
||||
+ }
|
||||
+ else
|
||||
+ {
|
||||
+ /* Wait for the process to complete for 10 seconds */
|
||||
+ WaitForSingleObject (pi.hProcess, 10000);
|
||||
+ }
|
||||
+
|
||||
+ if (!GetExitCodeProcess (pi.hProcess, &process_exit))
|
||||
+ process_exit = -1;
|
||||
+
|
||||
+ CloseHandle (pi.hThread);
|
||||
+ CloseHandle (pi.hProcess);
|
||||
+
|
||||
+ return process_exit == 0 ? TRUE : FALSE;
|
||||
+}
|
||||
+
|
||||
+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, 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;
|
||||
+
|
||||
+ 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 (), ¤t_is_wow))
|
||||
+ current_is_wow = -2;
|
||||
+
|
||||
+ 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 (!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;
|
||||
+}
|
||||
+
|
||||
+/**
|
||||
+ * Terminates the process corresponding to the process ID
|
||||
+ *
|
||||
+ * This way of terminating the processes is not gentle: the process gets
|
||||
+ * no chance of cleaning up after itself (closing file handles, removing
|
||||
+ * .lock files, terminating spawned processes (if any), etc).
|
||||
+ */
|
||||
+static int
|
||||
+exit_process (HANDLE process, int exit_code)
|
||||
+{
|
||||
+ LPTHREAD_START_ROUTINE address = NULL;
|
||||
+ DWORD pid = GetProcessId (process), code;
|
||||
+ int signo = exit_code & 0x7f;
|
||||
+ switch (signo)
|
||||
+ {
|
||||
+ 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))
|
||||
+ return 0;
|
||||
+ /* fall-through */
|
||||
+ case SIGTERM:
|
||||
+ if (kill_via_console_helper (process, L"ExitProcess", exit_code, pid))
|
||||
+ return 0;
|
||||
+ break;
|
||||
+ default:
|
||||
+ break;
|
||||
+ }
|
||||
+
|
||||
+ return int (TerminateProcess (process, exit_code));
|
||||
+}
|
||||
+
|
||||
+#include <tlhelp32.h>
|
||||
+#include <unistd.h>
|
||||
+
|
||||
+/**
|
||||
+ * Terminates the process corresponding to the process ID and all of its
|
||||
+ * directly and indirectly spawned subprocesses using the
|
||||
+ * TerminateProcess() function.
|
||||
+ */
|
||||
+static int
|
||||
+exit_process_tree (HANDLE main_process, int exit_code)
|
||||
+{
|
||||
+ HANDLE snapshot = CreateToolhelp32Snapshot (TH32CS_SNAPPROCESS, 0);
|
||||
+ PROCESSENTRY32 entry;
|
||||
+ DWORD pids[16384];
|
||||
+ int max_len = sizeof (pids) / sizeof (*pids), i, len, ret = 0;
|
||||
+ DWORD pid = GetProcessId (main_process);
|
||||
+ int signo = exit_code & 0x7f;
|
||||
+
|
||||
+ pids[0] = pid;
|
||||
+ len = 1;
|
||||
+
|
||||
+ /*
|
||||
+ * Even if Process32First()/Process32Next() seem to traverse the
|
||||
+ * processes in topological order (i.e. parent processes before
|
||||
+ * child processes), there is nothing in the Win32 API documentation
|
||||
+ * suggesting that this is guaranteed.
|
||||
+ *
|
||||
+ * Therefore, run through them at least twice and stop when no more
|
||||
+ * process IDs were added to the list.
|
||||
+ */
|
||||
+ for (;;)
|
||||
+ {
|
||||
+ memset (&entry, 0, sizeof (entry));
|
||||
+ entry.dwSize = sizeof (entry);
|
||||
+
|
||||
+ if (!Process32First (snapshot, &entry))
|
||||
+ break;
|
||||
+
|
||||
+ int orig_len = len;
|
||||
+ do
|
||||
+ {
|
||||
+ /**
|
||||
+ * Look for the parent process ID in the list of pids to kill, and if
|
||||
+ * found, add it to the list.
|
||||
+ */
|
||||
+ for (i = len - 1; i >= 0; i--)
|
||||
+ {
|
||||
+ if (pids[i] == entry.th32ProcessID)
|
||||
+ break;
|
||||
+ if (pids[i] != entry.th32ParentProcessID)
|
||||
+ continue;
|
||||
+
|
||||
+ /* We found a process to kill; is it an MSYS2 process? */
|
||||
+ pid_t cyg_pid = cygwin_winpid_to_pid (entry.th32ProcessID);
|
||||
+ if (cyg_pid > -1)
|
||||
+ {
|
||||
+ if (cyg_pid == getpgid (cyg_pid))
|
||||
+ kill (cyg_pid, signo);
|
||||
+ break;
|
||||
+ }
|
||||
+ pids[len++] = entry.th32ProcessID;
|
||||
+ break;
|
||||
+ }
|
||||
+ }
|
||||
+ while (len < max_len && Process32Next (snapshot, &entry));
|
||||
+
|
||||
+ if (orig_len == len || len >= max_len)
|
||||
+ break;
|
||||
+ }
|
||||
+
|
||||
+ CloseHandle (snapshot);
|
||||
+
|
||||
+ for (i = len - 1; i >= 0; i--)
|
||||
+ {
|
||||
+ HANDLE process;
|
||||
+
|
||||
+ if (!i)
|
||||
+ process = main_process;
|
||||
+ else
|
||||
+ {
|
||||
+ process = OpenProcess (
|
||||
+ PROCESS_CREATE_THREAD | PROCESS_QUERY_INFORMATION
|
||||
+ | PROCESS_VM_OPERATION | PROCESS_VM_WRITE | PROCESS_VM_READ,
|
||||
+ FALSE, pids[i]);
|
||||
+ if (!process)
|
||||
+ process = OpenProcess (
|
||||
+ PROCESS_QUERY_LIMITED_INFORMATION | PROCESS_TERMINATE,
|
||||
+ FALSE, pids[i]);
|
||||
+ }
|
||||
+ DWORD code;
|
||||
+
|
||||
+ if (process
|
||||
+ && (!GetExitCodeProcess (process, &code) || code == STILL_ACTIVE))
|
||||
+ {
|
||||
+ if (!exit_process (process, exit_code))
|
||||
+ ret = -1;
|
||||
+ }
|
||||
+ if (process && process != main_process)
|
||||
+ CloseHandle (process);
|
||||
+ }
|
||||
+
|
||||
+ return ret;
|
||||
+}
|
||||
+
|
||||
+#endif
|
||||
@ -0,0 +1,51 @@
|
||||
From 14a7518bdaad3d64a35f61dae33f8e8178d123c7 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 25/N] kill: kill Win32 processes more gently
|
||||
|
||||
This change is the equivalent to the change to the Ctrl+C handling we
|
||||
just made.
|
||||
|
||||
Co-authored-by: Naveen M K <naveen@syrusdark.website>
|
||||
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
|
||||
---
|
||||
winsup/utils/kill.cc | 19 +++++++++++++++----
|
||||
1 file changed, 15 insertions(+), 4 deletions(-)
|
||||
|
||||
diff --git a/winsup/utils/kill.cc b/winsup/utils/kill.cc
|
||||
index fc984c0..05ecd13 100644
|
||||
--- a/winsup/utils/kill.cc
|
||||
+++ b/winsup/utils/kill.cc
|
||||
@@ -17,6 +17,7 @@ details. */
|
||||
#include <cygwin/version.h>
|
||||
#include <getopt.h>
|
||||
#include <limits.h>
|
||||
+#include <cygwin/exit_process.h>
|
||||
|
||||
static char *prog_name;
|
||||
|
||||
@@ -188,10 +189,20 @@ forcekill (pid_t pid, DWORD winpid, int sig, int wait)
|
||||
return;
|
||||
}
|
||||
if (!wait || WaitForSingleObject (h, 200) != WAIT_OBJECT_0)
|
||||
- if (sig && !TerminateProcess (h, sig << 8)
|
||||
- && WaitForSingleObject (h, 200) != WAIT_OBJECT_0)
|
||||
- fprintf (stderr, "%s: couldn't kill pid %u, %u\n",
|
||||
- prog_name, (unsigned int) dwpid, (unsigned int) GetLastError ());
|
||||
+ {
|
||||
+ HANDLE cur = GetCurrentProcess (), h2;
|
||||
+ /* duplicate handle with access rights required for exit_process_tree() */
|
||||
+ if (DuplicateHandle (cur, h, cur, &h2, PROCESS_CREATE_THREAD |
|
||||
+ PROCESS_QUERY_INFORMATION |
|
||||
+ PROCESS_VM_OPERATION |
|
||||
+ PROCESS_VM_WRITE | PROCESS_VM_READ |
|
||||
+ PROCESS_TERMINATE, FALSE, 0))
|
||||
+ {
|
||||
+ CloseHandle(h);
|
||||
+ h = h2;
|
||||
+ }
|
||||
+ exit_process_tree (h, 128 + sig);
|
||||
+ }
|
||||
CloseHandle (h);
|
||||
}
|
||||
|
||||
@ -0,0 +1,52 @@
|
||||
From 11ef688a7233763d93046bfb39c4a3d9d36b1038 Mon Sep 17 00:00:00 2001
|
||||
From: Jeremy Drake <github@jdrake.com>
|
||||
Date: Thu, 22 Jul 2021 11:59:16 -0700
|
||||
Subject: [PATCH 26/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
|
||||
needed. MSYS=nonativeinnerlinks
|
||||
---
|
||||
winsup/cygwin/environ.cc | 1 +
|
||||
winsup/cygwin/globals.cc | 1 +
|
||||
winsup/cygwin/path.cc | 3 ++-
|
||||
3 files changed, 4 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/winsup/cygwin/environ.cc b/winsup/cygwin/environ.cc
|
||||
index 31ada02..b285a7c 100644
|
||||
--- a/winsup/cygwin/environ.cc
|
||||
+++ b/winsup/cygwin/environ.cc
|
||||
@@ -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}}},
|
||||
+ {"nativeinnerlinks", {&nativeinnerlinks}, setbool, NULL, {{false}, {true}}},
|
||||
{NULL, {0}, setdword, 0, {{0}, {0}}}
|
||||
};
|
||||
|
||||
diff --git a/winsup/cygwin/globals.cc b/winsup/cygwin/globals.cc
|
||||
index f243aad..bb37ca2 100644
|
||||
--- a/winsup/cygwin/globals.cc
|
||||
+++ b/winsup/cygwin/globals.cc
|
||||
@@ -74,6 +74,7 @@ bool wincmdln = true;
|
||||
winsym_t allow_winsymlinks = WSYM_deepcopy;
|
||||
bool disable_pcon;
|
||||
bool winjitdebug = false;
|
||||
+bool nativeinnerlinks = true;
|
||||
|
||||
bool NO_COPY in_forkee;
|
||||
|
||||
diff --git a/winsup/cygwin/path.cc b/winsup/cygwin/path.cc
|
||||
index 7500854..af88ecf 100644
|
||||
--- a/winsup/cygwin/path.cc
|
||||
+++ b/winsup/cygwin/path.cc
|
||||
@@ -3690,7 +3690,8 @@ restart:
|
||||
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. */
|
||||
- if ((pc_flags & (PC_SYM_FOLLOW | PC_SYM_NOFOLLOW_REP)) == PC_SYM_FOLLOW)
|
||||
+ if (nativeinnerlinks
|
||||
+ && (pc_flags & (PC_SYM_FOLLOW | PC_SYM_NOFOLLOW_REP)) == PC_SYM_FOLLOW)
|
||||
{
|
||||
PWCHAR fpbuf = tp.w_get ();
|
||||
DWORD ret;
|
||||
@ -0,0 +1,66 @@
|
||||
From 2d4c3172e6aa1f9d77528f8906bd6b18637e4993 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 27/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/configure.ac | 7 +++----
|
||||
winsup/doc/Makefile.am | 9 +++------
|
||||
2 files changed, 6 insertions(+), 10 deletions(-)
|
||||
|
||||
diff --git a/winsup/configure.ac b/winsup/configure.ac
|
||||
index bc5c774..e55e19a 100644
|
||||
--- a/winsup/configure.ac
|
||||
+++ b/winsup/configure.ac
|
||||
@@ -84,11 +84,10 @@ AM_CONDITIONAL(BUILD_DOC, [test $enable_doc != "no"])
|
||||
AC_CHECK_PROGS([DOCBOOK2XTEXI], [docbook2x-texi db2x_docbook2texi])
|
||||
if test -z "$DOCBOOK2XTEXI" ; then
|
||||
if test "x$enable_doc" != "xno"; then
|
||||
- AC_MSG_ERROR([docbook2texi is required to build documentation])
|
||||
- else
|
||||
- unset DOCBOOK2XTEXI
|
||||
- AM_MISSING_PROG([DOCBOOK2XTEXI], [docbook2texi])
|
||||
+ AC_MSG_WARN([docbook2texi is required to build documentation])
|
||||
fi
|
||||
+ unset DOCBOOK2XTEXI
|
||||
+ AM_MISSING_PROG([DOCBOOK2XTEXI], [docbook2texi])
|
||||
fi
|
||||
|
||||
AC_CHECK_PROGS([XMLTO], [xmlto])
|
||||
diff --git a/winsup/doc/Makefile.am b/winsup/doc/Makefile.am
|
||||
index 650e0c9..55e9b95 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
|
||||
|
||||
@@ -35,8 +33,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
|
||||
@@ -76,7 +73,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 \
|
||||
@ -0,0 +1,28 @@
|
||||
From 355fc4566a62ec15f565737dac3e98bf5c1190a6 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 28/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 70e3363..673bb7b 100644
|
||||
--- a/winsup/cygwin/Makefile.am
|
||||
+++ b/winsup/cygwin/Makefile.am
|
||||
@@ -685,7 +685,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) $(NEW_DLL_NAME) $(DESTDIR)$(bindir)/$(DLL_NAME)
|
||||
@$(MKDIR_P) $(DESTDIR)$(toollibdir)
|
||||
108
msys2-runtime-3.4/0029-POSIX-ify-the-SHELL-variable.patch
Normal file
108
msys2-runtime-3.4/0029-POSIX-ify-the-SHELL-variable.patch
Normal file
@ -0,0 +1,108 @@
|
||||
From b8fcbc5f8f01b3e3b6854d50d6c7ad04c3acdd60 Mon Sep 17 00:00:00 2001
|
||||
From: Johannes Schindelin <johannes.schindelin@gmx.de>
|
||||
Date: Mon, 23 Nov 2015 20:03:11 +0100
|
||||
Subject: [PATCH 29/N] POSIX-ify the SHELL variable
|
||||
|
||||
When calling a non-MSys2 binary, all of the environment is converted from
|
||||
POSIX to Win32, including the SHELL environment variable. In Git for
|
||||
Windows, for example, `SHELL=/usr/bin/bash` is converted to
|
||||
`SHELL=C:\Program Files\Git\usr\bin\bash.exe` when calling the `git.exe`
|
||||
binary. This is appropriate because non-MSys2 binaries would not handle
|
||||
POSIX paths correctly.
|
||||
|
||||
Under certain circumstances, however, `git.exe` calls an *MSys2* binary in
|
||||
turn, such as `git config --edit` calling `vim.exe` unless Git is
|
||||
configured to use another editor specifically.
|
||||
|
||||
Now, when this "improved vi" calls shell commands, it uses that $SHELL
|
||||
variable *without quoting*, resulting in a nasty error:
|
||||
|
||||
C:\Program: No such file or directory
|
||||
|
||||
Many other programs behave in the same manner, assuming that $SHELL does
|
||||
not contain spaces and hence needs no quoting, unfortunately including
|
||||
some of Git's own scripts.
|
||||
|
||||
Therefore let's make sure that $SHELL gets "posified" again when entering
|
||||
MSys2 programs.
|
||||
|
||||
Earlier attempts by Git for Windows contributors claimed that adding
|
||||
`SHELL` to the `conv_envvars` array does not have the intended effect.
|
||||
These reports just missed that the `conv_start_chars` array (which makes
|
||||
the code more performant) needs to be adjusted, too.
|
||||
|
||||
Note that we set the `immediate` flag to `true` so that the environment
|
||||
variable is set immediately by the MSys2 runtime, i.e. not only spawned
|
||||
processes will see the POSIX-ified `SHELL` variable, but the MSys2 runtime
|
||||
*itself*, too.
|
||||
|
||||
This fixes https://github.com/git-for-windows/git/issues/542,
|
||||
https://github.com/git-for-windows/git/issues/498, and
|
||||
https://github.com/git-for-windows/git/issues/468.
|
||||
|
||||
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
|
||||
---
|
||||
winsup/cygwin/environ.cc | 8 +++++++-
|
||||
winsup/cygwin/local_includes/environ.h | 2 +-
|
||||
2 files changed, 8 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/winsup/cygwin/environ.cc b/winsup/cygwin/environ.cc
|
||||
index b285a7c..dad25b9 100644
|
||||
--- a/winsup/cygwin/environ.cc
|
||||
+++ b/winsup/cygwin/environ.cc
|
||||
@@ -323,6 +323,7 @@ static win_env conv_envvars[] =
|
||||
{NL ("HOME="), NULL, NULL, env_path_to_posix, env_path_to_win32, false},
|
||||
{NL ("LD_LIBRARY_PATH="), NULL, NULL,
|
||||
env_plist_to_posix, env_plist_to_win32, true},
|
||||
+ {NL ("SHELL="), NULL, NULL, env_path_to_posix, env_path_to_win32, true, true},
|
||||
{NL ("TMPDIR="), NULL, NULL, env_path_to_posix, env_path_to_win32, false},
|
||||
{NL ("TMP="), NULL, NULL, env_path_to_posix, env_path_to_win32, false},
|
||||
{NL ("TEMP="), NULL, NULL, env_path_to_posix, env_path_to_win32, false},
|
||||
@@ -351,7 +352,7 @@ static const unsigned char conv_start_chars[256] =
|
||||
WC, 0, 0, 0, WC, 0, 0, 0,
|
||||
/* 80 */
|
||||
/* P Q R S T U V W */
|
||||
- WC, 0, 0, 0, WC, 0, 0, 0,
|
||||
+ WC, 0, 0, WC, WC, 0, 0, 0,
|
||||
/* 88 */
|
||||
/* x Y Z */
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
@@ -380,6 +381,7 @@ win_env::operator = (struct win_env& x)
|
||||
toposix = x.toposix;
|
||||
towin32 = x.towin32;
|
||||
immediate = false;
|
||||
+ skip_if_empty = x.skip_if_empty;
|
||||
return *this;
|
||||
}
|
||||
|
||||
@@ -401,6 +403,8 @@ win_env::add_cache (const char *in_posix, const char *in_native)
|
||||
native = (char *) realloc (native, namelen + 1 + strlen (in_native));
|
||||
stpcpy (stpcpy (native, name), in_native);
|
||||
}
|
||||
+ else if (skip_if_empty && !*in_posix)
|
||||
+ native = (char *) calloc(1, 1);
|
||||
else
|
||||
{
|
||||
tmp_pathbuf tp;
|
||||
@@ -466,6 +470,8 @@ posify_maybe (char **here, const char *value, char *outenv)
|
||||
return;
|
||||
|
||||
int len = strcspn (src, "=") + 1;
|
||||
+ if (conv->skip_if_empty && !src[len])
|
||||
+ return;
|
||||
|
||||
/* Turn all the items from c:<foo>;<bar> into their
|
||||
mounted equivalents - if there is one. */
|
||||
diff --git a/winsup/cygwin/local_includes/environ.h b/winsup/cygwin/local_includes/environ.h
|
||||
index 0dd4535..fd6ca46 100644
|
||||
--- a/winsup/cygwin/local_includes/environ.h
|
||||
+++ b/winsup/cygwin/local_includes/environ.h
|
||||
@@ -21,7 +21,7 @@ struct win_env
|
||||
char *native;
|
||||
ssize_t (*toposix) (const void *, void *, size_t);
|
||||
ssize_t (*towin32) (const void *, void *, size_t);
|
||||
- bool immediate;
|
||||
+ bool immediate, skip_if_empty;
|
||||
void add_cache (const char *in_posix, const char *in_native = NULL);
|
||||
const char * get_native () const {return native ? native + namelen : NULL;}
|
||||
const char * get_posix () const {return posix ? posix : NULL;}
|
||||
@ -0,0 +1,48 @@
|
||||
From 9ec56bee08c6cd617db655328002182f3990de71 Mon Sep 17 00:00:00 2001
|
||||
From: Johannes Schindelin <johannes.schindelin@gmx.de>
|
||||
Date: Tue, 21 Mar 2017 13:18:38 +0100
|
||||
Subject: [PATCH 30/N] Handle ORIGINAL_PATH just like PATH
|
||||
|
||||
MSYS2 recently introduced that hack where the ORIGINAL_PATH variable is
|
||||
set to the original PATH value in /etc/profile, unless previously set.
|
||||
In Git for Windows' default mode, that ORIGINAL_PATH value is the used
|
||||
to define the PATH variable explicitly.
|
||||
|
||||
So far so good.
|
||||
|
||||
The problem: when calling from inside an MSYS2 process (such as Bash) a
|
||||
MINGW executable (such as git.exe) that then calls another MSYS2
|
||||
executable (such as bash.exe), that latter call will try to re-convert
|
||||
ORIGINAL_PATH after the previous call converted ORIGINAL_PATH from POSIX
|
||||
to Windows paths. And this conversion may very well fail, e.g. when the
|
||||
path list contains mixed semicolons and colons.
|
||||
|
||||
So let's just *force* the MSYS2 runtime to handle ORIGINAL_PATH in the
|
||||
same way as the PATH variable (which conversion works, as we know).
|
||||
|
||||
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
|
||||
---
|
||||
winsup/cygwin/environ.cc | 3 ++-
|
||||
1 file changed, 2 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/winsup/cygwin/environ.cc b/winsup/cygwin/environ.cc
|
||||
index dad25b9..ffb1d5e 100644
|
||||
--- a/winsup/cygwin/environ.cc
|
||||
+++ b/winsup/cygwin/environ.cc
|
||||
@@ -323,6 +323,7 @@ static win_env conv_envvars[] =
|
||||
{NL ("HOME="), NULL, NULL, env_path_to_posix, env_path_to_win32, false},
|
||||
{NL ("LD_LIBRARY_PATH="), NULL, NULL,
|
||||
env_plist_to_posix, env_plist_to_win32, true},
|
||||
+ {NL ("ORIGINAL_PATH="), NULL, NULL, env_PATH_to_posix, env_plist_to_win32, true},
|
||||
{NL ("SHELL="), NULL, NULL, env_path_to_posix, env_path_to_win32, true, true},
|
||||
{NL ("TMPDIR="), NULL, NULL, env_path_to_posix, env_path_to_win32, false},
|
||||
{NL ("TMP="), NULL, NULL, env_path_to_posix, env_path_to_win32, false},
|
||||
@@ -349,7 +350,7 @@ static const unsigned char conv_start_chars[256] =
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
/* 72 */
|
||||
/* H I J K L M N O */
|
||||
- WC, 0, 0, 0, WC, 0, 0, 0,
|
||||
+ WC, 0, 0, 0, WC, 0, 0, WC,
|
||||
/* 80 */
|
||||
/* P Q R S T U V W */
|
||||
WC, 0, 0, WC, WC, 0, 0, 0,
|
||||
@ -0,0 +1,82 @@
|
||||
From b37e2d99550cbf816b57fac4130f355479511f25 Mon Sep 17 00:00:00 2001
|
||||
From: Christoph Reiter <reiter.christoph@gmail.com>
|
||||
Date: Sun, 3 Jul 2022 22:39:32 +0200
|
||||
Subject: [PATCH 31/N] uname: allow setting the system name to CYGWIN
|
||||
|
||||
We are currently trying to move our cygwin build environment closer
|
||||
to cygwin and some autotools/bash based build systems call "uname -s"
|
||||
to figure out the OS and in many cases only handle the cygwin case, so
|
||||
we have to patch them.
|
||||
|
||||
With this instead of patching we can set MSYSTEM=CYGWIN and change
|
||||
uname output that way.
|
||||
|
||||
The next step would be to always output CYGWIN in an msys env by default,
|
||||
but for now this allows us to get rid of all the patches without
|
||||
affecting users.
|
||||
---
|
||||
winsup/cygwin/uname.cc | 36 ++++++++++++++++++++++--------------
|
||||
1 file changed, 22 insertions(+), 14 deletions(-)
|
||||
|
||||
diff --git a/winsup/cygwin/uname.cc b/winsup/cygwin/uname.cc
|
||||
index 0d0c5aa..a4ac0e3 100644
|
||||
--- a/winsup/cygwin/uname.cc
|
||||
+++ b/winsup/cygwin/uname.cc
|
||||
@@ -24,6 +24,24 @@ extern "C" int getdomainname (char *__name, size_t __len);
|
||||
#define ATTRIBUTE_NONSTRING
|
||||
#endif
|
||||
|
||||
+static const char*
|
||||
+get_sysname()
|
||||
+{
|
||||
+#ifdef __MSYS__
|
||||
+ char* msystem = getenv("MSYSTEM");
|
||||
+ if (!msystem || strcmp(msystem, "MSYS") == 0)
|
||||
+ return "MSYS";
|
||||
+ else if (strcmp(msystem, "CYGWIN") == 0)
|
||||
+ return "CYGWIN";
|
||||
+ else if (strstr(msystem, "32") != NULL)
|
||||
+ return "MINGW32";
|
||||
+ else
|
||||
+ return "MINGW64";
|
||||
+#else
|
||||
+ return "CYGWIN";
|
||||
+#endif
|
||||
+}
|
||||
+
|
||||
/* uname: POSIX 4.4.1.1 */
|
||||
|
||||
/* New entrypoint for applications since API 335 */
|
||||
@@ -36,12 +54,9 @@ uname_x (struct utsname *name)
|
||||
|
||||
memset (name, 0, sizeof (*name));
|
||||
/* sysname */
|
||||
- char* msystem = getenv("MSYSTEM");
|
||||
- const char* msystem_sysname = "MSYS";
|
||||
- if (msystem != NULL && *msystem && strcmp(msystem, "MSYS") != 0)
|
||||
- msystem_sysname = (strstr(msystem, "32") != NULL) ? "MINGW32" : "MINGW64";;
|
||||
+ const char* sysname = get_sysname();
|
||||
__small_sprintf (name->sysname, "%s_%s-%u",
|
||||
- msystem_sysname,
|
||||
+ sysname,
|
||||
wincap.osname (), wincap.build_number ());
|
||||
/* nodename */
|
||||
memset (buf, 0, sizeof buf);
|
||||
@@ -107,15 +122,8 @@ uname (struct utsname *in_name)
|
||||
__try
|
||||
{
|
||||
memset (name, 0, sizeof (*name));
|
||||
-#ifdef __MSYS__
|
||||
- char* msystem = getenv("MSYSTEM");
|
||||
- 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
|
||||
+ const char* sysname = get_sysname();
|
||||
+ __small_sprintf (name->sysname, "%s_%s", sysname, wincap.osname ());
|
||||
|
||||
/* Computer name */
|
||||
cygwin_gethostname (name->nodename, sizeof (name->nodename) - 1);
|
||||
@ -0,0 +1,45 @@
|
||||
From 59fdf7503496516e3583a665540b91eccd0626ce Mon Sep 17 00:00:00 2001
|
||||
From: Johannes Schindelin <johannes.schindelin@gmx.de>
|
||||
Date: Wed, 18 Feb 2015 12:32:17 +0000
|
||||
Subject: [PATCH 32/N] Pass environment variables with empty values
|
||||
|
||||
There is a difference between an empty value and an unset environment
|
||||
variable. We should not confuse both; If the user wants to unset an
|
||||
environment variable, they can certainly do so (unsetenv(3), or in the
|
||||
shell: 'unset ABC').
|
||||
|
||||
This fixes Git's t3301-notes.sh, which overrides environment variables
|
||||
with empty values.
|
||||
|
||||
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
|
||||
---
|
||||
winsup/cygwin/environ.cc | 6 +++---
|
||||
1 file changed, 3 insertions(+), 3 deletions(-)
|
||||
|
||||
diff --git a/winsup/cygwin/environ.cc b/winsup/cygwin/environ.cc
|
||||
index ffb1d5e..0152095 100644
|
||||
--- a/winsup/cygwin/environ.cc
|
||||
+++ b/winsup/cygwin/environ.cc
|
||||
@@ -1325,11 +1325,11 @@ build_env (const char * const *envp, PWCHAR &envblock, int &envc,
|
||||
Note that this doesn't stop invalid strings without '=' in it
|
||||
etc., but we're opting for speed here for now. Adding complete
|
||||
checking would be pretty expensive. */
|
||||
- if (len == 1 || !*rest)
|
||||
+ if (len == 1)
|
||||
continue;
|
||||
|
||||
/* See if this entry requires posix->win32 conversion. */
|
||||
- conv = getwinenv (*srcp, rest, &temp);
|
||||
+ conv = !*rest ? NULL : getwinenv (*srcp, rest, &temp);
|
||||
if (conv)
|
||||
{
|
||||
p = conv->native; /* Use win32 path */
|
||||
@@ -1343,7 +1343,7 @@ build_env (const char * const *envp, PWCHAR &envblock, int &envc,
|
||||
}
|
||||
}
|
||||
#ifdef __MSYS__
|
||||
- else if (!keep_posix) {
|
||||
+ else if (!keep_posix && *rest) {
|
||||
char *win_arg = arg_heuristic_with_exclusions
|
||||
(*srcp, msys2_env_conv_excl_env, msys2_env_conv_excl_count);
|
||||
debug_printf("WIN32_PATH is %s", win_arg);
|
||||
@ -0,0 +1,57 @@
|
||||
From 2a929f7b83d523f24fee28f8cf442ae6638cd7d4 Mon Sep 17 00:00:00 2001
|
||||
From: Johannes Schindelin <johannes.schindelin@gmx.de>
|
||||
Date: Tue, 6 Sep 2022 10:40:58 +0200
|
||||
Subject: [PATCH 33/N] Optionally disallow empty environment values again
|
||||
|
||||
We just disabled the code that skips environment variables whose values
|
||||
are empty.
|
||||
|
||||
However, this code was introduced a long time ago into Cygwin in
|
||||
d6b1ac7faa (* environ.cc (build_env): Don't put an empty environment
|
||||
variable into the environment. Optimize use of "len". * errno.cc
|
||||
(ERROR_MORE_DATA): Translate to EMSGSIZE rather than EAGAIN.,
|
||||
2006-09-07), seemingly without any complaints.
|
||||
|
||||
Meaning: There might very well be use cases out there where it makes
|
||||
sense to skip empty-valued environment variables.
|
||||
|
||||
Therefore, it seems like a good idea to have a "knob" to turn it back
|
||||
on. With this commit, we introduce such a knob: by setting
|
||||
`noemptyenvvalues` the `MSYS` variable (or appending it if that variable
|
||||
is already set), users can tell the MSYS2 runtime to behave just like in
|
||||
the olden times.
|
||||
|
||||
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
|
||||
---
|
||||
winsup/cygwin/environ.cc | 4 +++-
|
||||
1 file changed, 3 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/winsup/cygwin/environ.cc b/winsup/cygwin/environ.cc
|
||||
index 0152095..a1abbb5 100644
|
||||
--- a/winsup/cygwin/environ.cc
|
||||
+++ b/winsup/cygwin/environ.cc
|
||||
@@ -36,6 +36,7 @@ static char **lastenviron;
|
||||
/* Parse CYGWIN options */
|
||||
|
||||
static NO_COPY bool export_settings = false;
|
||||
+static bool emptyenvvalues = true;
|
||||
|
||||
enum settings
|
||||
{
|
||||
@@ -130,6 +131,7 @@ static struct parse_thing
|
||||
{"enable_pcon", {&disable_pcon}, setnegbool, NULL, {{true}, {false}}},
|
||||
{"winjitdebug", {&winjitdebug}, setbool, NULL, {{false}, {true}}},
|
||||
{"nativeinnerlinks", {&nativeinnerlinks}, setbool, NULL, {{false}, {true}}},
|
||||
+ {"emptyenvvalues", {&emptyenvvalues}, setbool, NULL, {{false}, {true}}},
|
||||
{NULL, {0}, setdword, 0, {{0}, {0}}}
|
||||
};
|
||||
|
||||
@@ -1325,7 +1327,7 @@ build_env (const char * const *envp, PWCHAR &envblock, int &envc,
|
||||
Note that this doesn't stop invalid strings without '=' in it
|
||||
etc., but we're opting for speed here for now. Adding complete
|
||||
checking would be pretty expensive. */
|
||||
- if (len == 1)
|
||||
+ if (len == 1 || (!emptyenvvalues && !*rest))
|
||||
continue;
|
||||
|
||||
/* See if this entry requires posix->win32 conversion. */
|
||||
@ -0,0 +1,34 @@
|
||||
From c61a2cad2fc3969b7dae2e5abb5f36cb21b91f1f Mon Sep 17 00:00:00 2001
|
||||
From: Johannes Schindelin <johannes.schindelin@gmx.de>
|
||||
Date: Tue, 6 Sep 2022 12:18:18 +0200
|
||||
Subject: [PATCH 34/N] build_env(): respect the `MSYS` environment variable
|
||||
|
||||
With this commit, you can call
|
||||
|
||||
MSYS=noemptyenvvalues my-command
|
||||
|
||||
and it does what is expected: to pass no empty-valued environment
|
||||
variables to `my-command`.
|
||||
|
||||
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
|
||||
---
|
||||
winsup/cygwin/environ.cc | 6 +++++-
|
||||
1 file changed, 5 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/winsup/cygwin/environ.cc b/winsup/cygwin/environ.cc
|
||||
index a1abbb5..0899aa0 100644
|
||||
--- a/winsup/cygwin/environ.cc
|
||||
+++ b/winsup/cygwin/environ.cc
|
||||
@@ -1203,7 +1203,11 @@ build_env (const char * const *envp, PWCHAR &envblock, int &envc,
|
||||
{
|
||||
bool calc_tl = !no_envblock;
|
||||
#ifdef __MSYS__
|
||||
- if (!keep_posix)
|
||||
+ if (ascii_strncasematch(*srcp, "MSYS=", 5))
|
||||
+ {
|
||||
+ parse_options (*srcp + 5);
|
||||
+ }
|
||||
+ else if (!keep_posix)
|
||||
{
|
||||
/* Don't pass timezone environment to non-msys applications */
|
||||
if (ascii_strncasematch(*srcp, "TZ=", 3))
|
||||
@ -0,0 +1,33 @@
|
||||
From ae05533855590aa8cf25baf12d1cfa4c4060bcad Mon Sep 17 00:00:00 2001
|
||||
From: Johannes Schindelin <johannes.schindelin@gmx.de>
|
||||
Date: Tue, 8 Nov 2022 16:24:20 +0100
|
||||
Subject: [PATCH 35/N] When converting to a Unix path, avoid double trailing
|
||||
slashes
|
||||
|
||||
When calling `cygpath -u C:/msys64/` in an MSYS2 setup that was
|
||||
installed into `C:/msys64/`, the result should be `/`, not `//`.
|
||||
|
||||
Let's ensure that we do not append another trailing slash if the
|
||||
converted path already ends in a slash.
|
||||
|
||||
This fixes https://github.com/msys2/msys2-runtime/issues/112
|
||||
|
||||
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
|
||||
---
|
||||
winsup/cygwin/mount.cc | 3 +++
|
||||
1 file changed, 3 insertions(+)
|
||||
|
||||
diff --git a/winsup/cygwin/mount.cc b/winsup/cygwin/mount.cc
|
||||
index 939578a..37152fb 100644
|
||||
--- a/winsup/cygwin/mount.cc
|
||||
+++ b/winsup/cygwin/mount.cc
|
||||
@@ -954,6 +954,9 @@ mount_info::conv_to_posix_path (const char *src_path, char *posix_path,
|
||||
nextchar = 1;
|
||||
|
||||
int addslash = nextchar > 0 ? 1 : 0;
|
||||
+ /* avoid appending a slash if the result already has a trailing slash */
|
||||
+ if (append_slash && mi.posix_pathlen && mi.posix_path[mi.posix_pathlen-1] == '/')
|
||||
+ append_slash = addslash = 0;
|
||||
if ((mi.posix_pathlen + (pathbuflen - mi.native_pathlen) + addslash) >= NT_MAX_PATH)
|
||||
return ENAMETOOLONG;
|
||||
strcpy (posix_path, mi.posix_path);
|
||||
@ -0,0 +1,38 @@
|
||||
From 4f9b45e2f3f8f474632fb04cf3217bfcd0362008 Mon Sep 17 00:00:00 2001
|
||||
From: Christoph Reiter <reiter.christoph@gmail.com>
|
||||
Date: Sun, 20 Nov 2022 13:57:36 +0100
|
||||
Subject: [PATCH 36/N] msys2_path_conv: pass PC_NOFULL to path_conv
|
||||
|
||||
In theory this doesn't make a difference because posix_to_win32_path()
|
||||
is only called with rooted/absolute paths, but as pointed out in
|
||||
https://github.com/msys2/msys2-runtime/pull/103 PC_NOFULL will preserve
|
||||
the trailing slash of unix paths (for some reason).
|
||||
|
||||
See "cygpath -m /bin/" (preserved) vs "cygpath -am /bin/" (dropped)
|
||||
|
||||
One use case where we need to trailing slashes to be preserved is the GCC build
|
||||
system:
|
||||
https://github.com/gcc-mirror/gcc/blob/6d82e0fea5f988e829912a/gcc/Makefile.in#L2314
|
||||
|
||||
The Makefile appends a slash to the prefixes and the C code doing relocation will
|
||||
treat the path as a directory if there is a trailing slash. See
|
||||
https://github.com/msys2/MINGW-packages/issues/14173 for details.
|
||||
|
||||
With this change all our MSYS2 path_conv tests pass again.
|
||||
---
|
||||
winsup/cygwin/msys2_path_conv.cc | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/winsup/cygwin/msys2_path_conv.cc b/winsup/cygwin/msys2_path_conv.cc
|
||||
index 2ac1517..5c59291 100644
|
||||
--- a/winsup/cygwin/msys2_path_conv.cc
|
||||
+++ b/winsup/cygwin/msys2_path_conv.cc
|
||||
@@ -626,7 +626,7 @@ void posix_to_win32_path(const char* from, const char* to, char** dst, const cha
|
||||
strncpy(one_path, from, to-from);
|
||||
one_path[to-from] = '\0';
|
||||
|
||||
- path_conv conv (one_path, 0);
|
||||
+ path_conv conv (one_path, PC_NOFULL);
|
||||
if (conv.error)
|
||||
{
|
||||
set_errno(conv.error);
|
||||
@ -0,0 +1,28 @@
|
||||
From dc56727377ac713252819b0c2218d34a7d72ae92 Mon Sep 17 00:00:00 2001
|
||||
From: Christoph Reiter <reiter.christoph@gmail.com>
|
||||
Date: Sat, 17 Dec 2022 20:14:49 +0100
|
||||
Subject: [PATCH 37/N] Revert "Cygwin: Enable dynamicbase on the Cygwin DLL by
|
||||
default"
|
||||
|
||||
This reverts commit 943433b00cacdde0cb9507d0178770a2fb67bd71.
|
||||
|
||||
This seems to fix fork errors under Docker, see
|
||||
https://cygwin.com/pipermail/cygwin/2022-December/252711.html
|
||||
---
|
||||
winsup/cygwin/Makefile.am | 3 +--
|
||||
1 file changed, 1 insertion(+), 2 deletions(-)
|
||||
|
||||
diff --git a/winsup/cygwin/Makefile.am b/winsup/cygwin/Makefile.am
|
||||
index 673bb7b..ec782dc 100644
|
||||
--- a/winsup/cygwin/Makefile.am
|
||||
+++ b/winsup/cygwin/Makefile.am
|
||||
@@ -585,8 +585,7 @@ $(NEW_DLL_NAME): $(LDSCRIPT) libdll.a $(VERSION_OFILES) $(LIBSERVER)\
|
||||
$(newlib_build)/libm.a $(newlib_build)/libc.a
|
||||
$(AM_V_CXXLD)$(CXX) $(CXXFLAGS) \
|
||||
-mno-use-libstdc-wrappers \
|
||||
- -Wl,--gc-sections -nostdlib -Wl,-T$(LDSCRIPT) \
|
||||
- -Wl,--dynamicbase -static \
|
||||
+ -Wl,--gc-sections -nostdlib -Wl,-T$(LDSCRIPT) -static \
|
||||
-Wl,--heap=0 -Wl,--out-implib,msysdll.a -shared -o $@ \
|
||||
-e @DLL_ENTRY@ $(DEF_FILE) \
|
||||
-Wl,-whole-archive libdll.a -Wl,-no-whole-archive \
|
||||
@ -0,0 +1,51 @@
|
||||
From 58e01d2be06adfd9fb70615bf50750635a880a26 Mon Sep 17 00:00:00 2001
|
||||
From: Johannes Schindelin <johannes.schindelin@gmx.de>
|
||||
Date: Wed, 1 Feb 2023 15:08:16 +0100
|
||||
Subject: [PATCH 38/N] dumper: avoid linker problem when `libbfd` depends on
|
||||
`libsframe`
|
||||
|
||||
A recent binutils version introduced `libsframe` and made it a
|
||||
dependency of `libbfd`. This caused a linker problem in the MSYS2
|
||||
project, and once Cygwin upgrades to that binutils version it would
|
||||
cause the same problems there.
|
||||
|
||||
Let's preemptively detect the presence of `libsframe` and if detected,
|
||||
link to it in addition to `libbfd`.
|
||||
|
||||
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
|
||||
---
|
||||
winsup/configure.ac | 5 +++++
|
||||
winsup/utils/Makefile.am | 4 ++++
|
||||
2 files changed, 9 insertions(+)
|
||||
|
||||
diff --git a/winsup/configure.ac b/winsup/configure.ac
|
||||
index e55e19a..59b77fe 100644
|
||||
--- a/winsup/configure.ac
|
||||
+++ b/winsup/configure.ac
|
||||
@@ -129,6 +129,11 @@ AC_CHECK_LIB([sframe], [sframe_decode], [BFD_LIBS="${BFD_LIBS} -lsframe"])
|
||||
AC_CHECK_LIB([zstd], [ZSTD_isError], [BFD_LIBS="${BFD_LIBS} -lzstd"])
|
||||
AC_SUBST([BFD_LIBS])
|
||||
|
||||
+AC_CHECK_LIB([sframe], [sframe_decode],
|
||||
+ AC_MSG_NOTICE([Detected libsframe; Assuming that libbfd depends on it]), [true])
|
||||
+
|
||||
+AM_CONDITIONAL(HAVE_LIBSFRAME, [test "x$ac_cv_lib_sframe_sframe_decode" = "xyes"])
|
||||
+
|
||||
AC_CONFIG_FILES([
|
||||
Makefile
|
||||
cygwin/Makefile
|
||||
diff --git a/winsup/utils/Makefile.am b/winsup/utils/Makefile.am
|
||||
index fa6499d..f10335e 100644
|
||||
--- a/winsup/utils/Makefile.am
|
||||
+++ b/winsup/utils/Makefile.am
|
||||
@@ -88,6 +88,10 @@ profiler_CXXFLAGS = -I$(srcdir) -idirafter ${top_srcdir}/cygwin/local_includes -
|
||||
profiler_LDADD = $(LDADD) -lntdll
|
||||
cygps_LDADD = $(LDADD) -lpsapi -lntdll
|
||||
|
||||
+if HAVE_LIBSFRAME
|
||||
+dumper_LDADD += -lsframe
|
||||
+endif
|
||||
+
|
||||
if CROSS_BOOTSTRAP
|
||||
SUBDIRS = mingw
|
||||
endif
|
||||
@ -0,0 +1,55 @@
|
||||
From 4f2214a1d6349884135f0485a36e3bfad31350a2 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?=EB=A7=88=EB=88=84=EC=97=98?= <nalla@hamal.uberspace.de>
|
||||
Date: Wed, 17 Jun 2015 09:30:41 +0200
|
||||
Subject: [PATCH 39/N] path-conversion: Introduce ability to switch off
|
||||
conversion.
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
When calling windows native apps from MSYS2, the runtime tries to
|
||||
convert commandline arguments by a specific set of rules. This idea was
|
||||
inherited from the MSys/MinGW project (which is now seemingly stale, yet
|
||||
must be credited with championing this useful feature, see MinGW wiki
|
||||
https://web.archive.org/web/20201112005258/http://www.mingw.org/wiki/Posix_path_conversion).
|
||||
|
||||
If the user does not want that behavior on a big scale, e.g. inside a
|
||||
Bash script, with the changes introduced in this commit, the user can
|
||||
now set the the environment variable `MSYS_NO_PATHCONV` when calling
|
||||
native windows commands.
|
||||
|
||||
This is a feature that has been introduced in Git for Windows via
|
||||
https://github.com/git-for-windows/msys2-runtime/pull/11 and it predates
|
||||
support for the `MSYS2_ENV_CONV_EXCL` and `MSYS2_ARG_CONV_EXCL`
|
||||
environment variables in the MSYS2 runtime; Many users find the
|
||||
simplicity of `MSYS_NO_PATHCONV` appealing.
|
||||
|
||||
So let's teach MSYS2 proper this simple trick that still allows using
|
||||
the sophisticated `MSYS2_*_CONV_EXCL` facilities but also offers a
|
||||
convenient catch-all "just don't convert anything" knob.
|
||||
|
||||
Signed-off-by: 마누엘 <nalla@hamal.uberspace.de>
|
||||
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
|
||||
---
|
||||
winsup/cygwin/msys2_path_conv.cc | 8 ++++++++
|
||||
1 file changed, 8 insertions(+)
|
||||
|
||||
diff --git a/winsup/cygwin/msys2_path_conv.cc b/winsup/cygwin/msys2_path_conv.cc
|
||||
index 5c59291..875be6f 100644
|
||||
--- a/winsup/cygwin/msys2_path_conv.cc
|
||||
+++ b/winsup/cygwin/msys2_path_conv.cc
|
||||
@@ -341,6 +341,14 @@ path_type find_path_start_and_type(const char** src, int recurse, const char* en
|
||||
|
||||
if (*it == '\0' || it == end) return NONE;
|
||||
|
||||
+ /*
|
||||
+ * Skip path mangling when environment indicates it.
|
||||
+ */
|
||||
+ const char *no_pathconv = getenv ("MSYS_NO_PATHCONV");
|
||||
+
|
||||
+ if (no_pathconv)
|
||||
+ return NONE;
|
||||
+
|
||||
while (!isalnum(*it) && *it != '/' && *it != '\\' && *it != ':' && *it != '-' && *it != '.') {
|
||||
recurse = true;
|
||||
it = ++*src;
|
||||
@ -0,0 +1,58 @@
|
||||
From 7f5ce2cb55bf18020a68f88c2861ea862feb8178 Mon Sep 17 00:00:00 2001
|
||||
From: Johannes Schindelin <johannes.schindelin@gmx.de>
|
||||
Date: Sun, 15 Feb 2015 11:45:48 +0000
|
||||
Subject: [PATCH 40/N] fixup! Add functionality for converting UNIX paths in
|
||||
arguments and environment variables to Windows form for native Win32
|
||||
applications.
|
||||
|
||||
This teaches MSYS2's path conversion to leave arguments starting with a
|
||||
tilde or quote alone: It is not a good idea to expand, say, ~/.gitconfig
|
||||
partially: replacing it by ~C:\msys64\.gitconfig is most likely the
|
||||
wrong thing to do!
|
||||
|
||||
This addresses the expectations of the following test cases in the test
|
||||
suite of https://github.com/git/git/tree/v2.43.0:
|
||||
|
||||
-t0001.19 init with init.templatedir using ~ expansion
|
||||
-t0003.12 core.attributesfile
|
||||
-t0003.13 attribute test: read paths from stdin
|
||||
-t0003.15 attribute test: --all option
|
||||
-t0003.16 attribute test: --cached option
|
||||
-t0003.17 root subdir attribute test
|
||||
-t0003.18 negative patterns
|
||||
-t0003.19 patterns starting with exclamation
|
||||
-t0003.20 "**" test
|
||||
-t0003.21 "**" with no slashes test
|
||||
-t0003.23 using --source
|
||||
-t0003.32 bare repository: check that --cached honors index
|
||||
-t0003.34 binary macro expanded by -a
|
||||
-t0003.35 query binary macro directly
|
||||
-t0003.40 large attributes line ignored in tree
|
||||
-t0003.41 large attributes line ignores trailing content in tree
|
||||
-t0003.43 large attributes line ignored in index
|
||||
-t0003.44 large attributes line ignores trailing content in index
|
||||
-t0068.1 run based on configured value
|
||||
|
||||
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
|
||||
---
|
||||
winsup/cygwin/msys2_path_conv.cc | 7 +++++++
|
||||
1 file changed, 7 insertions(+)
|
||||
|
||||
diff --git a/winsup/cygwin/msys2_path_conv.cc b/winsup/cygwin/msys2_path_conv.cc
|
||||
index 875be6f..35b7757 100644
|
||||
--- a/winsup/cygwin/msys2_path_conv.cc
|
||||
+++ b/winsup/cygwin/msys2_path_conv.cc
|
||||
@@ -349,6 +349,13 @@ path_type find_path_start_and_type(const char** src, int recurse, const char* en
|
||||
if (no_pathconv)
|
||||
return NONE;
|
||||
|
||||
+ /* Let's not convert ~/.file to ~C:\msys64\.file */
|
||||
+ if (*it == '~') {
|
||||
+skip_p2w:
|
||||
+ *src = end;
|
||||
+ return NONE;
|
||||
+ }
|
||||
+
|
||||
while (!isalnum(*it) && *it != '/' && *it != '\\' && *it != ':' && *it != '-' && *it != '.') {
|
||||
recurse = true;
|
||||
it = ++*src;
|
||||
@ -0,0 +1,88 @@
|
||||
From 4b20e4fc67735ce82bb47c60a6e8f46bbcb33127 Mon Sep 17 00:00:00 2001
|
||||
From: Johannes Schindelin <johannes.schindelin@gmx.de>
|
||||
Date: Wed, 18 Feb 2015 11:07:17 +0000
|
||||
Subject: [PATCH 41/N] fixup! Add functionality for converting UNIX paths in
|
||||
arguments and environment variables to Windows form for native Win32
|
||||
applications.
|
||||
|
||||
Let's teach MSYS2's path conversion to leave Git's :name and :/message
|
||||
arguments alone, please. These arguments start with colons and are hence
|
||||
unlikely to contain a path list (a path list starting with a colon would
|
||||
start with an empty item?!?).
|
||||
|
||||
Without this patch, you will see this:
|
||||
|
||||
$ GIT_TRACE=1 /c/Program\ Files/Git/cmd/git version :/message
|
||||
13:48:44.258390 exec-cmd.c:244 trace: resolved executable dir: C:/Program Files/Git/mingw64/bin
|
||||
13:48:44.269314 git.c:463 trace: built-in: git version ';C:\msys64\message'
|
||||
git version 2.43.0.windows.1
|
||||
|
||||
In other words, the argument `:/message` is mangled in an undesired way.
|
||||
|
||||
This addresses the expectations of the following test cases in the test
|
||||
suite of https://github.com/git/git/tree/v2.43.0:
|
||||
|
||||
-t0060.81 <drive-letter>:\\abc is an absolute path
|
||||
-t1501.35 Auto discovery
|
||||
-t1501.36 $GIT_DIR/common overrides core.worktree
|
||||
-t1501.37 $GIT_WORK_TREE overrides $GIT_DIR/common
|
||||
-t1506.3 correct relative file objects (0)
|
||||
-t1506.8 correct relative file objects (5)
|
||||
-t1506.9 correct relative file objects (6)
|
||||
-t2070.7 restore --staged uses HEAD as source
|
||||
-t3013.16 git ls-files --format with relative path
|
||||
-t3400.6 rebase, with <onto> and <upstream> specified as :/quuxery
|
||||
-t3404.84 rebase -i, with <onto> and <upstream> specified as :/quuxery
|
||||
-t3703.2 add :/
|
||||
-t3703.3 add :/anothersub
|
||||
-t4202.8 oneline
|
||||
-t4202.22 git log --no-walk <commits> sorts by commit time
|
||||
-t4202.23 git log --no-walk=sorted <commits> sorts by commit time
|
||||
-t4202.24 git log --line-prefix="=== " --no-walk <commits> sorts by commit time
|
||||
-t4202.25 git log --no-walk=unsorted <commits> leaves list of commits as given
|
||||
-t4202.26 git show <commits> leaves list of commits as given
|
||||
-t4202.138 log --source paints branch names
|
||||
-t4202.139 log --source paints tag names
|
||||
-t4202.140 log --source paints symmetric ranges
|
||||
-t4208.2 "git log :/" should not be ambiguous
|
||||
-t4208.3 "git log :/a" should be ambiguous (applied both rev and worktree)
|
||||
-t4208.4 "git log :/a -- " should not be ambiguous
|
||||
-t4208.5 "git log :/detached -- " should find a commit only in HEAD
|
||||
-t4208.7 "git log :/detached -- " should find HEAD only of own worktree
|
||||
-t4208.10 "git log :/in" should not be ambiguous
|
||||
-t4208.13 git log HEAD -- :/
|
||||
-t5616.43 lazy-fetch in submodule succeeds
|
||||
-t6132.7 t_e_i() exclude sub2 from sub
|
||||
-t6132.14 m_p_d() exclude sub2 from sub
|
||||
-t6132.19 grep --untracked PATTERN
|
||||
-t6132.21 grep --untracked PATTERN :(exclude)*FILE
|
||||
-t6133.6 :/*.t from a subdir dwims to a pathspec
|
||||
-t7201.14 checkout to detach HEAD with :/message
|
||||
-t9903.37 prompt - untracked files status indicator - untracked files
|
||||
-t9903.39 prompt - untracked files status indicator - non-empty untracked dir
|
||||
-t9903.40 prompt - untracked files status indicator - untracked files outside cwd
|
||||
-t9903.44 prompt - untracked files status indicator - shell variable set with config enabled
|
||||
-t9903.56 prompt - bash color pc mode - untracked files status indicator
|
||||
|
||||
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
|
||||
---
|
||||
winsup/cygwin/msys2_path_conv.cc | 6 ++++++
|
||||
1 file changed, 6 insertions(+)
|
||||
|
||||
diff --git a/winsup/cygwin/msys2_path_conv.cc b/winsup/cygwin/msys2_path_conv.cc
|
||||
index 35b7757..8870d38 100644
|
||||
--- a/winsup/cygwin/msys2_path_conv.cc
|
||||
+++ b/winsup/cygwin/msys2_path_conv.cc
|
||||
@@ -356,6 +356,12 @@ skip_p2w:
|
||||
return NONE;
|
||||
}
|
||||
|
||||
+ /*
|
||||
+ * Prevent Git's :file.txt and :/message syntax from beeing modified.
|
||||
+ */
|
||||
+ if (*it == ':')
|
||||
+ goto skip_p2w;
|
||||
+
|
||||
while (!isalnum(*it) && *it != '/' && *it != '\\' && *it != ':' && *it != '-' && *it != '.') {
|
||||
recurse = true;
|
||||
it = ++*src;
|
||||
@ -0,0 +1,145 @@
|
||||
From cfc7696e0825563fb4245377ab70887cde160cd1 Mon Sep 17 00:00:00 2001
|
||||
From: Johannes Schindelin <johannes.schindelin@gmx.de>
|
||||
Date: Sun, 22 Feb 2015 18:33:48 +0100
|
||||
Subject: [PATCH 42/N] fixup! Add functionality for converting UNIX paths in
|
||||
arguments and environment variables to Windows form for native Win32
|
||||
applications.
|
||||
|
||||
With this change, MSYS2's path conversion leaves paths containing any
|
||||
special characters alone.
|
||||
|
||||
This addresses the expectations of the following test cases in the test
|
||||
suite of https://github.com/git/git/tree/v2.43.0:
|
||||
|
||||
-t1091.13 set sparse-checkout using builtin
|
||||
-t1092.82 grep sparse directory within submodules
|
||||
-t1402.56 ref name '*/foo' is valid with options --refspec-pattern
|
||||
-t1402.57 ref name '*/foo' is valid with options --refspec-pattern --allow-onelevel
|
||||
-t1402.59 ref name '*/foo' is valid with options --refspec-pattern --normalize
|
||||
-t3001.25 ls-files with "**" patterns
|
||||
-t3001.26 ls-files with "**" patterns and --directory
|
||||
-t3070.423 wildmatch: match 'foo' '**/foo'
|
||||
-t3070.425 iwildmatch: match 'foo' '**/foo'
|
||||
-t3070.433 wildmatch: match 'XXX/foo' '**/foo'
|
||||
-t3070.435 iwildmatch: match 'XXX/foo' '**/foo'
|
||||
-t3070.437 pathmatch: match 'XXX/foo' '**/foo'
|
||||
-t3070.439 ipathmatch: match 'XXX/foo' '**/foo'
|
||||
-t3070.443 wildmatch: match 'bar/baz/foo' '**/foo'
|
||||
-t3070.445 iwildmatch: match 'bar/baz/foo' '**/foo'
|
||||
-t3070.447 pathmatch: match 'bar/baz/foo' '**/foo'
|
||||
-t3070.449 ipathmatch: match 'bar/baz/foo' '**/foo'
|
||||
-t3070.457 pathmatch: match 'bar/baz/foo' '*/foo'
|
||||
-t3070.459 ipathmatch: match 'bar/baz/foo' '*/foo'
|
||||
-t3070.467 pathmatch: match 'foo/bar/baz' '**/bar*'
|
||||
-t3070.469 ipathmatch: match 'foo/bar/baz' '**/bar*'
|
||||
-t3070.473 wildmatch: match 'deep/foo/bar/baz' '**/bar/*'
|
||||
-t3070.475 iwildmatch: match 'deep/foo/bar/baz' '**/bar/*'
|
||||
-t3070.477 pathmatch: match 'deep/foo/bar/baz' '**/bar/*'
|
||||
-t3070.479 ipathmatch: match 'deep/foo/bar/baz' '**/bar/*'
|
||||
-t3070.487 pathmatch: match 'deep/foo/bar/baz/' '**/bar/*'
|
||||
-t3070.489 ipathmatch: match 'deep/foo/bar/baz/' '**/bar/*'
|
||||
-t3070.493 wildmatch: match 'deep/foo/bar/baz/' '**/bar/**'
|
||||
-t3070.495 iwildmatch: match 'deep/foo/bar/baz/' '**/bar/**'
|
||||
-t3070.497 pathmatch: match 'deep/foo/bar/baz/' '**/bar/**'
|
||||
-t3070.499 ipathmatch: match 'deep/foo/bar/baz/' '**/bar/**'
|
||||
-t3070.513 wildmatch: match 'deep/foo/bar/' '**/bar/**'
|
||||
-t3070.515 iwildmatch: match 'deep/foo/bar/' '**/bar/**'
|
||||
-t3070.517 pathmatch: match 'deep/foo/bar/' '**/bar/**'
|
||||
-t3070.519 ipathmatch: match 'deep/foo/bar/' '**/bar/**'
|
||||
-t3070.527 pathmatch: match 'foo/bar/baz' '**/bar**'
|
||||
-t3070.529 ipathmatch: match 'foo/bar/baz' '**/bar**'
|
||||
-t3070.533 wildmatch: match 'foo/bar/baz/x' '*/bar/**'
|
||||
-t3070.535 iwildmatch: match 'foo/bar/baz/x' '*/bar/**'
|
||||
-t3070.537 pathmatch: match 'foo/bar/baz/x' '*/bar/**'
|
||||
-t3070.539 ipathmatch: match 'foo/bar/baz/x' '*/bar/**'
|
||||
-t3070.547 pathmatch: match 'deep/foo/bar/baz/x' '*/bar/**'
|
||||
-t3070.549 ipathmatch: match 'deep/foo/bar/baz/x' '*/bar/**'
|
||||
-t3070.553 wildmatch: match 'deep/foo/bar/baz/x' '**/bar/*/*'
|
||||
-t3070.555 iwildmatch: match 'deep/foo/bar/baz/x' '**/bar/*/*'
|
||||
-t3070.557 pathmatch: match 'deep/foo/bar/baz/x' '**/bar/*/*'
|
||||
-t3070.559 ipathmatch: match 'deep/foo/bar/baz/x' '**/bar/*/*'
|
||||
-t3070.633 wildmatch: match 'XXX/\' '*/\\'
|
||||
-t3070.635 iwildmatch: match 'XXX/\' '*/\\'
|
||||
-t3070.637 pathmatch: match 'XXX/\' '*/\\'
|
||||
-t3070.639 ipathmatch: match 'XXX/\' '*/\\'
|
||||
-t3070.763 wildmatch: match 'foo/bar/baz/to' '**/t[o]'
|
||||
-t3070.765 iwildmatch: match 'foo/bar/baz/to' '**/t[o]'
|
||||
-t3070.767 pathmatch: match 'foo/bar/baz/to' '**/t[o]'
|
||||
-t3070.769 ipathmatch: match 'foo/bar/baz/to' '**/t[o]'
|
||||
-t3070.1493 wildmatch: match 'abcd/abcdefg/abcdefghijk/abcdefghijklmnop.txt' '**/*a*b*g*n*t'
|
||||
-t3070.1495 iwildmatch: match 'abcd/abcdefg/abcdefghijk/abcdefghijklmnop.txt' '**/*a*b*g*n*t'
|
||||
-t3070.1497 pathmatch: match 'abcd/abcdefg/abcdefghijk/abcdefghijklmnop.txt' '**/*a*b*g*n*t'
|
||||
-t3070.1499 ipathmatch: match 'abcd/abcdefg/abcdefghijk/abcdefghijklmnop.txt' '**/*a*b*g*n*t'
|
||||
-t3070.1533 wildmatch: match 'foo/bba/arr' '*/*/*'
|
||||
-t3070.1535 iwildmatch: match 'foo/bba/arr' '*/*/*'
|
||||
-t3070.1537 pathmatch: match 'foo/bba/arr' '*/*/*'
|
||||
-t3070.1539 ipathmatch: match 'foo/bba/arr' '*/*/*'
|
||||
-t3070.1547 pathmatch: match 'foo/bb/aa/rr' '*/*/*'
|
||||
-t3070.1549 ipathmatch: match 'foo/bb/aa/rr' '*/*/*'
|
||||
-t3070.1553 wildmatch: match 'foo/bb/aa/rr' '**/**/**'
|
||||
-t3070.1555 iwildmatch: match 'foo/bb/aa/rr' '**/**/**'
|
||||
-t3070.1557 pathmatch: match 'foo/bb/aa/rr' '**/**/**'
|
||||
-t3070.1559 ipathmatch: match 'foo/bb/aa/rr' '**/**/**'
|
||||
-t3070.1583 wildmatch: match 'ab/cXd/efXg/hi' '*/*X*/*/*i'
|
||||
-t3070.1585 iwildmatch: match 'ab/cXd/efXg/hi' '*/*X*/*/*i'
|
||||
-t3070.1587 pathmatch: match 'ab/cXd/efXg/hi' '*/*X*/*/*i'
|
||||
-t3070.1589 ipathmatch: match 'ab/cXd/efXg/hi' '*/*X*/*/*i'
|
||||
-t3070.1593 wildmatch: match 'ab/cXd/efXg/hi' '**/*X*/**/*i'
|
||||
-t3070.1595 iwildmatch: match 'ab/cXd/efXg/hi' '**/*X*/**/*i'
|
||||
-t3070.1597 pathmatch: match 'ab/cXd/efXg/hi' '**/*X*/**/*i'
|
||||
-t3070.1599 ipathmatch: match 'ab/cXd/efXg/hi' '**/*X*/**/*i'
|
||||
-t5500.154 fetch-pack --diag-url ./[::1]:repo
|
||||
-t5500.156 fetch-pack --diag-url ./[::1]:23:repo
|
||||
-t5500.165 fetch-pack --diag-url [::1]:/~repo
|
||||
-t5500.251 fetch-pack --diag-url ./[::1]:re:po
|
||||
-t5500.253 fetch-pack --diag-url ./[::1]:23:re:po
|
||||
-t5500.262 fetch-pack --diag-url [::1]:/~re:po
|
||||
-t5500.348 fetch-pack --diag-url ./[::1]:re/po
|
||||
-t5500.350 fetch-pack --diag-url ./[::1]:23:re/po
|
||||
-t5500.358 fetch-pack --diag-url [::1]:re/po
|
||||
-t5500.359 fetch-pack --diag-url [::1]:/~re/po
|
||||
-t5601.63 clone [::1]:rep/home/project
|
||||
-t5601.66 clone [::1]:/~repo
|
||||
-t6018.17 rev-parse --exclude with --branches
|
||||
-t6018.85 rev-list --exclude with --branches
|
||||
-t6130.20 **/ works with --glob-pathspecs
|
||||
-t7817.1 setup
|
||||
-t7817.2 working tree grep honors sparse checkout
|
||||
-t7817.3 grep searches unmerged file despite not matching sparsity patterns
|
||||
-t7817.5 grep --recurse-submodules honors sparse checkout in submodule
|
||||
-t7817.7 working tree grep does not search the index with CE_VALID and SKIP_WORKTREE
|
||||
-t9902.55 __git_refs - full refs
|
||||
-t9902.58 __git_refs - remote on local file system - full refs
|
||||
-t9902.75 __git refs - excluding full refs
|
||||
|
||||
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
|
||||
---
|
||||
winsup/cygwin/msys2_path_conv.cc | 15 +++++++++++++++
|
||||
1 file changed, 15 insertions(+)
|
||||
|
||||
diff --git a/winsup/cygwin/msys2_path_conv.cc b/winsup/cygwin/msys2_path_conv.cc
|
||||
index 8870d38..2646dc0 100644
|
||||
--- a/winsup/cygwin/msys2_path_conv.cc
|
||||
+++ b/winsup/cygwin/msys2_path_conv.cc
|
||||
@@ -362,6 +362,21 @@ skip_p2w:
|
||||
if (*it == ':')
|
||||
goto skip_p2w;
|
||||
|
||||
+ while (it != end && *it) {
|
||||
+ switch (*it) {
|
||||
+ case '`':
|
||||
+ case '\'':
|
||||
+ case '"':
|
||||
+ case '*':
|
||||
+ case '?':
|
||||
+ case '[':
|
||||
+ case ']':
|
||||
+ goto skip_p2w;
|
||||
+ }
|
||||
+ ++it;
|
||||
+ }
|
||||
+ it = *src;
|
||||
+
|
||||
while (!isalnum(*it) && *it != '/' && *it != '\\' && *it != ':' && *it != '-' && *it != '.') {
|
||||
recurse = true;
|
||||
it = ++*src;
|
||||
@ -0,0 +1,39 @@
|
||||
From 6ed5a4279665baad20f30017adb38c6fcec3c2d3 Mon Sep 17 00:00:00 2001
|
||||
From: Johannes Schindelin <johannes.schindelin@gmx.de>
|
||||
Date: Wed, 18 Feb 2015 11:07:17 +0000
|
||||
Subject: [PATCH 43/N] fixup! Add functionality for converting UNIX paths in
|
||||
arguments and environment variables to Windows form for native Win32
|
||||
applications.
|
||||
|
||||
We do not perform tilde expansion in the MSys2 runtime; let's leave
|
||||
paths containing '/~' intact for programs that want to expand such paths
|
||||
themselves.
|
||||
|
||||
This addresses the expectations of the following test cases in the test
|
||||
suite of https://github.com/git/git/tree/v2.43.0:
|
||||
|
||||
-t5500.163 fetch-pack --diag-url host:/~repo
|
||||
-t5500.260 fetch-pack --diag-url host:/~re:po
|
||||
-t5500.357 fetch-pack --diag-url host:/~re/po
|
||||
-t5601.65 clone host:/~repo
|
||||
|
||||
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
|
||||
---
|
||||
winsup/cygwin/msys2_path_conv.cc | 4 ++++
|
||||
1 file changed, 4 insertions(+)
|
||||
|
||||
diff --git a/winsup/cygwin/msys2_path_conv.cc b/winsup/cygwin/msys2_path_conv.cc
|
||||
index 2646dc0..b292add 100644
|
||||
--- a/winsup/cygwin/msys2_path_conv.cc
|
||||
+++ b/winsup/cygwin/msys2_path_conv.cc
|
||||
@@ -372,6 +372,10 @@ skip_p2w:
|
||||
case '[':
|
||||
case ']':
|
||||
goto skip_p2w;
|
||||
+ case '/':
|
||||
+ if (it + 1 < end && it[1] == '~')
|
||||
+ goto skip_p2w;
|
||||
+ break;
|
||||
}
|
||||
++it;
|
||||
}
|
||||
@ -0,0 +1,69 @@
|
||||
From c94cf814671d0c2891d9f82495c42608b39ef5bd Mon Sep 17 00:00:00 2001
|
||||
From: Johannes Schindelin <johannes.schindelin@gmx.de>
|
||||
Date: Wed, 18 Feb 2015 11:07:17 +0000
|
||||
Subject: [PATCH 44/N] fixup! Add functionality for converting UNIX paths in
|
||||
arguments and environment variables to Windows form for native Win32
|
||||
applications.
|
||||
|
||||
This skips posix-to-windows conversion when '::' is seen: The substring
|
||||
'::' most often found in an IPv6 address, never in a path (and only in
|
||||
bogus path lists that contain empty elements).
|
||||
|
||||
This addresses the expectations of the following test cases in the test
|
||||
suite of https://github.com/git/git/tree/v2.43.0:
|
||||
|
||||
-t0060.197 test_submodule_relative_url: (null) helper:://hostname/repo ../subrepo => helper:://hostname/subrepo
|
||||
-t0060.198 test_submodule_relative_url: (null) helper:://hostname/repo ../../subrepo => helper:://subrepo
|
||||
-t0060.199 test_submodule_relative_url: (null) helper:://hostname/repo ../../../subrepo => helper::/subrepo
|
||||
-t0060.200 test_submodule_relative_url: (null) helper:://hostname/repo ../../../../subrepo => helper::subrepo
|
||||
-t0060.201 test_submodule_relative_url: (null) helper:://hostname/repo ../../../../../subrepo => helper:subrepo
|
||||
-t0060.202 test_submodule_relative_url: (null) helper:://hostname/repo ../../../../../../subrepo => .:subrepo
|
||||
-t5801.2 cloning from local repo
|
||||
-t5801.4 pulling from local repo
|
||||
-t5801.5 pushing to local repo
|
||||
-t5801.6 fetch new branch
|
||||
-t5801.7 fetch multiple branches
|
||||
-t5801.8 push when remote has extra refs
|
||||
-t5801.9 push new branch by name
|
||||
-t5801.10 push new branch with old:new refspec
|
||||
-t5801.11 push new branch with HEAD:new refspec
|
||||
-t5801.12 push delete branch
|
||||
-t5801.13 forced push
|
||||
-t5801.14 cloning without refspec
|
||||
-t5801.15 pulling without refspecs
|
||||
-t5801.16 pushing without refspecs
|
||||
-t5801.17 pulling without marks
|
||||
-t5801.19 push all with existing object
|
||||
-t5801.20 push ref with existing object
|
||||
-t5801.23 push update refs
|
||||
-t5801.24 push update refs disabled by no-private-update
|
||||
-t5801.25 push update refs failure
|
||||
-t5801.26 proper failure checks for fetching
|
||||
-t5801.27 proper failure checks for pushing
|
||||
-t5801.28 push messages
|
||||
-t5801.29 fetch HEAD
|
||||
-t5801.30 fetch url
|
||||
-t5801.31 fetch tag
|
||||
-t7400.80 ../subrepo works with helper URL- helper:://hostname/repo
|
||||
|
||||
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
|
||||
---
|
||||
winsup/cygwin/msys2_path_conv.cc | 5 +++++
|
||||
1 file changed, 5 insertions(+)
|
||||
|
||||
diff --git a/winsup/cygwin/msys2_path_conv.cc b/winsup/cygwin/msys2_path_conv.cc
|
||||
index b292add..71c4735 100644
|
||||
--- a/winsup/cygwin/msys2_path_conv.cc
|
||||
+++ b/winsup/cygwin/msys2_path_conv.cc
|
||||
@@ -376,6 +376,11 @@ skip_p2w:
|
||||
if (it + 1 < end && it[1] == '~')
|
||||
goto skip_p2w;
|
||||
break;
|
||||
+ case ':':
|
||||
+ // Avoid mangling IPv6 addresses
|
||||
+ if (it + 1 < end && it[1] == ':')
|
||||
+ goto skip_p2w;
|
||||
+ break;
|
||||
}
|
||||
++it;
|
||||
}
|
||||
@ -0,0 +1,62 @@
|
||||
From 9944652c41fb96f555d221865f4ed5d0c8b33514 Mon Sep 17 00:00:00 2001
|
||||
From: Johannes Schindelin <johannes.schindelin@gmx.de>
|
||||
Date: Wed, 18 Feb 2015 11:07:17 +0000
|
||||
Subject: [PATCH 45/N] fixup! Add functionality for converting UNIX paths in
|
||||
arguments and environment variables to Windows form for native Win32
|
||||
applications.
|
||||
|
||||
With this commit, the POSIX-to-Windows conversion also leaves Git's
|
||||
`<rev>:./<name>` syntax alone. Such a string would otherwise be mistaken
|
||||
for indicating a path list, but path lists are expected to contain only
|
||||
absolute paths, which would not be the case here.
|
||||
|
||||
This addresses the expectations of the following test cases in the test
|
||||
suite of https://github.com/git/git/tree/v2.43.0:
|
||||
|
||||
-t1506.4 correct relative file objects (1)
|
||||
-t1506.5 correct relative file objects (2)
|
||||
-t1506.6 correct relative file objects (3)
|
||||
-t1506.7 correct relative file objects (4)
|
||||
-t1506.14 relative path not found
|
||||
-t1506.15 relative path outside worktree
|
||||
-t1506.16 relative path when cwd is outside worktree
|
||||
-t1513.5 empty prefix HEAD:./path
|
||||
-t1513.6 valid prefix HEAD:./path
|
||||
-t1513.7 valid prefix HEAD:../path
|
||||
-t2070.4 restore a file on worktree from another ref
|
||||
-t2070.5 restore a file in the index from another ref
|
||||
-t2070.6 restore a file in both the index and worktree from another ref
|
||||
-t2070.8 restore --worktree --staged uses HEAD as source
|
||||
-t7900.33 start and stop macOS maintenance
|
||||
-t7900.34 use launchctl list to prevent extra work
|
||||
-t7900.35 start and stop Windows maintenance
|
||||
-t7900.36 start and stop Linux/systemd maintenance
|
||||
-t7900.37 start and stop when several schedulers are available
|
||||
-t9300.195 Y: rewrite submodules
|
||||
-t9304.6 import with submodule mapping
|
||||
-t9304.7 paths adjusted for relative subdir
|
||||
|
||||
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
|
||||
---
|
||||
winsup/cygwin/msys2_path_conv.cc | 8 ++++++++
|
||||
1 file changed, 8 insertions(+)
|
||||
|
||||
diff --git a/winsup/cygwin/msys2_path_conv.cc b/winsup/cygwin/msys2_path_conv.cc
|
||||
index 71c4735..0ac47f0 100644
|
||||
--- a/winsup/cygwin/msys2_path_conv.cc
|
||||
+++ b/winsup/cygwin/msys2_path_conv.cc
|
||||
@@ -380,6 +380,14 @@ skip_p2w:
|
||||
// Avoid mangling IPv6 addresses
|
||||
if (it + 1 < end && it[1] == ':')
|
||||
goto skip_p2w;
|
||||
+
|
||||
+ // Leave Git's <rev>:./name syntax alone
|
||||
+ if (it + 1 < end && it[1] == '.') {
|
||||
+ if (it + 2 < end && it[2] == '/')
|
||||
+ goto skip_p2w;
|
||||
+ if (it + 3 < end && it[2] == '.' && it[3] == '/')
|
||||
+ goto skip_p2w;
|
||||
+ }
|
||||
break;
|
||||
}
|
||||
++it;
|
||||
@ -0,0 +1,57 @@
|
||||
From dba012d3e739305f4c08068a330cfe5db885dad6 Mon Sep 17 00:00:00 2001
|
||||
From: Johannes Schindelin <johannes.schindelin@gmx.de>
|
||||
Date: Wed, 18 Feb 2015 11:07:17 +0000
|
||||
Subject: [PATCH 46/N] fixup! Add functionality for converting UNIX paths in
|
||||
arguments and environment variables to Windows form for native Win32
|
||||
applications.
|
||||
|
||||
Do not let MSYS2's path conversion mistake arguments starting with '@@'
|
||||
for being paths.
|
||||
|
||||
This addresses the expectations of the following test cases in the test
|
||||
suite of https://github.com/git/git/tree/v2.43.0:
|
||||
|
||||
-t1508.1 setup
|
||||
-t1508.2 HEAD = refs/heads/new-branch
|
||||
-t1508.3 @{1} = new-one
|
||||
-t1508.4 HEAD@{1} = new-one
|
||||
-t1508.5 @{now} = new-two
|
||||
-t1508.6 HEAD@{now} = new-two
|
||||
-t1508.7 @{-1} = refs/heads/old-branch
|
||||
-t1508.8 @{-1}@{0} = old-two
|
||||
-t1508.9 @{-1}@{1} = old-one
|
||||
-t1508.10 @{u} = refs/heads/upstream-branch
|
||||
-t1508.11 HEAD@{u} = refs/heads/upstream-branch
|
||||
-t1508.12 @{u}@{1} = upstream-one
|
||||
-t1508.13 @{-1}@{u} = refs/heads/main
|
||||
-t1508.14 @{-1}@{u}@{1} = main-one
|
||||
-t1508.15 @ = new-two
|
||||
-t1508.16 @@{u} = refs/heads/upstream-branch
|
||||
-t1508.17 @@/at-test = refs/heads/@@/at-test
|
||||
-t1508.18 @at-test = refs/heads/@at-test
|
||||
-t1508.24 HEAD@{3} = old-two
|
||||
-t1508.26 switch to old-branch
|
||||
-t1508.27 HEAD = refs/heads/old-branch
|
||||
-t1508.28 HEAD@{1} = new-two
|
||||
-t1508.29 @{1} = old-one
|
||||
|
||||
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
|
||||
---
|
||||
winsup/cygwin/msys2_path_conv.cc | 4 ++++
|
||||
1 file changed, 4 insertions(+)
|
||||
|
||||
diff --git a/winsup/cygwin/msys2_path_conv.cc b/winsup/cygwin/msys2_path_conv.cc
|
||||
index 0ac47f0..0976cf9 100644
|
||||
--- a/winsup/cygwin/msys2_path_conv.cc
|
||||
+++ b/winsup/cygwin/msys2_path_conv.cc
|
||||
@@ -389,6 +389,10 @@ skip_p2w:
|
||||
goto skip_p2w;
|
||||
}
|
||||
break;
|
||||
+ case '@':
|
||||
+ // Paths do not contain '@@'
|
||||
+ if (it + 1 < end && it[1] == '@')
|
||||
+ goto skip_p2w;
|
||||
}
|
||||
++it;
|
||||
}
|
||||
@ -0,0 +1,63 @@
|
||||
From e9a55f1ac61a079533fa01a3dad2b65e721d13f3 Mon Sep 17 00:00:00 2001
|
||||
From: Johannes Schindelin <johannes.schindelin@gmx.de>
|
||||
Date: Wed, 18 Feb 2015 11:07:17 +0000
|
||||
Subject: [PATCH 47/N] fixup! Add functionality for converting UNIX paths in
|
||||
arguments and environment variables to Windows form for native Win32
|
||||
applications.
|
||||
|
||||
Let's prevent scp-style arguments from being mangled by MSYS2's path
|
||||
conversion.
|
||||
|
||||
An argument like `me@example.com:/tmp/` is not something we should convert
|
||||
into a Windows path; Use the absence of a slash before the colon as a
|
||||
tell-tale that it is *not* a POSIX path list (exception: if the part
|
||||
left of the colon is `.` or `..`).
|
||||
|
||||
This addresses the expectations of the following test cases in the test
|
||||
suite of https://github.com/git/git/tree/v2.43.0:
|
||||
|
||||
-t5516.8 fetch with insteadOf
|
||||
-t5516.16 push with insteadOf
|
||||
-t5516.17 push with pushInsteadOf
|
||||
-t5602.2 clone calls git upload-pack unqualified with no -u option
|
||||
-t5602.3 clone calls specified git upload-pack with -u option
|
||||
-t5603.31 clone of host:/ goes to host (non-bare)
|
||||
-t5603.35 clone of user@host:/ goes to host (non-bare)
|
||||
-t5813.81 full paths still work
|
||||
|
||||
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
|
||||
---
|
||||
winsup/cygwin/msys2_path_conv.cc | 8 ++++++++
|
||||
1 file changed, 8 insertions(+)
|
||||
|
||||
diff --git a/winsup/cygwin/msys2_path_conv.cc b/winsup/cygwin/msys2_path_conv.cc
|
||||
index 0976cf9..1e9cdbe 100644
|
||||
--- a/winsup/cygwin/msys2_path_conv.cc
|
||||
+++ b/winsup/cygwin/msys2_path_conv.cc
|
||||
@@ -470,6 +470,8 @@ skip_p2w:
|
||||
|
||||
int starts_with_minus = 0;
|
||||
int starts_with_minus_alpha = 0;
|
||||
+ int only_dots = *it == '.';
|
||||
+ int has_slashes = 0;
|
||||
if (*it == '-') {
|
||||
starts_with_minus = 1;
|
||||
it += 1;
|
||||
@@ -513,11 +515,17 @@ skip_p2w:
|
||||
if (ch == '/' && *(it2 + 1) == '/') {
|
||||
return URL;
|
||||
} else {
|
||||
+ if (!only_dots && !has_slashes)
|
||||
+ goto skip_p2w;
|
||||
return POSIX_PATH_LIST;
|
||||
}
|
||||
} else if (memchr(it2, '=', end - it2) == NULL) {
|
||||
return SIMPLE_WINDOWS_PATH;
|
||||
}
|
||||
+ } else if (ch != '.') {
|
||||
+ only_dots = 0;
|
||||
+ if (ch == '/' || ch == '\\')
|
||||
+ has_slashes = 1;
|
||||
}
|
||||
}
|
||||
|
||||
@ -0,0 +1,68 @@
|
||||
From 6ab2da6525debb34ba20ecf85fc431e44c52ff09 Mon Sep 17 00:00:00 2001
|
||||
From: Johannes Schindelin <johannes.schindelin@gmx.de>
|
||||
Date: Fri, 20 Feb 2015 13:56:22 +0000
|
||||
Subject: [PATCH 48/N] Handle 8-bit characters under LOCALE=C
|
||||
|
||||
When the character set is specified as ASCII (by setting the locale to
|
||||
`C`), we should handle data outside the 7-bit range gracefully by simply
|
||||
copying it, even if it is technically no longer ASCII.
|
||||
|
||||
Cygwin, however, wants to be a lot stricter than that.
|
||||
|
||||
Let's be more lenient in MSYS2 by making the strict 7-bit only handling
|
||||
contingent on the `STRICTLY_7BIT_ASCII` macro (which we never set
|
||||
because we don't want it).
|
||||
|
||||
This addresses the expectations of two of Git's test cases:
|
||||
t7400.108(submodule with UTF-8 name) and t9300.193(X: handling
|
||||
encoding).
|
||||
|
||||
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
|
||||
---
|
||||
newlib/libc/stdlib/mbtowc_r.c | 2 +-
|
||||
newlib/libc/stdlib/wctomb_r.c | 2 +-
|
||||
winsup/cygwin/strfuncs.cc | 4 ++++
|
||||
3 files changed, 6 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/newlib/libc/stdlib/mbtowc_r.c b/newlib/libc/stdlib/mbtowc_r.c
|
||||
index ca876f9..ee43736 100644
|
||||
--- a/newlib/libc/stdlib/mbtowc_r.c
|
||||
+++ b/newlib/libc/stdlib/mbtowc_r.c
|
||||
@@ -36,7 +36,7 @@ __ascii_mbtowc (struct _reent *r,
|
||||
if (n == 0)
|
||||
return -2;
|
||||
|
||||
-#ifdef __CYGWIN__
|
||||
+#ifdef STRICTLY_7BIT_ASCII
|
||||
if ((wchar_t)*t >= 0x80)
|
||||
{
|
||||
_REENT_ERRNO(r) = EILSEQ;
|
||||
diff --git a/newlib/libc/stdlib/wctomb_r.c b/newlib/libc/stdlib/wctomb_r.c
|
||||
index a7f87cd..2c536ce 100644
|
||||
--- a/newlib/libc/stdlib/wctomb_r.c
|
||||
+++ b/newlib/libc/stdlib/wctomb_r.c
|
||||
@@ -29,7 +29,7 @@ __ascii_wctomb (struct _reent *r,
|
||||
if (s == NULL)
|
||||
return 0;
|
||||
|
||||
-#ifdef __CYGWIN__
|
||||
+#ifdef STRICTLY_7BIT_ASCII
|
||||
if ((size_t)wchar >= 0x80)
|
||||
#else
|
||||
if ((size_t)wchar >= 0x100)
|
||||
diff --git a/winsup/cygwin/strfuncs.cc b/winsup/cygwin/strfuncs.cc
|
||||
index 0ab2290..ebd559b 100644
|
||||
--- a/winsup/cygwin/strfuncs.cc
|
||||
+++ b/winsup/cygwin/strfuncs.cc
|
||||
@@ -616,7 +616,11 @@ _sys_mbstowcs (mbtowc_p f_mbtowc, wchar_t *dst, size_t dlen, const char *src,
|
||||
to store them in a symmetric way. */
|
||||
bytes = 1;
|
||||
if (dst)
|
||||
+#ifdef STRICTLY_7BIT_ASCII
|
||||
*ptr = L'\xf000' | *pmbs;
|
||||
+#else
|
||||
+ *ptr = *pmbs;
|
||||
+#endif
|
||||
memset (&ps, 0, sizeof ps);
|
||||
}
|
||||
|
||||
@ -0,0 +1,28 @@
|
||||
From d40e640873870eda3b35fe3aa72a0e7dde65b7eb Mon Sep 17 00:00:00 2001
|
||||
From: Christoph Reiter <reiter.christoph@gmail.com>
|
||||
Date: Fri, 22 Dec 2023 09:32:39 +0100
|
||||
Subject: [PATCH 49/N] fixup! path-conversion: Introduce ability to switch off
|
||||
conversion.
|
||||
|
||||
It would just remove the argument instead of leaving it alone
|
||||
---
|
||||
winsup/cygwin/msys2_path_conv.cc | 6 ++++--
|
||||
1 file changed, 4 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/winsup/cygwin/msys2_path_conv.cc b/winsup/cygwin/msys2_path_conv.cc
|
||||
index 1e9cdbe..f6e91a2 100644
|
||||
--- a/winsup/cygwin/msys2_path_conv.cc
|
||||
+++ b/winsup/cygwin/msys2_path_conv.cc
|
||||
@@ -346,8 +346,10 @@ path_type find_path_start_and_type(const char** src, int recurse, const char* en
|
||||
*/
|
||||
const char *no_pathconv = getenv ("MSYS_NO_PATHCONV");
|
||||
|
||||
- if (no_pathconv)
|
||||
- return NONE;
|
||||
+ if (no_pathconv) {
|
||||
+ *src = end;
|
||||
+ return NONE;
|
||||
+ }
|
||||
|
||||
/* Let's not convert ~/.file to ~C:\msys64\.file */
|
||||
if (*it == '~') {
|
||||
@ -0,0 +1,25 @@
|
||||
From 65672ed072d895361382478d82b33f8c11c7201d Mon Sep 17 00:00:00 2001
|
||||
From: Christoph Reiter <reiter.christoph@gmail.com>
|
||||
Date: Sat, 10 Feb 2024 08:31:55 +0100
|
||||
Subject: [PATCH 50/N] pathconv: don't skip arguments with double quote
|
||||
|
||||
It is used to pass strings/paths to the preprocessor and breaks
|
||||
for example the CPython build. For example -DPREFIX='"/ucrt64"'.
|
||||
|
||||
Fixes #190
|
||||
---
|
||||
winsup/cygwin/msys2_path_conv.cc | 1 -
|
||||
1 file changed, 1 deletion(-)
|
||||
|
||||
diff --git a/winsup/cygwin/msys2_path_conv.cc b/winsup/cygwin/msys2_path_conv.cc
|
||||
index f6e91a2..4c0cc82 100644
|
||||
--- a/winsup/cygwin/msys2_path_conv.cc
|
||||
+++ b/winsup/cygwin/msys2_path_conv.cc
|
||||
@@ -368,7 +368,6 @@ skip_p2w:
|
||||
switch (*it) {
|
||||
case '`':
|
||||
case '\'':
|
||||
- case '"':
|
||||
case '*':
|
||||
case '?':
|
||||
case '[':
|
||||
@ -0,0 +1,83 @@
|
||||
From 44b5e4eed0f2f119d312fe718c2124250c8626f9 Mon Sep 17 00:00:00 2001
|
||||
From: Johannes Schindelin <johannes.schindelin@gmx.de>
|
||||
Date: Fri, 2 Feb 2024 13:40:28 +0100
|
||||
Subject: [PATCH 51/N] Work around fragile `#include` in binutils
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
The `bfd.h` header file that is included in `binutils` has the line
|
||||
`#include "ansidecl.h"`, which is fragile because it prefers Cygwin's
|
||||
`include/ansidecl.h` (as opposed to `#include <ansidecl.h>`, which would
|
||||
only look in the system include paths).
|
||||
|
||||
This matters because as of v2.42, `bfd.h` also makes use of the
|
||||
`ATTRIBUTE_WARN_UNUSED_RESULT` macro.
|
||||
|
||||
So let's just copy that macro (and while at it, the other `ATTRIBUTE_*`
|
||||
macros) from binutils' `ansidecl.h` file, to avoid compile errors while
|
||||
compiling `dumper.o` that look like this:
|
||||
|
||||
/usr/include/bfd.h:2770:1: error: expected initializer before ‘ATTRIBUTE_WARN_UNUSED_RESULT’
|
||||
2770 | ATTRIBUTE_WARN_UNUSED_RESULT;
|
||||
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
|
||||
---
|
||||
include/ansidecl.h | 43 +++++++++++++++++++++++++++++++++++++++++++
|
||||
1 file changed, 43 insertions(+)
|
||||
|
||||
diff --git a/include/ansidecl.h b/include/ansidecl.h
|
||||
index 6e4bfc2..ceb356e 100644
|
||||
--- a/include/ansidecl.h
|
||||
+++ b/include/ansidecl.h
|
||||
@@ -283,6 +283,49 @@ So instead we use the macro below and test it against specific values. */
|
||||
# endif /* GNUC >= 4.9 */
|
||||
#endif /* ATTRIBUTE_NO_SANITIZE_UNDEFINED */
|
||||
|
||||
+/* Attribute 'nonstring' was valid as of gcc 8. */
|
||||
+#ifndef ATTRIBUTE_NONSTRING
|
||||
+# if GCC_VERSION >= 8000
|
||||
+# define ATTRIBUTE_NONSTRING __attribute__ ((__nonstring__))
|
||||
+# else
|
||||
+# define ATTRIBUTE_NONSTRING
|
||||
+# endif
|
||||
+#endif
|
||||
+
|
||||
+/* Attribute `alloc_size' was valid as of gcc 4.3. */
|
||||
+#ifndef ATTRIBUTE_RESULT_SIZE_1
|
||||
+# if (GCC_VERSION >= 4003)
|
||||
+# define ATTRIBUTE_RESULT_SIZE_1 __attribute__ ((alloc_size (1)))
|
||||
+# else
|
||||
+# define ATTRIBUTE_RESULT_SIZE_1
|
||||
+#endif
|
||||
+#endif
|
||||
+
|
||||
+#ifndef ATTRIBUTE_RESULT_SIZE_2
|
||||
+# if (GCC_VERSION >= 4003)
|
||||
+# define ATTRIBUTE_RESULT_SIZE_2 __attribute__ ((alloc_size (2)))
|
||||
+# else
|
||||
+# define ATTRIBUTE_RESULT_SIZE_2
|
||||
+#endif
|
||||
+#endif
|
||||
+
|
||||
+#ifndef ATTRIBUTE_RESULT_SIZE_1_2
|
||||
+# if (GCC_VERSION >= 4003)
|
||||
+# define ATTRIBUTE_RESULT_SIZE_1_2 __attribute__ ((alloc_size (1, 2)))
|
||||
+# else
|
||||
+# define ATTRIBUTE_RESULT_SIZE_1_2
|
||||
+#endif
|
||||
+#endif
|
||||
+
|
||||
+/* Attribute `warn_unused_result' was valid as of gcc 3.3. */
|
||||
+#ifndef ATTRIBUTE_WARN_UNUSED_RESULT
|
||||
+# if GCC_VERSION >= 3003
|
||||
+# define ATTRIBUTE_WARN_UNUSED_RESULT __attribute__ ((__warn_unused_result__))
|
||||
+# else
|
||||
+# define ATTRIBUTE_WARN_UNUSED_RESULT
|
||||
+# endif
|
||||
+#endif
|
||||
+
|
||||
/* We use __extension__ in some places to suppress -pedantic warnings
|
||||
about GCC extensions. This feature didn't work properly before
|
||||
gcc 2.8. */
|
||||
288
msys2-runtime-3.4/PKGBUILD
Normal file
288
msys2-runtime-3.4/PKGBUILD
Normal file
@ -0,0 +1,288 @@
|
||||
# Maintainer: Alexey Pavlov <alexpux@gmail.com>
|
||||
# Contributor: Ray Donnelly <mingw.android@gmail.com>
|
||||
|
||||
pkgbase=msys2-runtime-3.4
|
||||
pkgname=('msys2-runtime-3.4' 'msys2-runtime-3.4-devel')
|
||||
pkgver=3.4.10
|
||||
pkgrel=1
|
||||
pkgdesc="Cygwin POSIX emulation engine"
|
||||
arch=('x86_64')
|
||||
url="https://www.cygwin.com/"
|
||||
license=('GPL')
|
||||
msys2_references=(
|
||||
'cygwin: cygwin'
|
||||
)
|
||||
makedepends=('cocom'
|
||||
'git'
|
||||
'perl'
|
||||
'gcc'
|
||||
'mingw-w64-cross-crt'
|
||||
'mingw-w64-cross-gcc'
|
||||
'mingw-w64-cross-zlib'
|
||||
'zlib-devel'
|
||||
'gettext-devel'
|
||||
'libiconv-devel'
|
||||
'autotools'
|
||||
'xmlto'
|
||||
'docbook-xsl')
|
||||
# re zipman: https://github.com/msys2/MSYS2-packages/pull/2687#issuecomment-965714874
|
||||
options=('!zipman')
|
||||
source=('msys2-runtime'::git://sourceware.org/git/newlib-cygwin.git#tag=cygwin-${pkgver}
|
||||
0001-Add-MSYS2-triplet.patch
|
||||
0002-Fix-msys-library-name-in-import-libraries.patch
|
||||
0003-Rename-dll-from-cygwin-to-msys.patch
|
||||
0004-Add-functionality-for-converting-UNIX-paths-in-argum.patch
|
||||
0005-Add-functionality-for-changing-OS-name-via-MSYSTEM-e.patch
|
||||
0006-Move-root-to-usr.-Change-sorting-mount-points.-By-de.patch
|
||||
0007-Instead-of-creating-Cygwin-symlinks-use-deep-copy-by.patch
|
||||
0008-Automatically-rewrite-TERM-msys-to-TERM-cygwin.patch
|
||||
0009-Do-not-convert-environment-for-strace.patch
|
||||
0010-path_conv-special-case-root-directory-to-have-traili.patch
|
||||
0011-dcrt0.cc-Untangle-allow_glob-from-winshell.patch
|
||||
0012-dcrt0.cc-globify-Don-t-quote-literal-strings-differe.patch
|
||||
0013-strace.cc-Don-t-set-MSYS-noglob.patch
|
||||
0014-Add-debugging-for-build_argv.patch
|
||||
0015-Add-debugging-for-strace-make_command_line.patch
|
||||
0016-environ.cc-New-facility-environment-variable-MSYS2_E.patch
|
||||
0017-Fix-native-symbolic-link-spawn-passing-wrong-arg0.patch
|
||||
0018-strace-quiet-be-really-quiet.patch
|
||||
0019-Introduce-the-enable_pcon-value-for-MSYS.patch
|
||||
0020-popen-call-usr-bin-sh-instead-of-bin-sh.patch
|
||||
0021-Expose-full-command-lines-to-other-Win32-processes-b.patch
|
||||
0022-Do-not-show-Error-dialogs-by-default.patch
|
||||
0023-Add-a-helper-to-obtain-a-function-s-address-in-kerne.patch
|
||||
0024-Emulate-GenerateConsoleCtrlEvent-upon-Ctrl-C.patch
|
||||
0025-kill-kill-Win32-processes-more-gently.patch
|
||||
0026-Cygwin-make-option-for-native-inner-link-handling.patch
|
||||
0027-docs-skip-building-texinfo-and-PDF-files.patch
|
||||
0028-install-libs-depend-on-the-toollibs.patch
|
||||
0029-POSIX-ify-the-SHELL-variable.patch
|
||||
0030-Handle-ORIGINAL_PATH-just-like-PATH.patch
|
||||
0031-uname-allow-setting-the-system-name-to-CYGWIN.patch
|
||||
0032-Pass-environment-variables-with-empty-values.patch
|
||||
0033-Optionally-disallow-empty-environment-values-again.patch
|
||||
0034-build_env-respect-the-MSYS-environment-variable.patch
|
||||
0035-When-converting-to-a-Unix-path-avoid-double-trailing.patch
|
||||
0036-msys2_path_conv-pass-PC_NOFULL-to-path_conv.patch
|
||||
0037-Revert-Cygwin-Enable-dynamicbase-on-the-Cygwin-DLL-b.patch
|
||||
0038-dumper-avoid-linker-problem-when-libbfd-depends-on-l.patch
|
||||
0039-path-conversion-Introduce-ability-to-switch-off-conv.patch
|
||||
0040-fixup-Add-functionality-for-converting-UNIX-paths-in.patch
|
||||
0041-fixup-Add-functionality-for-converting-UNIX-paths-in.patch
|
||||
0042-fixup-Add-functionality-for-converting-UNIX-paths-in.patch
|
||||
0043-fixup-Add-functionality-for-converting-UNIX-paths-in.patch
|
||||
0044-fixup-Add-functionality-for-converting-UNIX-paths-in.patch
|
||||
0045-fixup-Add-functionality-for-converting-UNIX-paths-in.patch
|
||||
0046-fixup-Add-functionality-for-converting-UNIX-paths-in.patch
|
||||
0047-fixup-Add-functionality-for-converting-UNIX-paths-in.patch
|
||||
0048-Handle-8-bit-characters-under-LOCALE-C.patch
|
||||
0049-fixup-path-conversion-Introduce-ability-to-switch-of.patch
|
||||
0050-pathconv-don-t-skip-arguments-with-double-quote.patch
|
||||
0051-Work-around-fragile-include-in-binutils.patch)
|
||||
sha256sums=('SKIP'
|
||||
'351bb1efdbdafe80c981e92d6b425c6ab71c85ce4e990db184e2118158eb2ab6'
|
||||
'd3d3a01feeae9f7d5e6cb32f4662df74fc9476ff11a1aac3dad2df3e43fd88e4'
|
||||
'2e50ecd65f2fd413baaf39e5058a6b252245abc7d34f4ebf17dd4f7ffed60ced'
|
||||
'231757d797cf9be6a92b6f6976ee85216e9fa8eaba4aca241ace4b76e41cd862'
|
||||
'23f97fac32ae2ba7681985e0d4910ec2d6d265f970bb0db6cec48540b6ebf055'
|
||||
'd47c570e2ac7a9b1c15f1a9e4e51b530eef0a2dc0f261ddc088ad449840deb02'
|
||||
'1bc7e3275eb9ffb3b70a0b9a5049bc6180d893d28ac6fc1d0e2ca29f8d890a33'
|
||||
'8113de5e8ae37da6b96a3c7eb379806ccb1a90f42ae0d9061941d5e224f754a0'
|
||||
'09ec71a8292035b38e5fb6db7fdd4f2fb6c5071ec9a7c180c72bb22216db88df'
|
||||
'02cc70007deccabac988ae02a82b201a71772b0dc6570b0275793f37f71ef09d'
|
||||
'b70c4cc2f37632d51e9ddcae56f12c9ec92357e11347cb806ed23af9251a601a'
|
||||
'51571b603ca6a75f22125daeb1973a9f8ecdf82b1d4637814287fa311f9480c3'
|
||||
'd4dbcdbfa4f2dbac9a06eac0cd42154e30df03466554778340dadf67ab861c8b'
|
||||
'5c018ce376a7f2b0b8e3dc3a4eedc5eebf618ef2337889188e6f914d0ac09795'
|
||||
'2350b6193166cab2596162d8a203a4edbddb413a615e84f7ecc120ffa98f609f'
|
||||
'7d25457a43facd4231aad09bc5acf4717468a937c087427bd8cc5e2a1046db84'
|
||||
'233b59d7ca0a339e09c15f7c64989ba347f1316f353d2d366dede33325b4091f'
|
||||
'b4eeb001292c5a34df2ebe65d8deef987eb70baf60f821d86c3cbccb49fea40a'
|
||||
'3afbea60cc0edfc7931ecaafeb1d6b7dfda1aac10be590afd41abff8a27815ef'
|
||||
'691328ad116d972eeb0d04558c68ad605e306faec26a3e43de90024e31d797d6'
|
||||
'b36301669c8e2802cc82c8ac7b99b10135f0aee12e3b01b258272e7089a9c4ed'
|
||||
'231d6372dcbdb72f4cd10dad60bbdf9f4d55236193e5cbfc2377dd1af1194360'
|
||||
'c6cfb73dab426e9b7649514408d4a0577ebac43aef9c0585e720e5624c2a904e'
|
||||
'aa3c148a0655d47d9acd822547ef4e8ef35be309e71e7d85c4af8bb3a485f7db'
|
||||
'4318b3e6e99f724c211b0c8b6ff93d644336a08fd29219381de9035b8f7b5415'
|
||||
'4cf58088663b156ea6ca2278eb24226ef3f57f9bd486dea9b1ac7b04fa62eb0c'
|
||||
'44d207e6e7cda10d427b6705735622fd7847a58d4f133862e9f82f11fd57cf0c'
|
||||
'161e4bcbf55f5d4b81bdbed73e0c8fdc339c75b70cd9e292fde41b53988bfb5b'
|
||||
'5528c8e0715404fc03068efcd8c42010604fe5940a7af962211066f9670276b5'
|
||||
'd121cbfed47c72787c92eb817bba2071930f86fdf2bff424d1082ceccd59da49'
|
||||
'832aaa93defa111e3d9f540532288398ad27352122b1ff84a8a2f53232e601b9'
|
||||
'de44e80e60e61dbf91b6b99a3f5740f653f83b96c64f862f4aa99fd42e7db0d7'
|
||||
'7cebdd623fe080bda89b0505d4e8dc8600969d3b7d71e6bdf0a7e6ac1c62708f'
|
||||
'008adf33a2b3774d85aabe1b2b2a3fa32615c0cf7bfbc7cf4e4ce3c0302957d6'
|
||||
'd5981d518ba4756dd6e976e9cc20ff8f52001aac588ee083a33045d260e02d6b'
|
||||
'599905c7454e2f3039c717de8186d4e1cb7943f9b47a7745ce36e4acfa100e31'
|
||||
'd37c835bc188786a4e8050f0a73d4f0b3070ded9030943ba2a6c47b03d9d96e8'
|
||||
'a799e7edde58a0ec519bb7df6d0bcf4177e1c6236a72a8240936c574be1bdd61'
|
||||
'aef2222ac4444efbd77de36bb92628f32f1467acea522e344fd28153ea235721'
|
||||
'5f61639a3c449ae90358cb621c67bade1b65ebef73fda64a7bc369f6fed4b266'
|
||||
'9b31f6d42920df0103f16ef51d6467b5f0db91d462545430047bf207fcc59371'
|
||||
'cda68bcfe03c76fc57435a25540c6f29aedf003bdb3dc434ecce86599f8293cc'
|
||||
'3fc79c86927d0983f892e99a978ab448f808f3fcdad6e5b101f35fc213af7f63'
|
||||
'22bb5e0738f16d0e8d2732307efe336226a58165d54616297aa5caf82e5bea4d'
|
||||
'58d8d131f62e7424e284c012504eb704f1a94c30a8572f04f8c4d77d1501eebd'
|
||||
'f5a6e7d85741b44daf62f7f80ac1e64f0336d3be084ebe9b7ce2e796f493b952'
|
||||
'73e74ea6f4f05d212fbdfab2b8dec2ad1faded660a833b24b55a058719ad7c01'
|
||||
'6c4cc6db864addb7ac78c5e2cbb0be41c7f853726c08b92fa33d573c8dcf0c16'
|
||||
'f9533f44a33f192716bdb7b613c66a675f37d3c613590d505737a76c80a3e75e'
|
||||
'1665c7654a3f5fbdf42fdc7c3b0bfeaa2f26a9534962ffece26da97122e3018e'
|
||||
'164527ad2e289050ed336a6f1aa8e1af40fb864e7e4aed545bde2703d41203bd')
|
||||
|
||||
# Helper macros to help make tasks easier #
|
||||
apply_patch_with_msg() {
|
||||
for _patch in "$@"
|
||||
do
|
||||
msg2 "Applying $_patch"
|
||||
patch -Nbp1 -i "${srcdir}/${_patch}"
|
||||
done
|
||||
}
|
||||
|
||||
apply_git_am_with_msg() {
|
||||
for _patch in "$@"
|
||||
do
|
||||
msg2 "Applying $_patch"
|
||||
git apply "${srcdir}/${_patch}"
|
||||
done
|
||||
}
|
||||
|
||||
del_file_exists() {
|
||||
for _fname in "$@"
|
||||
do
|
||||
if [ -f $_fname ]; then
|
||||
rm -rf $_fname
|
||||
fi
|
||||
done
|
||||
}
|
||||
# =========================================== #
|
||||
|
||||
prepare() {
|
||||
cd "${srcdir}"/msys2-runtime
|
||||
if test true != "$(git config core.symlinks)"
|
||||
then
|
||||
git config core.symlinks true &&
|
||||
/usr/bin/git reset --hard
|
||||
fi
|
||||
del_file_exists winsup/cygwin/msys2_path_conv.cc \
|
||||
winsup/cygwin/msys2_path_conv.h
|
||||
apply_git_am_with_msg 0001-Add-MSYS2-triplet.patch \
|
||||
0002-Fix-msys-library-name-in-import-libraries.patch \
|
||||
0003-Rename-dll-from-cygwin-to-msys.patch \
|
||||
0004-Add-functionality-for-converting-UNIX-paths-in-argum.patch \
|
||||
0005-Add-functionality-for-changing-OS-name-via-MSYSTEM-e.patch \
|
||||
0006-Move-root-to-usr.-Change-sorting-mount-points.-By-de.patch \
|
||||
0007-Instead-of-creating-Cygwin-symlinks-use-deep-copy-by.patch \
|
||||
0008-Automatically-rewrite-TERM-msys-to-TERM-cygwin.patch \
|
||||
0009-Do-not-convert-environment-for-strace.patch \
|
||||
0010-path_conv-special-case-root-directory-to-have-traili.patch \
|
||||
0011-dcrt0.cc-Untangle-allow_glob-from-winshell.patch \
|
||||
0012-dcrt0.cc-globify-Don-t-quote-literal-strings-differe.patch \
|
||||
0013-strace.cc-Don-t-set-MSYS-noglob.patch \
|
||||
0014-Add-debugging-for-build_argv.patch \
|
||||
0015-Add-debugging-for-strace-make_command_line.patch \
|
||||
0016-environ.cc-New-facility-environment-variable-MSYS2_E.patch \
|
||||
0017-Fix-native-symbolic-link-spawn-passing-wrong-arg0.patch \
|
||||
0018-strace-quiet-be-really-quiet.patch \
|
||||
0019-Introduce-the-enable_pcon-value-for-MSYS.patch \
|
||||
0020-popen-call-usr-bin-sh-instead-of-bin-sh.patch \
|
||||
0021-Expose-full-command-lines-to-other-Win32-processes-b.patch \
|
||||
0022-Do-not-show-Error-dialogs-by-default.patch \
|
||||
0023-Add-a-helper-to-obtain-a-function-s-address-in-kerne.patch \
|
||||
0024-Emulate-GenerateConsoleCtrlEvent-upon-Ctrl-C.patch \
|
||||
0025-kill-kill-Win32-processes-more-gently.patch \
|
||||
0026-Cygwin-make-option-for-native-inner-link-handling.patch \
|
||||
0027-docs-skip-building-texinfo-and-PDF-files.patch \
|
||||
0028-install-libs-depend-on-the-toollibs.patch \
|
||||
0029-POSIX-ify-the-SHELL-variable.patch \
|
||||
0030-Handle-ORIGINAL_PATH-just-like-PATH.patch \
|
||||
0031-uname-allow-setting-the-system-name-to-CYGWIN.patch \
|
||||
0032-Pass-environment-variables-with-empty-values.patch \
|
||||
0033-Optionally-disallow-empty-environment-values-again.patch \
|
||||
0034-build_env-respect-the-MSYS-environment-variable.patch \
|
||||
0035-When-converting-to-a-Unix-path-avoid-double-trailing.patch \
|
||||
0036-msys2_path_conv-pass-PC_NOFULL-to-path_conv.patch \
|
||||
0037-Revert-Cygwin-Enable-dynamicbase-on-the-Cygwin-DLL-b.patch \
|
||||
0038-dumper-avoid-linker-problem-when-libbfd-depends-on-l.patch \
|
||||
0039-path-conversion-Introduce-ability-to-switch-off-conv.patch \
|
||||
0040-fixup-Add-functionality-for-converting-UNIX-paths-in.patch \
|
||||
0041-fixup-Add-functionality-for-converting-UNIX-paths-in.patch \
|
||||
0042-fixup-Add-functionality-for-converting-UNIX-paths-in.patch \
|
||||
0043-fixup-Add-functionality-for-converting-UNIX-paths-in.patch \
|
||||
0044-fixup-Add-functionality-for-converting-UNIX-paths-in.patch \
|
||||
0045-fixup-Add-functionality-for-converting-UNIX-paths-in.patch \
|
||||
0046-fixup-Add-functionality-for-converting-UNIX-paths-in.patch \
|
||||
0047-fixup-Add-functionality-for-converting-UNIX-paths-in.patch \
|
||||
0048-Handle-8-bit-characters-under-LOCALE-C.patch \
|
||||
0049-fixup-path-conversion-Introduce-ability-to-switch-of.patch \
|
||||
0050-pathconv-don-t-skip-arguments-with-double-quote.patch \
|
||||
0051-Work-around-fragile-include-in-binutils.patch
|
||||
}
|
||||
|
||||
build() {
|
||||
[[ -d "${srcdir}"/build-${CHOST} ]] && rm -rf "${srcdir}"/build-${CHOST}
|
||||
mkdir -p "${srcdir}"/build-${CHOST} && cd "${srcdir}"/build-${CHOST}
|
||||
|
||||
# Gives more verbose compile output when debugging.
|
||||
local -a extra_config
|
||||
if check_option "debug" "y"; then
|
||||
export CCWRAP_VERBOSE=1
|
||||
OPTIM="-O0"
|
||||
extra_config+=(--enable-debugging)
|
||||
else
|
||||
OPTIM="-O2"
|
||||
fi
|
||||
|
||||
CFLAGS="$OPTIM -pipe -ggdb"
|
||||
CXXFLAGS="$OPTIM -pipe -ggdb -Wno-error=stringop-truncation -Wno-error=array-bounds -Wno-error=overloaded-virtual -Wno-narrowing -Wno-use-after-free"
|
||||
|
||||
# otherwise it asks git which appends "-dirty" because of our uncommited patches
|
||||
CFLAGS+=" -DCYGPORT_RELEASE_INFO=${pkgver}"
|
||||
|
||||
(cd "${srcdir}/msys2-runtime/winsup" && ./autogen.sh)
|
||||
|
||||
"${srcdir}"/msys2-runtime/configure \
|
||||
--prefix=/usr \
|
||||
--build=${CHOST} \
|
||||
--sysconfdir=/etc \
|
||||
"${extra_config[@]}"
|
||||
LC_ALL=C make
|
||||
LC_ALL=C make -j1 DESTDIR="${srcdir}"/dest install
|
||||
|
||||
rm -rf "${srcdir}"/dest/etc
|
||||
}
|
||||
|
||||
package_msys2-runtime-3.4() {
|
||||
pkgdesc="Posix emulation engine for Windows"
|
||||
provides=("msys2-runtime=${pkgver}")
|
||||
conflicts=('catgets' 'libcatgets' 'msys2-runtime')
|
||||
replaces=('catgets' 'libcatgets')
|
||||
|
||||
mkdir -p "${pkgdir}"/usr
|
||||
cp -rf "${srcdir}"/dest/usr/bin "${pkgdir}"/usr/
|
||||
cp -rf "${srcdir}"/dest/usr/libexec "${pkgdir}"/usr/
|
||||
rm -f "${pkgdir}"/usr/bin/cyglsa-config
|
||||
rm -f "${pkgdir}"/usr/bin/cyglsa.dll
|
||||
rm -f "${pkgdir}"/usr/bin/cyglsa64.dll
|
||||
rm -f "${pkgdir}"/usr/bin/cygserver-config
|
||||
cp -rf "${srcdir}"/dest/usr/share "${pkgdir}"/usr/
|
||||
}
|
||||
|
||||
package_msys2-runtime-3.4-devel() {
|
||||
pkgdesc="MSYS2 headers and libraries"
|
||||
depends=("msys2-runtime-3.4=${pkgver}")
|
||||
provides=("msys2-runtime-devel=${pkgver}")
|
||||
conflicts=('libcatgets-devel' 'msys2-runtime-devel')
|
||||
replaces=('libcatgets-devel')
|
||||
|
||||
mkdir -p "${pkgdir}"/usr/bin
|
||||
cp -rLf "${srcdir}"/dest/usr/${CHOST}/include "${pkgdir}"/usr/
|
||||
rm -f "${pkgdir}"/usr/include/iconv.h
|
||||
rm -f "${pkgdir}"/usr/include/unctrl.h
|
||||
# provided by libtirpc
|
||||
rm -fr "${pkgdir}"/usr/include/rpc/
|
||||
|
||||
cp -rLf "${srcdir}"/dest/usr/${CHOST}/lib "${pkgdir}"/usr/
|
||||
}
|
||||
4
msys2-runtime-3.4/README.md
Normal file
4
msys2-runtime-3.4/README.md
Normal file
@ -0,0 +1,4 @@
|
||||
The patches for this package are auto generated and managed in git:
|
||||
https://github.com/msys2/msys2-runtime/tree/msys2-3.4.10
|
||||
|
||||
Run `./update-patches.sh` to re-create the patches.
|
||||
88
msys2-runtime-3.4/update-patches.sh
Normal file
88
msys2-runtime-3.4/update-patches.sh
Normal file
@ -0,0 +1,88 @@
|
||||
#!/bin/sh
|
||||
|
||||
die () {
|
||||
echo "$*" >&2
|
||||
exit 1
|
||||
}
|
||||
|
||||
cd "$(dirname "$0")" ||
|
||||
die "Could not cd to msys2-runtime/"
|
||||
|
||||
git rev-parse --verify HEAD >/dev/null &&
|
||||
git update-index -q --ignore-submodules --refresh &&
|
||||
git diff-files --quiet --ignore-submodules &&
|
||||
git diff-index --cached --quiet --ignore-submodules HEAD -- ||
|
||||
die "Clean worktree required"
|
||||
|
||||
git rm 0*.patch ||
|
||||
die "Could not remove previous patches"
|
||||
|
||||
base_tag=refs/tags/cygwin-"$(sed -ne 's/^pkgver=//p' <PKGBUILD)"
|
||||
msys2_branch=refs/heads/msys2-${base_tag#refs/tags/cygwin-}
|
||||
url=https://github.com/msys2/msys2-runtime
|
||||
|
||||
test -d msys2-runtime ||
|
||||
git clone --bare $url msys2-runtime ||
|
||||
die "Could not clone msys2-runtime"
|
||||
|
||||
git -C msys2-runtime fetch --no-tags $url $base_tag:$base_tag $msys2_branch:$msys2_branch
|
||||
|
||||
git -c core.abbrev=7 \
|
||||
-c diff.renames=true \
|
||||
-c format.from=false \
|
||||
-c format.numbered=auto \
|
||||
-c format.useAutoBase=false \
|
||||
-C msys2-runtime \
|
||||
format-patch \
|
||||
--no-signature \
|
||||
--topo-order \
|
||||
--diff-algorithm=default \
|
||||
--no-attach \
|
||||
--no-add-header \
|
||||
--no-cover-letter \
|
||||
--no-thread \
|
||||
--suffix=.patch \
|
||||
--subject-prefix=PATCH \
|
||||
--output-directory .. \
|
||||
$base_tag..$msys2_branch \
|
||||
-- ':(exclude).github/' ||
|
||||
die "Could not generate new patch set"
|
||||
|
||||
patches="$(ls -1 0*.patch)" &&
|
||||
for p in $patches
|
||||
do
|
||||
sed -i 's/^\(Subject: \[PATCH [0-9]*\/\)[1-9][0-9]*/\1N/' $p ||
|
||||
die "Could not fix Subject: line in $p"
|
||||
done &&
|
||||
git add $patches ||
|
||||
die "Could not stage new patch set"
|
||||
|
||||
in_sources="$(echo "$patches" | sed "{s/^/ /;:1;N;s/\\n/\\\\n /;b1}")"
|
||||
in_prepare="$(echo "$patches" | tr '\n' '\\' | sed -e 's/\\$//' -e 's/\\/ &&&n /g')"
|
||||
sed -i -e "/^ 0.*\.patch$/{:1;N;/[^)]$/b1;s|.*|$in_sources)|}" \
|
||||
-e "/^ *apply_git_am_with_msg /{:2;N;/[^}]$/b2;s|.*| apply_git_am_with_msg $in_prepare\\n\\}|}" \
|
||||
PKGBUILD ||
|
||||
die "Could not update the patch set in PKGBUILD"
|
||||
|
||||
if git rev-parse --verify HEAD >/dev/null &&
|
||||
git update-index -q --ignore-submodules --refresh &&
|
||||
git diff-files --quiet --ignore-submodules &&
|
||||
git diff-index --cached --quiet --ignore-submodules HEAD --
|
||||
then
|
||||
echo "Already up to date!" >&2
|
||||
exit 0
|
||||
fi
|
||||
|
||||
updpkgsums ||
|
||||
die "Could not update the patch set checksums in PKGBUILD"
|
||||
|
||||
# bump pkgrel
|
||||
if ! git diff @{u} -- PKGBUILD | grep -q '^+pkgver'
|
||||
then
|
||||
pkgrel=$((1+$(sed -n -e 's/^pkgrel=//p' <PKGBUILD))) &&
|
||||
sed -i -e "s/^\(pkgrel=\).*/\1$pkgrel/" PKGBUILD ||
|
||||
die "Could not increment pkgrel"
|
||||
fi
|
||||
|
||||
git add PKGBUILD ||
|
||||
die "Could not stage updates in PKGBUILD"
|
||||
Loading…
x
Reference in New Issue
Block a user