http://bugs.winehq.org/show_bug.cgi?id=58550
Bug ID: 58550 Summary: Native host executable is run asynchronously Product: Wine Version: 10.6 Hardware: x86-64 OS: Linux Status: UNCONFIRMED Severity: major Priority: P2 Component: kernel32 Assignee: wine-bugs@winehq.org Reporter: Bjoern@Kautler.net Distribution: ---
Some context to understand the use-case:
I have a build that runs on CI agents running Linux. That build runs InnoSetup through wine to build an EXE installer. To sign the executable you can give InnoSetup a command to run (signing after building is not possible, because there is also an uninstaller built into the result that also needs signing. For the signing I use JSign which cross-platform can sign executables using a remote sign server. JSign is a Java program.
I want to avoid provisioning a separate Windows Java Runtime just for that task. So I have a .bat file that translates the path of the signable file from wine path to Linux path.
Now I need to call the host systems Java runtime with that path and wait for it to finish.
I tried various things.
I tried like the FAQ suggests to add . to PATHEXT and just call the Linux executable. This works from the commandline like
wine /usr/lib/jvm/java-11-openjdk-amd64/bin/java
but also does not wait for the process to finish, if you do
wine /usr/lib/jvm/java-11-openjdk-amd64/bin/java; echo FOO
you see the FOO before the Java output.
Furthermore it does not work from inside the .bat file.
I also tried with
START /B /D . /WAIT /UNIX /usr/lib/jvm/java-11-openjdk-amd64/bin/java
This even works without manipulating PATHEXT. But is also does not wait for the process to finish, despite the /WAIT. It immediately returns and then further processing fails as JSign sees the file is not signed yet after the process seemingly ended.
So it seems wine never waits for the process to end, no matter what I use but immediately returns, making further processing impossible.
http://bugs.winehq.org/show_bug.cgi?id=58550
Eric Pouech eric.pouech@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |eric.pouech@gmail.com Status|UNCONFIRMED |RESOLVED Resolution|--- |DUPLICATE
--- Comment #1 from Eric Pouech eric.pouech@gmail.com --- this likely won't be fixed soon (for the reasons explained in previous bug)
I'm afraid there's no simple fix for that
among your alternatives: - either there's a PE (.EXE) signing tool that matches your needs - or you could hack around it by having a shell script running your signing process + touch a file to signal termination, and in //, at .bat file that waits until touched file exists (or any other mechanisms for IPC)
note: winepath will do the PATH translation for you (no need of a .bat for that)
*** This bug has been marked as a duplicate of bug 37780 ***
http://bugs.winehq.org/show_bug.cgi?id=58550
--- Comment #2 from Björn Kautler Bjoern@Kautler.net --- Thanks for the quick reply and sorry for the duplicate, didn't identify that one. :-(
winepath will do the PATH translation for you (no need of a .bat for that)
Of the executable, yes, but not for the arguments. The argument to the called process is the absolute path of the file to sign and that needs to be translated using `winepath` in the BAT file or JSign complains that it cannot find the Windows-style path.
As a work-around I now indeed again do provision a Windows JRE and use that instead of the host executable. With that it works like a charm.