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 667069 - gjs crashes when processing stdout - e.g runnng GLib spawn_command_line_sync("echo a");
gjs crashes when processing stdout - e.g runnng GLib spawn_command_line_sync(...
Status: RESOLVED FIXED
Product: gjs
Classification: Bindings
Component: general
1.30.x
Other Linux
: Normal normal
: ---
Assigned To: gjs-maint
gjs-maint
Depends on:
Blocks:
 
 
Reported: 2011-12-31 18:22 UTC by Lukas Vacek
Modified: 2012-02-06 19:26 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Be robust when faced with NULL arrays (2.34 KB, patch)
2012-02-06 16:53 UTC, Giovanni Campagna
committed Details | Review

Description Lukas Vacek 2011-12-31 18:22:31 UTC
I think this says it all:

$ LANG=C LC_ALL=C gjs
gjs> const g = imports.gi.GLib;
typein:1: strict warning: reference to undefined property imports.gi
typein:1: strict warning: reference to undefined property imports.gi
typein:1: strict warning: reference to undefined property imports.gi
typein:1: strict warning: reference to undefined property imports.gi
typein:1: strict warning: reference to undefined property imports.gi
typein:1: strict warning: reference to undefined property imports.gi
typein:1: strict warning: reference to undefined property imports.gi
typein:1: strict warning: reference to undefined property imports.gi
typein:1: strict warning: reference to undefined property imports.gi
gjs> g.spawn_command_line_sync("echo a");

(gjs:2446): GLib-CRITICAL **: g_utf8_to_utf16: assertion `str != NULL' failed
Violación de segmento


Same crash with my default locale es_ES.UTF-8

It's x86 Linux Mint 12, gnome-3.2, gjs 1.30.0

using GLib function g_spawn_command_line_sync in C works perfectly!

Thanks for looking into it!
Lukas
Comment 1 Giovanni Campagna 2012-02-06 16:53:58 UTC
Created attachment 206915 [details] [review]
Be robust when faced with NULL arrays

Some API return NULL to mean an empty array (especially if they
have an explicit length). Be robust in this cases, and handle such
empty bytearrays in a way that prevents crashes.
Comment 2 Jasper St. Pierre (not reading bugmail) 2012-02-06 16:56:26 UTC
Review of attachment 206915 [details] [review]:

Sure.
Comment 3 Giovanni Campagna 2012-02-06 19:26:28 UTC
Attachment 206915 [details] pushed as 36094f3 - Be robust when faced with NULL arrays