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 329186 - cannot modify or add bookmarks
cannot modify or add bookmarks
Status: RESOLVED FIXED
Product: gtk+
Classification: Platform
Component: Widget: GtkFileChooser
2.8.x
Other Linux
: High critical
: ---
Assigned To: gtk-bugs
Federico Mena Quintero
Depends on:
Blocks:
 
 
Reported: 2006-01-30 10:25 UTC by Matteo 'Peach' Pescarin
Modified: 2006-02-09 04:18 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
strace on scite until popup window (885.30 KB, text/plain)
2006-02-02 00:46 UTC, Matteo 'Peach' Pescarin
Details

Description Matteo 'Peach' Pescarin 2006-01-30 10:25:03 UTC
Please describe the problem:
I cannot modify an existing bookmark in the file chooser nor add a new bookmark

Steps to reproduce:
1. open the file chooser
2. select a directory to add OR select an already present bookmark
3. click on Add OR click on Remove


Actual results:
a popup opens saying: 
"Impossible to add a bookmark
Failed to save the bookmark: Impossible to change file permissions: waitpid()
failed: No child processes"
(this has been freely translated by me from it_IT)

Expected results:
to add a new bookmark OR remove an existing bookmark

Does this happen every time?
yes

Other information:
chmod 0666 ~/.gtk-bookmarks does nothing
Comment 1 Matthias Clasen 2006-02-01 20:40:07 UTC
Thanks for the bug report. Without a stack trace from the crash it's very hard to determine what caused it.
Can you provide us with one? Please see http://live.gnome.org/GettingTraces for more information on how to do so.

Sounds like writing the .gtk-bookmarks file fails. glib used to fork a separate process for this, which is what waitpid() shows up in your error message. 
Recent glib versions don't use a separate process anymore. 

Comment 2 Matteo 'Peach' Pescarin 2006-02-02 00:46:58 UTC
Created attachment 58557 [details]
strace on scite until popup window

the error can be found ~ @ line 13100. this is the result of `strace scite`.
I've recompiled glibc (2.8.5) and gtk+ (2.8.8) omitting -fomit-frame-pointer (just "-O2 -pipe -march=pentium-m -g")
Comment 3 Matteo 'Peach' Pescarin 2006-02-02 11:02:31 UTC
mistyped: glib-2.8.5 not glibc!
Comment 4 Alexander Sabourenkov 2006-02-08 19:55:42 UTC
Problem analysis:

For some obscure reason, bookmark modification is performed in a child process. 
If the parent program had set SIGCHLD to SIG_IGN, and the operating system SIGCHLD handling conforms to POSIX.1-2001 (as linux-2.6 and freebsd-5.4 do), then this problem appears.

man waitpid (gentoo) says this:

       POSIX.1-2001  specifies  that  if  the disposition of SIGCHLD is set to
       SIG_IGN or the SA_NOCLDWAIT flag is set for SIGCHLD (see sigaction(2)),
       then children that terminate do not become zombies and a call to wait()
       or waitpid() will block until all children have  terminated,  and  then
       fail  with  errno set to ECHILD.  (The original POSIX standard left the
       behaviour of setting SIGCHLD to SIG_IGN unspecified.)  Linux  2.6  con-
       forms  to  this  specification.   However, Linux 2.4 (and earlier) does
       not: if a wait() or waitpid() call  is  made  while  SIGCHLD  is  being
       ignored,  the  call  behaves  just  as  though  SIGCHLD  were not being
       ingored, that is, the call blocks until the next child  terminates  and
       then returns the process ID and status of that child.

As per above paragraph, waitpid() call returns -1 errno=ECHILD, 
bookmark modification fails, and user gets a cryptic and confusing 
error message.

Minimal reproduction recipe:
1. Compile the following code:

#include <signal.h>
#include <gtk/gtk.h>

int main( int   argc,
          char *argv[] )
{
    GtkWidget *fsel;
    gtk_init (&argc, &argv);
    signal(SIGCHLD, SIG_IGN);
    fsel = gtk_file_chooser_dialog_new ("Open File",
        NULL, GTK_FILE_CHOOSER_ACTION_OPEN,
        GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
        GTK_STOCK_OPEN, GTK_RESPONSE_ACCEPT, NULL);
    gtk_dialog_run (GTK_DIALOG (fsel));
    gtk_widget_destroy (fsel);
    
    return 0;
}

2. Run the executable
3. Select a directory and push '+' button.

Workaround:

1. Comment out signal(SIGCHLD, SIG_IGN); in the above code
2. Compile
3. Use as a tool for bookmark manipulation. 

:)

PS: 
Compilation instructions:
gcc -o hw gtkhw.c `pkg-config --cflags --libs gtk+-x11-2.0` 

works for me on a recently synced gentoo system.

Comment 5 Matthias Clasen 2006-02-09 04:18:38 UTC
In 2.9.x g_file_set_contents() no longer uses a separate process, so the issue
should be fixed there.