-
Notifications
You must be signed in to change notification settings - Fork 39
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update to Cygwin v3.3.6 #100
Conversation
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.
…ent variables to Windows form for native Win32 applications.
…t without ACLs. - Can read /etc/fstab with short mount point format.
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>
…essary 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.
Strace is a Windows program so MSYS2 will convert all arguments and environment vars and that makes debugging msys2 software with strace very tricky.
Otherwise if globbing is allowed and we get called from a Windows program, build_argv thinks we've been called from a Cygwin program.
…spec Reverts 25ba8f3. 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.
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."
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.
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>
The pseudo console support is just a bit too buggy still: - When typing anything in an interactive Bash session before the prompt is shown, frequently the keystrokes are then replayed _twice_ when the prompt is active. Even worse: it seems that under certain circumstances (e.g. when spawning `less.exe` from a MINGW process), keystrokes are recorded while a process is active that wants to consume them but those recorded keystrokes are then replayed once the process finished (e.g. the `q` keystroke to exit `less.exe` will then be misinterpreted for interactive input in the Bash session). - When `vim` is called from a MINGW process, it seems that the terminal loses the `onlcr` property after the `vim` process finished, i.e. subsequently printed lines do not start at the beginning of the line anymore, but precisely where the previous line ended. - In `vim`, when selecting text visually (via the `v` keystroke), it seems that the selection is frequently reset while navigating with the arrow keys. There are probably quite a few more rough edges in the pseudo console feature, unfortunately. In light of these issues, it makes most sense to disable the pseudo console support and make it opt-in rather than opt-out. Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
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>
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.
This will help us by automating an otherwise tedious task. Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
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>
It does not work at all. For example, `rpm -E %fedora` says that there should be version 33 of rpmsphere at https://github.com/rpmsphere/noarch/tree/master/r, but there is only version 32. Another thing that is broken: Cygwin now assumes that a recent mingw-w64-headers version is available, but Fedora apparently only offers v7.0.0, which is definitely too old to accommodate for the expectation of cygwin/cygwin@c1f7c4d1b6d7. Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
In #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 21ec498 (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 msys2/MSYS2-packages#2414 (comment) 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>
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>
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>
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>
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
The MSYS2 packages lack the infrastructure to build those. Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
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>
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 git-for-windows/git#542, git-for-windows/git#498, and git-for-windows/git#468. Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
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>
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.
This change comes from:
|
Seems odd that 717c36c didn't get backported to 3.3. Every time I see a hang/deadlock fix I hope it's my hang/deadlock on ARM64 that I've never been able to debug (discussed msys2/msys2-autobuild#62) |
Probably because that is a fix for 63b5039 which also did not make it to v3.3.x. In any case, is this comment part of your review of this here PR? 😁 |
@lazka would you mind adjusting the default branch (I would, but I don't have the permission). |
See msys2/msys2-runtime#100 Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
you should now |
I can, and I did! Thank you! |
Changelog: https://cygwin.com/git/?p=newlib-cygwin.git;a=blob;f=winsup/cygwin/release/3.3.6
Upstream changes: cygwin-3_3_5-release...cygwin-3_3_6-release
Range-diff:
$ git range-diff cygwin-3_3_5-release..msys2-3_3_5-release cygwin-3_3_6-release..msys2-3_3_6-release-wip
1: 6ab46ff = 1: 1e32c73 Add MSYS2 triplet
2: 14e3f59 = 2: e78e144 Fix msys library name in import libraries
3: c077943 = 3: 27982ff Rename dll from cygwin to msys
4: 03929e0 ! 4: eec7532 Add functionality for converting UNIX paths in arguments and environment variables to Windows form for native Win32 applications.
5: 77261f7 = 5: 4282d49 Add functionality for changing OS name via MSYSTEM environment variables.
6: 45fd39e = 6: 7794a2a - Move root to /usr. - Change sorting mount points. - By default mount without ACLs. - Can read /etc/fstab with short mount point format.
7: 0ecbb9c = 7: bb01dd4 Instead of creating Cygwin symlinks, use deep copy by default
8: f1b4626 = 8: 6f8d010 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.
9: f9c5a29 = 9: 5286205 Do not convert environment for strace
10: dbc74be = 10: 4676ec4 Special case for converting root directory to have training slash
11: 8da0f35 = 11: afe78f3 dcrt0.cc: Untangle allow_glob from winshell
12: bb5f409 = 12: 8cbda4b dcrt0.cc (globify): Don't quote literal strings differently when dos_spec
13: e93812d = 13: 9390997 strace.cc: Don't set MSYS=noglob
14: 30759e9 = 14: 5a00c6b Add debugging for build_argv
15: 1c6ba9d = 15: aaadd11 Add debugging for strace make_command_line
16: 9de4fa8 = 16: 9559773 environ.cc: New facility/environment variable MSYS2_ENV_CONV_EXCL
17: 210d271 = 17: 3578452 Fix native symbolic link spawn passing wrong arg0
18: 47ea73c = 18: b0485d4 QueryUnbiasedInterruptTime must be load from kernel32.dll
19: 099ccbb = 19: 09db143 strace --quiet: be really quiet
20: b74f834 = 20: 8e89fff Default to
disable_pcon
21: 76648c9 = 21: a4a2aeb Introduce the
enable_pcon
value forMSYS
22: 1333709 = 22: f9b94aa popen: call /usr/bin/sh instead of /bin/sh
23: 146f1a7 = 23: 69029b1 CI: add a GHA for doing a basic build test
24: 477d12f = 24: 51766ab Set up a GitHub Action to keep in sync with Cygwin
25: b911cd8 = 25: b37c67a Expose full command-lines to other Win32 processes by default
26: f9fe9e6 = 26: 991789a Disable the 'cygwin' GitHub workflow
27: d67cd10 = 27: c20ec3a Do not show Error dialogs by default
28: 65fa01a = 28: 22f7709 Add a helper to obtain a function's address in kernel32.dll
29: 3ef5043 = 29: be43d13 Emulate GenerateConsoleCtrlEvent() upon Ctrl+C
30: fcf9fbe = 30: 486c760 kill: kill Win32 processes more gently
31: e71dc3c = 31: aa9dbc9 Cygwin: make option for native inner link handling.
32: 506a54e = 32: 20f59b4 docs: skip building texinfo and PDF files
33: 91bc72c = 33: 31b5e84 install-libs: depend on the "toollibs"
34: 8bb4359 = 34: ae6fcef POSIX-ify the SHELL variable
35: 991a737 = 35: 7af6781 Handle ORIGINAL_PATH just like PATH
36: dceb4cc < -: ---------- fixup! Add functionality for converting UNIX paths in arguments and environment variables to Windows form for native Win32 applications.
37: 041f56f = 36: 1a5f889 uname: allow setting the system name to CYGWIN