msys-2.0.dl to cygwin1.dll switch patches#334
msys-2.0.dl to cygwin1.dll switch patches#334lygstate wants to merge 13 commits intomsys2:msys2-3.6.7from
Conversation
I am unaware of such a plan. I mean, I can imagine that there is a ton of benefit to reduce the difference between the MSYS2 runtime and the Cygwin runtime to the bare minimum, to the point where even the path translation (which is probably the most distinguishing feature of the MSYS2 runtime) would be upstreamed to the Cygwin runtime as an opt-in, e.g. via a flag in At the same time, I am convinced that such a plan can only succeed by first building consensus about the direction, and I haven't seen such a discussion. Have I missed it? |
This is my local draft work that can transition from transition msys-2.0.dl to cygwin1.dll, post here for discussion. This is just barelly bootstrap msys-2.0.dll into cygwin1.dll, other things I am not considered yet. The most important part of msys2 I think is And indeed pacman not working in cygwin at all. |
| char *name_to_compare = rva (PSTR, map ?: (char *) hm, pd->Name - delta); | ||
| bool not_msys2 = !ascii_strcasematch (name_to_compare, "msys-2.0.dll"); | ||
| bool not_cygwin = !ascii_strcasematch (name_to_compare, "cygwin1.dll"); |
There was a problem hiding this comment.
Up until this point, I see the keying factor to be the presence of the MSYS and the CYGWIN environment variable. It is not quite clear what this MR wants to do if both are set, but it is clear that it wants to trigger the MSYS2 vs Cygwin code paths depending on the presence of either environment variable.
This hunk, however, tells a very different story (and one that I could understand much better): whether to run in MSYS2 or in Cygwin mode is keyed by the name of the DLL.
It sounds a bit fraught with peril to have both mechanisms. It would probably be a lot more desirable to key only on one of the two, not on both.
There was a problem hiding this comment.
This is a temporary patch that bootstrap from "msys-2.0.dll" to "cygwin1.dll", once the bootstrap finished. we can then revert this patch directly.
| /* 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"); | ||
|
|
||
| #if 0 | ||
| const char *cygwin_env = getenv ("CYGWIN"); | ||
| 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 = ""; | ||
| char *newenv = (char *) malloc (sizeof ("MSYS=noglob") | ||
| char *newenv = (char *) malloc (sizeof ("CYGWIN=noglob") | ||
| + strlen (space) + strlen (cygwin_env)); | ||
| sprintf (newenv, "MSYS=noglob%s%s", space, cygwin_env); | ||
| sprintf (newenv, "CYGWIN=noglob%s%s", space, cygwin_env); | ||
| _putenv (newenv); | ||
| */ | ||
| #endif | ||
|
|
There was a problem hiding this comment.
That's a lot of dead code. It would make more sense to investigate properly what the original commit tried to do, why it was wrong, and then to drop that part altogether. But that should most likely come as a separate Merge Request.
There was a problem hiding this comment.
I do this for reduce MSYS presence in code-base, as it's commted code, so I use #if 0, as this can be accepted, I'll create separte MR for it.
The main target of this MR is rename rename |
This reverts commit a32cbc8.
…t variables." This reverts commit b91f792.
…les. 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.
Changes of winsup/cygwin/environ.cc is split from "Add functionality for changing OS name via MSYSTEM environment variables." Changes of winsup/cygwin/exceptions.cc, winsup/utils/mingw/cygcheck.cc is split from "Rename dll from cygwin to msys" known_env_vars is sorted, update it
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."
This is split from "Rename dll from cygwin to msys"
f5f360c to
95177a1
Compare
This reverts commit 3e941b8.
This is a prepare for merge msys2 into cygwin
This is for bootstrap building msys2 as cygwin1.dll This can be rebased before "Rename dll from cygwin to msys"
95177a1 to
fd5ce30
Compare
This MR reorder the patches, so we can transition from msys-2.0.dl to cygwin1.dll.
First, we revert the patches that rename cygwin1.dll to msys-2.0.dll
Revert "strace.cc: Don't set MSYS=noglob"
Revert "Rename dll from cygwin to msys"
Revert "Fix msys library name in import libraries"
Revert "uname: allow setting the system name to CYGWIN"
Revert "Add functionality for changing OS name via MSYSTEM environment variables."
NOTE: these reverts can be dropped in the next rebase
Then add patches that support for transition msys-2.0.dl to cygwin1.dll.
Add functionality for changing OS name via MSYSTEM environment variables.
Support for both cygwin and msys2
Support for both MSYS and CYGWIN environment variable
strace.cc: Don't set CYGWIN=noglob
Convert to use msys'style named pipe
The last two patch is to keep the orignal
Rename dll from cygwin to msysRename dll from cygwin to msys
Fix msys library name in import libraries
With the last two patch, the built dll will be
msys-2.0.dll.Without the last two patch, the built dll will be
cygwin1.dll.So we can bootstrap msys-2.0.dll to cygwin1.dll in
MSYS2-packagesin a single code base.