After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 761982 - Double shell in subprocess.Popen() causes crashes
Double shell in subprocess.Popen() causes crashes
Status: RESOLVED FIXED
Product: gobject-introspection
Classification: Platform
Component: general
unspecified
Other Linux
: Normal normal
: ---
Assigned To: gobject-introspection Maintainer(s)
gobject-introspection Maintainer(s)
Depends on:
Blocks: 658126
 
 
Reported: 2016-02-13 08:30 UTC by Nicola Fontana
Modified: 2016-02-16 21:20 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Proposed solution (1.02 KB, patch)
2016-02-13 09:14 UTC, Nicola Fontana
none Details | Review
Remove leading shell *only* while cross-compiling (1.17 KB, patch)
2016-02-13 09:46 UTC, Nicola Fontana
committed Details | Review

Description Nicola Fontana 2016-02-13 08:30:41 UTC
utils.get_libtool_command() already prepends a shell (there is an explicit comment there on this topic). resolve_windows_libs() prepends another one.

Passing the shell twice results in an error on Linux (I think the first one tries to parse the second one as a script):

>>> import subprocess
>>> subprocess.Popen(['/bin/sh', '/bin/sh'])
/bin/sh: /bin/sh: cannot execute binary file

Why this never popped up before? My guess is on Windows subprocess.Popen
or "sh.exe" work differently so this issue is only relevant when
cross-compiling for Windows from a UNIX OS... in other words it never
happened before.
Comment 1 Nicola Fontana 2016-02-13 09:14:15 UTC
Created attachment 321060 [details] [review]
Proposed solution
Comment 2 Nicola Fontana 2016-02-13 09:46:52 UTC
Created attachment 321063 [details] [review]
Remove leading shell *only* while cross-compiling

This is a less invasive solution that leaves `sh.exe` in place when compiling on windows, so it should not have drawbacks.
Comment 3 Colin Walters 2016-02-13 12:21:49 UTC
Review of attachment 321063 [details] [review]:

Ok.