[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

gEDA-bug: [ geda-Bugs-1869941 ] error handling in libgeda/src/s_clib.c run_source_command()



Bugs item #1869941, was opened at 2008-01-12 14:01
Message generated for change (Tracker Item Submitted) made by Item Submitter
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=818426&aid=1869941&group_id=161080

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: None
Group: None
Status: Open
Resolution: None
Priority: 5
Private: No
Submitted By: Werner Hoch (werner2101)
Assigned to: Nobody/Anonymous (nobody)
Summary: error handling in libgeda/src/s_clib.c run_source_command() 

Initial Comment:
The function run_source_command does not catch all errors from the command.

I've added a few lines to that function:
----------
diff --git a/libgeda/src/s_clib.c b/libgeda/src/s_clib.c
index fc4d437..3aab9ef 100644
--- a/libgeda/src/s_clib.c
+++ b/libgeda/src/s_clib.c
@@ -450,6 +450,10 @@ static gchar *run_source_command (const gchar 
*command)
                              &exit_status,
                              &e);

+  if (standard_error && exit_status == 0)
+    s_log_message("%s", standard_error);
+  printf("%d, %d, %d, %s\n", exit_status, WIFSIGNALED(exit_status), 
WIFEXITED(exit_status), (e != NULL)?e->message:"NULL");
+
   if (e != NULL) {
     s_log_message (_("Library command failed [%s]: %s\n"), command,
                   e->message);
----------

And the result is, that the exit code from the command is multiplied by 256:
-------
0, 0, 1, NULL
256, 0, 1, NULL
-------


This looks like a bug in the glib as Peter B. guessed.

I've attached a small testcase to verify the bug.
The results of the commands are:
------------
erner@linux-m82i:~/Desktop/g_spawn> ls xxxx
ls: Zugriff auf xxxx nicht möglich: Datei oder Verzeichnis nicht gefunden
werner@linux-m82i:~/Desktop/g_spawn> echo $?
2
werner@linux-m82i:~/Desktop/g_spawn> gcc -Wall -g main.c -o spawn `pkg-config --cflags gtk+-2.0` `pkg-config --libs gtk+-2.0`
werner@linux-m82i:~/Desktop/g_spawn> ./spawn
[ls], exit_status=0, WIFSIGNALED=0, WIFEXITED=1, NULL
[ls xxxx], exit_status=512, WIFSIGNALED=0, WIFEXITED=1, NULL
[python -c 'import sys; sys.exit(-1)'], exit_status=65280, WIFSIGNALED=0, WIFEXITED=1, NULL
[python -c 'import sys; sys.exit(5)'], exit_status=1280, WIFSIGNALED=0, WIFEXITED=1, NULL
werner@linux-m82i:~/Desktop/g_spawn>         
------------

I'm going to report the bug to the glib developers.

Regards
Werner



----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=818426&aid=1869941&group_id=161080


_______________________________________________
geda-bug mailing list
geda-bug@xxxxxxxxxxxxxx
http://www.seul.org/cgi-bin/mailman/listinfo/geda-bug