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 607531 - Execute system() calls in subshells to ease debugging
Execute system() calls in subshells to ease debugging
Status: RESOLVED FIXED
Product: gtk-doc
Classification: Platform
Component: general
1.13
Other Linux
: Normal normal
: 1.14
Assigned To: gtk-doc maintainers
gtk-doc maintainers
Depends on:
Blocks:
 
 
Reported: 2010-01-20 09:07 UTC by Emilio Pozuelo Monfort
Modified: 2010-01-27 08:30 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Execute all commands in subshells (1.87 KB, patch)
2010-01-20 09:10 UTC, Emilio Pozuelo Monfort
none Details | Review

Description Emilio Pozuelo Monfort 2010-01-20 09:07:24 UTC
Hi,

gtkdoc-scanobj already executes one command in a subshell so that if it fails, we can still see the errors. It doesn't for other commands though (like the compiler or the linker). The attached patch from Loïc Minier executes all commands in a subshell.

  * New patch, 50_shell-errors, causes all system() calls to spawn a subshell
    which should help diagnose crashes of commands such as ICE or scanner
    segfaults.
Comment 1 Emilio Pozuelo Monfort 2010-01-20 09:10:28 UTC
Created attachment 151819 [details] [review]
Execute all commands in subshells

Patch from Loïc Minier to execute all commands in subshells.
Comment 2 Stefan Sauer (gstreamer, gtkdoc dev) 2010-01-22 12:20:26 UTC
That looks good. One question - are subshells used like this supported by plain sh as well?
Comment 3 Emilio Pozuelo Monfort 2010-01-22 13:35:31 UTC
dash, which is POSIX plus only a few extensions, says:

   Grouping Commands Together
     Commands may be grouped by writing either

           (list)

     or

           { list; }

     The first of these executes the commands in a subshell.
     Builtin commands grouped into a (list) will not affect the
     current shell. [...]

So I'd say yes.
Comment 4 Stefan Sauer (gstreamer, gtkdoc dev) 2010-01-22 14:09:49 UTC
ommit b37791867f938d9ab5ce5d3db63d7115981deb7a
Author: Loïc Minier <lool@dooz.org>
Date:   Fri Jan 22 16:06:41 2010 +0200

    scanobj/gobj: Execute system() calls in subshells, Fixes #607531
    
    the tools already execute one command in a subshell so that if it fails,
    we can still see the errors. It doesn't for other commands though (like the
    compiler or the linker).
Comment 5 Stefan Sauer (gstreamer, gtkdoc dev) 2010-01-25 08:35:30 UTC
Reverted part of the patch. The next time, I'd appreciate if you would actualy try to build something before submitting the patch.
Comment 6 Emilio Pozuelo Monfort 2010-01-27 08:30:05 UTC
(In reply to comment #5)
> Reverted part of the patch. The next time, I'd appreciate if you would actualy
> try to build something before submitting the patch.

That patch has been in Debian since April 2007. I guess nothing in Debian sets $RUN in the environment...