msys2 / msys2-runtime

Our friendly fork of Cygwin 💖 https://cygwin.org 💖 see the wiki for details
https://github.com/msys2/msys2-runtime/wiki
GNU General Public License v2.0
185 stars 39 forks source link

Upgrade to Cygwin 3.5.0 #194

Closed dscho closed 9 months ago

dscho commented 9 months ago
Range-diff relative to cygwin-3.4.10..msys2-3.4.10-autosquashed * 1: ea4541258a = 1: 032b7eaf84 Add MSYS2 triplet * 2: 4fdf75c097 = 2: b5b80682ea Fix msys library name in import libraries * 3: 5f85b84aca ! 3: a282a19dd1 Rename dll from cygwin to msys ``````diff @@ winsup/cygwin/Makefile.am: newlib_build=$(target_builddir)/newlib -NEW_DLL_NAME=new-cygwin1.dll -DEF_FILE=cygwin.def -LIB_NAME=libcygwin.a --TEST_LIB_NAME=libcygwin0.a +DLL_NAME=msys-2.0.dll +NEW_DLL_NAME=new-msys-2.0.dll +DEF_FILE=msys.def +LIB_NAME=libmsys-2.0.a -+TEST_LIB_NAME=libmsys0.a # # sources @@ winsup/cygwin/Makefile.am: LIBSERVER = $(cygserver_blddir)/libcygserver.a $(LIBSERVER): $(MAKE) -C $(cygserver_blddir) libcygserver.a --# We build as cygwin0.dll and rename at install time to overcome native -+# We build as msys-2.0.dll and rename at install time to overcome native +-# We build as new-cygwin1.dll and rename at install time to overcome native ++# We build as new-msys-2.0.dll and rename at install time to overcome native # rebuilding issues (we don't want the build tools to see a partially built --# cygwin.dll and attempt to use it instead of the old one). +-# cygwin1.dll and attempt to use it instead of the old one). +# msys-2.0.dll and attempt to use it instead of the old one). # linker script @@ winsup/cygwin/Makefile.am: LIBSERVER = $(cygserver_blddir)/libcygserver.a -# cygwin dll +# msys-2.0 dll + # Set PE and export table header timestamps to zero for reproducible builds. $(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 \ +@@ winsup/cygwin/Makefile.am: $(NEW_DLL_NAME): $(LDSCRIPT) libdll.a $(VERSION_OFILES) $(LIBSERVER)\ -Wl,--gc-sections -nostdlib -Wl,-T$(LDSCRIPT) \ -Wl,--dynamicbase -static \ + $${SOURCE_DATE_EPOCH:+-Wl,--no-insert-timestamp} \ - -Wl,--heap=0 -Wl,--out-implib,cygdll.a -shared -o $@ \ + -Wl,--heap=0 -Wl,--out-implib,msysdll.a -shared -o $@ \ -e @DLL_ENTRY@ $(DEF_FILE) \ @@ winsup/cygwin/Makefile.am: LIBSERVER = $(cygserver_blddir)/libcygserver.a $(newlib_build)/libc.a \ - -lgcc -lkernel32 -lntdll -Wl,-Map,cygwin.map + -lgcc -lkernel32 -lntdll -Wl,-Map,msys.map + @$(MKDIR_P) ${target_builddir}/winsup/testsuite/testinst/bin/ + $(AM_V_at)$(INSTALL_PROGRAM) $(NEW_DLL_NAME) ${target_builddir}/winsup/testsuite/testinst/bin/$(DLL_NAME) -# cygwin import library +# msys-2.0 import library @@ winsup/cygwin/Makefile.am: sigfe.s: $(DEF_FILE) tlsoffsets - $(AM_V_GEN)$(srcdir)/scripts/mkimport $(toolopts) $(NEW_FUNCTIONS) $@ cygdll.a $(wordlist 2,99,$^) + $(AM_V_GEN)$(srcdir)/scripts/mkimport $(toolopts) $(NEW_FUNCTIONS) $@ msysdll.a $(wordlist 2,99,$^) --# cygwin import library used by testsuite -+# msys-2.0 import library used by testsuite - $(TEST_LIB_NAME): $(LIB_NAME) -- $(AM_V_GEN)perl -p -e 'BEGIN{binmode(STDIN); binmode(STDOUT);}; s/cygwin1/cygwin0/g' < $? > $@ -+ $(AM_V_GEN)perl -p -e 'BEGIN{binmode(STDIN); binmode(STDOUT);}; s/msys-2.0/msys0/g' < $? > $@ - # sublibs # import libraries for some subset of symbols indicated by given objects speclib=\ @@ winsup/cygwin/Makefile.am: sigfe.s: $(DEF_FILE) tlsoffsets --exclude='(?i:dll)' \ --exclude='reloc' \ --exclude='^main$$' \ -@@ winsup/cygwin/Makefile.am: all-local: $(LIB_NAME) $(TEST_LIB_NAME) $(SUBLIBS) +@@ winsup/cygwin/Makefile.am: all-local: $(LIB_NAME) $(SUBLIBS) clean-local: -rm -f $(BUILT_SOURCES) -rm -f $(DEF_FILE) sigfe.s - -rm -f cygwin.sc cygdll.a cygwin.map + -rm -f cygwin.sc msysdll.a msys.map -rm -f $(NEW_DLL_NAME) - -rm -f $(LIB_NAME) $(TEST_LIB_NAME) $(SUBLIBS) + -rm -f $(LIB_NAME) $(SUBLIBS) -rm -f version.cc -@@ winsup/cygwin/Makefile.am: install-ldif: - uninstall-hook: uninstall-headers uninstall-ldif uninstall-libs - - uninstall-libs: -- rm -f $(DESTDIR)$(bindir)/cygwin1.dll -+ rm -f $(DESTDIR)$(bindir)/msys-2.0.dll - rm -f $(DESTDIR)$(toollibdir)/libg.a - - uninstall-headers: ## winsup/cygwin/crt0.c ## @@ winsup/cygwin/crt0.c: details. */ @@ winsup/cygwin/dtable.cc: handle_to_fn (HANDLE h, char *posix_fn) if (w32len ## winsup/cygwin/exceptions.cc ## -@@ winsup/cygwin/exceptions.cc: try_to_debug () +@@ winsup/cygwin/exceptions.cc: int exec_prepared_command (PWCHAR command) PWCHAR rawenv = GetEnvironmentStringsW () ; for (PWCHAR p = rawenv; *p != L'\0'; p = wcschr (p, L'\0') + 1) { @@ winsup/cygwin/winver.rc: BEGIN VALUE "APIVersion", CYGWIN_API_VERSION VALUE "SharedMemoryVersion", STRINGIFY(CYGWIN_VERSION_SHARED_DATA) - ## winsup/testsuite/config/default.exp ## -@@ - proc winsup_version {} { - global env - global runtime_root -- clone_output "\n[exec grep -a ^%%% $runtime_root/cygwin0.dll]\n" -- if { [info exists env(CYGWIN)] } { -- clone_output "CYGWIN=$env(CYGWIN)\n" -+ clone_output "\n[exec grep -a ^%%% $runtime_root/msys0.dll]\n" -+ if { [info exists env(MSYS)] } { -+ clone_output "MSYS=$env(MSYS)\n" - } else { -- clone_output "CYGWIN=\n" -+ clone_output "MSYS=\n" - } - } - - ## winsup/testsuite/cygrun.c ## @@ winsup/testsuite/cygrun.c: main (int argc, char **argv) - if (argc >= 3) - SetEnvironmentVariable ("TDIRECTORY", argv[2]); + exit (1); + } - SetEnvironmentVariable ("CYGWIN_TESTING", "1"); -- if ((p = getenv ("CYGWIN")) == NULL || (strstr (p, "ntsec") == NULL)) + SetEnvironmentVariable ("MSYS_TESTING", "1"); -+ if ((p = getenv ("MSYS")) == NULL || (strstr (p, "ntsec") == NULL)) - { - char buf[4096]; - if (!p) -@@ winsup/testsuite/cygrun.c: main (int argc, char **argv) - strcat (buf, " "); - } - strcat(buf, "ntsec"); -- SetEnvironmentVariable ("CYGWIN", buf); -+ SetEnvironmentVariable ("MSYS", buf); - } memset (&sa, 0, sizeof (sa)); + memset (&pi, 0, sizeof (pi)); ## winsup/testsuite/winsup.api/cygload.cc ## @@ @@ winsup/testsuite/winsup.api/cygload.cc: main (int argc, char *argv[]) out = &output; - ## winsup/testsuite/winsup.api/cygload.exp ## -@@ winsup/testsuite/winsup.api/cygload.exp: if { $rv != {0 {}} } { - set redirect_output /dev/null - } - set windows_runtime_root [exec cygpath -m $runtime_root] -- ws_spawn "./mingw-cygload.exe -cygwin $windows_runtime_root/cygwin0.dll > $redirect_output" -+ ws_spawn "./mingw-cygload.exe -cygwin $windows_runtime_root/msys0.dll > $redirect_output" - if { $rv != {0 {}} } { - verbose -log "cygload: $rv" - fail "cygload (execute)" - ## winsup/testsuite/winsup.api/cygload.h ## @@ winsup/testsuite/winsup.api/cygload.h: namespace cygwin // spawns a thread to let you receive signals from cygwin. @@ winsup/testsuite/winsup.api/cygload.h: namespace cygwin // A wrapper around GetProcAddress() for fetching symbols from the - ## winsup/testsuite/winsup.api/winsup.exp ## -@@ winsup/testsuite/winsup.api/winsup.exp: foreach src [lsort [glob -nocomplain $srcdir/$subdir/*.c $srcdir/$subdir/*/*.{cc - if [ file exists "$srcdir/$subdir/$basename.exp" ] then { - source "$srcdir/$subdir/$basename.exp" - } else { -- ws_spawn "$CC -nodefaultlibs -mwin32 $CFLAGS $src $add_includes $add_libs $runtime_root/binmode.o -lgcc $runtime_root/libcygwin0.a -lkernel32 -luser32 -o $base.exe" -+ ws_spawn "$CC -nodefaultlibs -mwin32 $CFLAGS $src $add_includes $add_libs $runtime_root/binmode.o -lgcc $runtime_root/libmsys0.a -lkernel32 -luser32 -o $base.exe" - if { $rv } { - fail "$testcase (compile)" - } else { - ## winsup/utils/ldd.cc ## @@ winsup/utils/ldd.cc: tocyg (wchar_t *win_fn) return fn; @@ winsup/utils/mingw/cygcheck.cc: dump_sysinfo () dump_dodgy_apps (verbose); -@@ winsup/utils/mingw/cygcheck.cc: static char opts[] = "cdsrvkflphV"; +@@ winsup/utils/mingw/cygcheck.cc: static char opts[] = "cdnsrvkfliephV"; static void print_version () { @@ winsup/utils/mingw/cygcheck.cc: load_cygwin (int& argc, char **&argv) + if (!(h = LoadLibrary ("msys-2.0.dll"))) return; GetModuleFileNameW (h, cygwin_dll_path, 32768); - if ((cygwin_internal = (uintptr_t (*) (int, ...)) + if ((cygwin_internal = (uintptr_t (*) (cygwin_getinfo_types, ...)) ## winsup/utils/mingw/strace.cc ## @@ winsup/utils/mingw/strace.cc: load_cygwin () `````` * 4: efc2d8e398 = 4: b6bfac0494 Add functionality for converting UNIX paths in arguments and environment variables to Windows form for native Win32 applications. * 5: a347a54d6c ! 5: 797a38dfa8 Add functionality for changing OS name via MSYSTEM environment variables. ``````diff @@ winsup/cygwin/environ.cc: static struct renv { /* Turn environment variable part of a=b string into uppercase - for some environment variables only. */ @@ winsup/cygwin/environ.cc: environ_init (char **envp, int envc) - environ = envp; + dumper_init (); if (envp_passed_in) { +#ifdef __MSYS__ `````` * 6: c7fbe76b44 = 6: ba780a1c33 - Move root to /usr. - Change sorting mount points. - By default mount without ACLs. - Can read /etc/fstab with short mount point format. * 7: 3297b6e38b ! 7: fd658586d9 Instead of creating Cygwin symlinks, use deep copy by default ``````diff @@ winsup/cygwin/globals.cc: bool ignore_case_with_glob; +winsym_t allow_winsymlinks = WSYM_deepcopy; bool disable_pcon; - bool NO_COPY in_forkee; + /* Taken from BSD libc: ## winsup/cygwin/path.cc ## @@ winsup/cygwin/path.cc: conv_path_list (const char *src, char *dst, size_t size, `````` * 8: bacb64ab98 = 8: 81ff6ff81b Automatically rewrite TERM=msys to TERM=cygwin * 9: 40de3303da = 9: 71b37df4de Do not convert environment for strace * 10: f13e5763d7 = 10: 20cb2818a7 path_conv: special-case root directory to have trailing slash * 11: 6e479a06af = 11: f86357e9b4 dcrt0.cc: Untangle allow_glob from winshell * 12: 83510f6b95 = 12: 7577422467 dcrt0.cc (globify): Don't quote literal strings differently when dos_spec * 13: 61b30a4725 = 13: d94826bd5b strace.cc: Don't set MSYS=noglob * 14: c426f06715 = 14: 00aa65f79f Add debugging for build_argv * 15: b020ec21bb = 15: 346d1f06d9 Add debugging for strace make_command_line * 16: e89850f0b4 = 16: 84cc05a186 environ.cc: New facility/environment variable MSYS2_ENV_CONV_EXCL * 17: ab7dcf42f4 = 17: 30c5afc81c Fix native symbolic link spawn passing wrong arg0 * 18: d56d7bfb5b = 18: c8376c51c4 strace --quiet: be *really* quiet * 19: 049d5f9763 = 19: db49d353d3 Introduce the `enable_pcon` value for `MSYS` * 20: c715f0afe5 = 20: e5afa463bc popen: call /usr/bin/sh instead of /bin/sh * 21: 7ddd990f8f ! 21: f835d1272c Disable the 'cygwin' GitHub workflow ``````diff @@ .github/workflows/cygwin.yml @@ name: cygwin --on: push +-on: +- push: +- # since master is a symbolic reference to main, don't run for both +- branches-ignore: +- - 'master' +- tags: +- - '*' +on: workflow_dispatch jobs: `````` * 22: de5eabb4c8 = 22: 7817c3ae4f CI: add a GHA for doing a basic build test * 23: 4eb98452af = 23: dcf5ce6b76 Set up a GitHub Action to keep in sync with Cygwin * 24: 2a8c2d2c0d = 24: 7a94d61516 Expose full command-lines to other Win32 processes by default * 25: a48d6983c2 ! 25: 674bda02cc Do not show Error dialogs by default ``````diff @@ winsup/cygwin/globals.cc: bool reset_com; bool disable_pcon; +bool winjitdebug = false; - bool NO_COPY in_forkee; - + /* Taken from BSD libc: + This variable is zero until a process has created a pthread. It is used ## winsup/cygwin/spawn.cc ## @@ winsup/cygwin/spawn.cc: child_info_spawn::worker (const char *prog_arg, const char *const *argv, `````` * 26: 32bb8e3b9b = 26: bbb77a0710 Add a helper to obtain a function's address in kernel32.dll * 27: 5e60247535 = 27: 3f5fbaa599 Emulate GenerateConsoleCtrlEvent() upon Ctrl+C * 28: 462d33174e = 28: 70f74f655a kill: kill Win32 processes more gently * 29: fe9612a742 ! 29: be81b647e7 Cygwin: make option for native inner link handling. ``````diff @@ winsup/cygwin/globals.cc: bool wincmdln = true; bool winjitdebug = false; +bool nativeinnerlinks = true; - bool NO_COPY in_forkee; - + /* Taken from BSD libc: + This variable is zero until a process has created a pthread. It is used ## winsup/cygwin/path.cc ## @@ winsup/cygwin/path.cc: restart: `````` * 30: 4f96cf6c98 = 30: 498414e2d2 docs: skip building texinfo and PDF files * 31: f034a9cef0 = 31: b7232828fd install-libs: depend on the "toollibs" * 32: c05687df01 = 32: 57455338d0 POSIX-ify the SHELL variable * 33: b78b959f47 = 33: fd395f78e7 Handle ORIGINAL_PATH just like PATH * 34: ef30343be2 = 34: 9dc9ee819d uname: allow setting the system name to CYGWIN * 35: d1f42e8154 = 35: 1b802197d9 Pass environment variables with empty values * 36: 8ff5edfe56 = 36: eeb56b3a57 Optionally disallow empty environment values again * 37: 8190923a4a = 37: 574deeedb2 build_env(): respect the `MSYS` environment variable * 38: 14f75850d2 = 38: c501e25d9b When converting to a Unix path, avoid double trailing slashes * 39: 4e17288efb = 39: ba4a839871 msys2_path_conv: pass PC_NOFULL to path_conv * 40: 5419de466c ! 40: c074105d05 Revert "Cygwin: Enable dynamicbase on the Cygwin DLL by default" ``````diff @@ winsup/cygwin/Makefile.am: $(NEW_DLL_NAME): $(LDSCRIPT) libdll.a $(VERSION_OFILE - -Wl,--gc-sections -nostdlib -Wl,-T$(LDSCRIPT) \ - -Wl,--dynamicbase -static \ + -Wl,--gc-sections -nostdlib -Wl,-T$(LDSCRIPT) -static \ + $${SOURCE_DATE_EPOCH:+-Wl,--no-insert-timestamp} \ -Wl,--heap=0 -Wl,--out-implib,msysdll.a -shared -o $@ \ -e @DLL_ENTRY@ $(DEF_FILE) \ - -Wl,-whole-archive libdll.a -Wl,-no-whole-archive \ `````` * 41: 850f6cd5dc ! 41: 56b55b0af1 dumper: avoid linker problem when `libbfd` depends on `libsframe` ``````diff @@ winsup/configure.ac: AC_CHECK_LIB([sframe], [sframe_decode], [BFD_LIBS="${BFD_LI cygwin/Makefile ## winsup/utils/Makefile.am ## -@@ winsup/utils/Makefile.am: profiler_CXXFLAGS = -I$(srcdir) -idirafter ${top_srcdir}/cygwin/local_includes - - profiler_LDADD = $(LDADD) -lntdll +@@ winsup/utils/Makefile.am: profiler_LDADD = $(LDADD) -lntdll cygps_LDADD = $(LDADD) -lpsapi -lntdll + newgrp_LDADD = $(LDADD) -luserenv +if HAVE_LIBSFRAME +dumper_LDADD += -lsframe `````` * 42: 4f22346d45 = 42: 19541ddfa4 CI: fix the build with gcc 13 * 43: 557636afed = 43: 7b23450c89 path-conversion: Introduce ability to switch off conversion. * 44: 4ee039d38c < -: ---------- Handle 8-bit characters under LOCALE=C * -: ---------- > 44: 9ef7b7cb40 proc: fix `error: the address of ‘iso15924’ will never be NULL` * -: ---------- > 45: 980b6525d7 Cygwin: console: Fix exit code for non-cygwin process. * -: ---------- > 46: de45537acc Work around fragile `#include` in binutils * -: ---------- > 47: 370e8e2937 Cygwin: console: Avoid slipping past disable_master_thread check.

