https://bugs.winehq.org/show_bug.cgi?id=37780
Bug ID: 37780 Summary: After running a bash script from cmd, no prompt is printed Product: Wine Version: unspecified Hardware: x86-64 OS: Linux Status: UNCONFIRMED Severity: normal Priority: P2 Component: cmd Assignee: wine-bugs@winehq.org Reporter: gm89@hotmail.it Distribution: ---
If I run a bash script from wine's cmd, after execution the prompt is not printed. I believe this is the cause of an hang in my use case, I'm trying to interface a windows program with my android phone by making it use the native adb binary; the trick I used was to replace the provided "adb.exe" with a similarly named bash script with this content:
#!/bin/bash /usr/bin/adb $*
If I manually call adb.exe from cmd, the output of commands is correct but no prompt is printed afterwards.
Tested with wine 1.7.33 under ubuntu 14.04.
https://bugs.winehq.org/show_bug.cgi?id=37780
--- Comment #1 from Giorgio Micotti gm89@hotmail.it --- I spoke too soon. The script I was usng was printing a lot of output, so I didn't notice the prompt was printed right after launch. The problem should be stated as: cmd does not wait for a bash script completion.
https://bugs.winehq.org/show_bug.cgi?id=37780
Giorgio Micotti gm89@hotmail.it changed:
What |Removed |Added ---------------------------------------------------------------------------- Summary|After running a bash script |cmd does not wait for bash |from cmd, no prompt is |script completion |printed |
https://bugs.winehq.org/show_bug.cgi?id=37780
Ken Sharp imwellcushtymelike@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Version|unspecified |1.7.33
https://bugs.winehq.org/show_bug.cgi?id=37780
Jason Edmeades us@edmeades.me.uk changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |us@edmeades.me.uk
--- Comment #2 from Jason Edmeades us@edmeades.me.uk --- I'm working through the cmd bugs and came across this old one. I'm not really sure how to solve this, so adding some notes here. You might want to read bug#34730 as well where there was a long discussion on parts of this.
The problem is when you ask to run fred.exe, we look up the file fred.exe and ask the operating system for some information about fred.exe... Specifically we call SHGetFileInfo which should tell us whether the binary is a windows or console program. It fails to recognize that fred.exe is a valid program and returns 0, and as the low and high word is zero this means we dont bother waiting for it, however we still ask for it to be run.
One initial thought was to set it to e.g. 1, so we did wait - Doing this made no difference - a CreateProcess for a unix binary worked, but you do not get back a valid handle you can wait on for when the process ends, so even though the code tries to wait it fails.
I feel this ought to be closed dup of 34730, which is a wont fix but I will see if I can put an email onto wine-devel for clarity
https://bugs.winehq.org/show_bug.cgi?id=37780
Jason Edmeades us@edmeades.me.uk changed:
What |Removed |Added ---------------------------------------------------------------------------- Summary|cmd does not wait for bash |CreateProcess does not |script completion |return handles which can be | |used to wait on a Unix | |process ending (was cmd | |doesnt wait for bash | |command to end) Component|cmd |kernel32
--- Comment #3 from Jason Edmeades us@edmeades.me.uk --- Working through this, the root cause here is CreateProcess in kernel32 ends up calling fork_and_exec where it basically uses two forks to the unix binary, effectively producing a grandchild which is detatched and left running, and a child which is waited on and reaped.
For cmd to be able to wait for the unix binary to end, CreateProcess needs to support it. This might be theoretically possible (eg the grandchild could pass the pid back to the original thread, and wine server could wrap it in a 'special handle' somehow, but a non-windows process is quite different from a windows one and the semantics will differ.
I'm reassigning this over to kernel32 for the createprocess side of things. If they get implemented, the cmd side is trivial, but I strongly suspect the end result will be a wontfix
https://bugs.winehq.org/show_bug.cgi?id=37780
zzzzzyzz@hacari.org changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |zzzzzyzz@hacari.org