Skip to content
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

Prevent different MSYS2 runtime versions from sharing cygheaps #192

Commits on Jan 30, 2024

  1. Avoid sharing cygheaps across Cygwin versions

    It frequently leads to problems when trying, say, to call from MSYS2's
    Bash into Cygwin's or Git for Windows', merely because sharing that data
    is pretty finicky.
    
    For example, using the MSYS2' Bash using the MSYS2 runtime version that
    is current at time of writing, trying to call Cygwin's programs fails
    in manners like this:
    
        $ /c/cygwin64/bin/uname -r
          0 [main] uname (9540) child_copy: cygheap read copy failed, 0x800000000..0x800010BE0, done 0, windows pid 9540, Win32 error 6
        680 [main] uname 880 C:\cygwin64\bin\uname.exe: *** fatal error - couldn't create signal pipe, Win32 error 5
    
    with the rather misleading exit code 127 (a code which is reserved to
    indicate that a command was not found).
    
    Let's just treat the MSYS2 runtime and the Cygwin runtime as completely
    incompatible with one another, by virtue of using a different
    magic constant than merely `CHILD_INFO_MAGIC`.
    
    By using the msys2-runtime commit to modify that magic constant, we can
    even spawn programs using a different MSYS2 runtime (such as Git for
    Windows') because the commit serves as the tell-tale whether two MSYS2
    runtime versions are compatible with each other. To support building in
    the MSYS2-packages repository (where we do not check out the
    `msys2-runtime` but instead check out Cygwin and apply patches on top),
    let's accept a hard-coded commit hash as `./configure` option.
    
    One consequence is that spawned MSYS processes using a different MSYS2
    runtime will not be visible as such to the parent process, i.e. they
    cannot share any resources such as pseudo terminals. But that's okay,
    they are simply treated as if they were regular Win32 programs.
    
    Note: We have to use a very rare form of encoding the brackets in the
    `expr` calls: quadrigraphs (for a thorough explanation, see
    https://www.gnu.org/savannah-checkouts/gnu/autoconf/manual/autoconf-2.70/html_node/Quadrigraphs.html#Quadrigraphs).
    This is necessary because it is apparently impossible to encode brackets
    in `configure.ac` files otherwise.
    
    Signed-off-by: Johannes Schindelin <[email protected]>
    dscho committed Jan 30, 2024
    Configuration menu
    Copy the full SHA
    53cbcf1 View commit details
    Browse the repository at this point in the history
  2. uname: report msys2-runtime commit hash, too

    Having just Cygwin's version in the output of `uname` is not helpful, as
    both MSYS2 as well as Git for Windows release intermediate versions of
    the MSYS2 runtime much more often than Cygwin runtime versions are
    released.
    
    Signed-off-by: Johannes Schindelin <[email protected]>
    dscho committed Jan 30, 2024
    Configuration menu
    Copy the full SHA
    67061f3 View commit details
    Browse the repository at this point in the history