Notes:

dscho commented 9 months ago

Still looking into problems with Git's test suite: The exit code of running git.exe without any arguments should be 1, but with the MSYS2 runtime built in this PR, it is reported as 0... So there may be serious problems in Cygwin 2.5.0...

dscho commented 9 months ago

The exit code of running git.exe without any arguments should be 1, but with the MSYS2 runtime built in this PR, it is reported as 0... So there may be serious problems in Cygwin 2.5.0...

Turns out that this was yet another bug introduced in all that Pseudo Console stuff, fixed (quickly). I backported that patch.

Then I could go on to verify what I had actually wanted to do: whether the remainder of the commit "Handle 8-bit characters under LOCALE=C" is actually necessary. And it is not! So we can happily drop that patch altogether.

In the meantime, binutils v2.42 was deployed, causing a compile error:

In file included from ../../.././winsup/utils/dumper.cc:23:
/usr/include/bfd.h:2748:1: error: expected initializer before ‘ATTRIBUTE_WARN_UNUSED_RESULT’
 2748 | ATTRIBUTE_WARN_UNUSED_RESULT;
      | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~

So I added a workaround for that, too.

dscho commented 9 months ago

And I verified that this now passes with the Git test suite (which testing proved useful when I immediately found the issue fixed via https://github.com/msys2/msys2-runtime/pull/194/commits/980b6525d7449f7226efb032dd92ef6b969f72c0).

So I think we're finally good to go!

dscho commented 9 months ago

There has been another fix on the cygwin-3_5-branch: https://github.com/cygwin/cygwin/commit/9bcfd0604533764f3ebfa5015e182f6db7c8922d. We may want to cherry-pick that one, too.

dscho commented 9 months ago

There has been another fix on the cygwin-3_5-branch: cygwin/cygwin@9bcfd06. We may want to cherry-pick that one, too.

I've come to the conclusion that we'll want this, as it may fix at least a couple of hangs.

lazka commented 9 months ago

I'll have a look tomorrow

lazka commented 9 months ago

lgtm, thanks

I also hit that binutils error last week, but only on one build, and not anymore after.. confusing.

dscho commented 9 months ago

I squashed https://github.com/msys2/msys2-runtime/pull/196 into this here PR.

dscho commented 9 months ago

@lazka we should probably establish an msys2-runtime-3.4 package, for those poor souls stuck on Windows 7/8, right?

lazka commented 9 months ago

We don't have a way to force them to the old version, so it's not clear how useful that would be.

It would be useful to quickly allow going back to 3.4 when checking for regressions etc though.

lazka commented 9 months ago

The binutils change was now done upstream as well: https://sourceware.org/git/?p=newlib-cygwin.git;a=commit;h=a85f1c3d0f22f0bf849f4040f04c5f9785e94feb

lazka commented 9 months ago

I guess we better wait for 3.5.1

dscho commented 9 months ago

I guess we better wait for 3.5.1

I want to have an msys2-3.5.0 to work from once Cygwin v3.5.1 lands, so I'm already "merging" this PR by pushing the tip commit to msys2-3.5.0.

But yeah, we can wait with switching the default branch, and keep it at msys2-3.4.10 for now.

You probably saw that I opened https://github.com/msys2/MSYS2-packages/pull/4422 to update msys2-runtime to v3.5.0 and introduce an msys2-runtime-3.4 package? I'm not sure what we should do here, as there are a couple of bug fixes in the cygwin-3_5-branch, but they do not strike me as fixes for regressions in v3.5.0 anymore.

lazka commented 9 months ago

OK, sounds good. I still haven't decided how to handle the 3.5 transition in MSYS2, I need to think about it..

dscho commented 9 months ago

Looks like there will be a v3.5.1 soon-ish.