-
Notifications
You must be signed in to change notification settings - Fork 289
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
MSYS2-based programs don't output anything to console #262
Comments
It's on Win 10 Pro. IIRC I tested on WS2016 in a VM and I had the same issue, but I will retest. |
Its worthwhile to read this It seems that the --tty is the problem. |
So, I have Windows Server 2016 Version 1607 (14393.447), in a Hyper-V VM, and I tried running the same scenario. It seems I have the same behaviour.
Your usecase works, but that's not a acceptable workaround as the issue is withing the container :( |
I agree that it should work also within the container. I believe we have more than just one issue, and I'm just trying to isolate.
|
Well, in WS2016 final release it doesn't work either (like I said above, a Hyper-V based WS2016, with nested virtualization). Last time it worked was in WS2016 TP5. But my TP5 VM is gone and I had trouble getting a new one in the exact state as the previous one was (via the old way of installing the Container Images - not through the Docker client + pull) So sadly I can't test if we change the isolation way it breaks. I am trying to see how I can further investigate the issue from MSYS2's PoV. Something has changed between the releases with regards the way it prints output... maybe that will provide insight to a more lower-level issue (e.g., maybe a Win 32 API, or it may be within MSYS2's itself (using an unsupported call)) |
I guess you are right. I have compiled the above On the other side I have tried to compile it under MSYS2, which was working, I could test it at command prompt, but in the docker container even the redirection |
@peterbud I used the latest version of MSYS2 32bit from https://msys2.github.io/ MSYS2 version: 20161025
I copied just the .dlls required to run it fine, and the |
I see - I'm using the 64-bit version of MSYS2, but the same version. And on that it's a different file. For me this is the result:
I have also checked with Dependency Walker what are the dependencies of the |
This is my result:
Looks the same except the gcc "redist". It's good to know that the 32bit exposes the same issue as the 64bit version. Yes, it's correct that it doesn't depend on MSVCRT, as it's using the GCC runtime from MSYS not Microsoft's C++ Redist. No MinGW/GCC-based binaries should have MSVCRT as dependency. |
So, I did some more tests. I created a MSYS2-based program, but instead of using print/iostream, I used directly the Win32 API. Here's the
|
One more update. I printed the The program source code is now:
And the output from docker:
So, it seems... an invalid handle is handed out to the app... (which confirms the Now, what next? :) Since we're working directly with the Win32 API... maybe the MS guys could help? |
Checking with @jhowardmsft to see if he might know how to get to the bottom of this. |
@peterbud So, it seems that we can use interactive input, but not
|
That's what I have tried to describe in my previous comment |
@timotei Just to have the complete picture, I have run the same test with the 64-bit version of MSYS2. The Then I just run a few tes copying the whole |
@timotei @peterbud thanks for the detailed instructions. I've just tried with 1.13-rc4 which, IIRC, had some console related fixes but still no dice. Tried from And for completeness (but I think you tried this already above):
And:
|
I'm also running into this limitation when trying to setup a build server in a windowsservercore container. |
@dhirschfeld Do you need interactive? Can it be built from a dockerfile non-interactively executing the appropriate commands? |
@jhowardmsft - I think I should be fine with non-interactive. It's just taken a while to find this thread and realise that! For those not in-the-know it would be nice if it Just Worked so I thought I'd add a +1 just to say that people are still coming across this problem and that not all of them may have made it here yet. In my case I was trying to set things up interactively so I would know the correct commands to put in the dockerfile. I wasn't having much luck with that approach though because of this issue. |
Understood. I think it's going to have to be fixed upstream in msys2 to be container aware. I haven't myself looked at the code, but a colleague noted they were doing some odd things to the console stdio pipes which is making it incompatible. FWIW, the way I originally worked out dockerfile.Windows in moby/moby (it no longer uses msys) and the right set of commands was on a scratch VM doing it interactively, then dockerising it once I knew the steps were right. Maybe that helps? |
Thanks @jhowardmsft - that's also a sensible way to do it. I opened an issue under the msys2 repo in the hope that it's fixed upstream. |
This appears to be an upstream MSYS2 bug, which is still occurring in the version I am using, when compiling a completely unrelated console program for Win32, on a Windows VM, not using Docker. I only found this bug report when searching, and I have not seen any MSYS2 bug report related to this, maybe it's already fixed upstream? |
I confirm this is not related to docker, I have the same problem for an application I develop: it is compiled under MSYS2, but when run in If you know a workaround, I'm very interested 😉 |
Interesting fact: If msys2 programs are run via a subprocess (i.e. spawning msys2 using powershell which has been started from cmd) they magically produce output:
|
Issues go stale after 90d of inactivity. Prevent issues from auto-closing with an If this issue is safe to close now please do so. Send feedback to Docker Community Slack channels #docker-for-mac or #docker-for-windows. |
May as well close this, msys2 is probably never going to fix it anyway. |
Does MSYS2 have an issue open somewhere about this? |
I opened an issue in msys2/MSYS2-packages#1490. In the reproduction I put there, using |
Closing this. The issue to follow is msys2/MSYS2-packages#1490 |
Closed issues are locked after 30 days of inactivity. If you have found a problem that seems similar to this, please open a new issue. Send feedback to Docker Community Slack channels #docker-for-mac or #docker-for-windows. |
Latest Git for Windows releases uses MSYS2-based utilities for things like
ssh
. However, those programs don't write anything to the console, even if there is actually text written to stdout. The problem itself seems to be actually about MSYS2-based programs, which I will detail below.Expected behavior
Stdout from
helloworld
/ls
should be written to the console:Actual behavior
Stdout is not written to the console. However it works if we redirect stdout to a file:
Information
The hello world program with the following source, is compiled via
gcc helloworld.c -o helloworld.exe
:I did another test for
ls
(which can be also obtained via https://sourceforge.net/projects/msys2/files/Base/i686/msys2-base-i686-20161025.tar.xz/download) which yielded somehow a much better idea about the issue:As it can be seen, we get
ls: write error: Bad file descriptor
for the command line.The current docker configuration:
Steps to reproduce the behavior
cd docker-msys
docker build -t msys .
docker run --rm -it msys cmd
Now, you can navigate into the
msys
/msys2
directories to test out the things. Optionally, you could download & install msys2 and mount it via the-v
flag to enable the compile & test workflow.Do you have any pointers towards how to further investigate this issue?
The text was updated successfully, but these errors were encountered: