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 693200 - Printing via evince crashes badly when /tmp is not writable
Printing via evince crashes badly when /tmp is not writable
Status: RESOLVED FIXED
Product: gtk+
Classification: Platform
Component: Printing
3.8.x
Other Linux
: Normal critical
: ---
Assigned To: gtk-bugs
gtk-bugs
Depends on:
Blocks:
 
 
Reported: 2013-02-05 13:58 UTC by David von Oheimb
Modified: 2014-03-18 15:05 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Evince stacktrace on crash when /tmp is not writable (62.50 KB, text/plain)
2013-02-05 13:58 UTC, David von Oheimb
  Details
Fail nicely when /tmp is not writable (2.88 KB, patch)
2014-03-14 15:21 UTC, Marek Kašík
committed Details | Review
Fail nicely when /tmp is not writable (gtk 2.24) (2.88 KB, patch)
2014-03-14 15:22 UTC, Marek Kašík
committed Details | Review

Description David von Oheimb 2013-02-05 13:58:19 UTC
Created attachment 235204 [details]
Evince stacktrace on crash when /tmp is not writable

For some reason (maybe lack of space), permissions on my /tmp folder became:
drwxr-xr-x 25 root root

This causes evince to crash on printing, with the trace attached.
Evince must be made more robust on such problems.

The problem is easily reproducible an can be of course circumvented
by making /tmp writable to all.
Comment 1 Christian Persch 2013-06-09 21:31:31 UTC
*** glibc detected *** evince: double free or corruption (out): 0x00007f6fb8d3a220 ***

While nonwritable /tmp may have contributed, this is a memory corruption bug. The bug happened ealier than the crash. Please use valgrind (see https://live.gnome.org/Valgrind ) how to track this down.
Comment 2 David von Oheimb 2013-06-12 07:54:35 UTC
Thanks for your response.

I was not able to install valgrind, due to a strange dependency issue with libc6-dbg.
You can enjoy the crash live (and use whatever analysis tool to trace down the memory bug) by reproducing the failure in the obvious way: 

chmod 755 /tmp
evince whatever.pdf
Then try printing the document from Evince.

BTW, I'm currently using 3.4.0-0ubuntu1.6
Comment 3 Germán Poo-Caamaño 2013-06-15 18:36:41 UTC
This problem seems to be in gtkprinter (gtk_printer_request_details).  It is possible to reproduce with other applications as well.

FWIW, my gtk+ version is from May 20, 2013 (a3864ac49f3).

Step to reproduce it:
1. sudo chown 755 /tmp
2. open an application like Evince or Gedit
3. Ctrl-P (to print)
4. Segfault.

It is not expected the user changes the permission of /tmp, however the reporter did not it by himself.  It might be good to catch it instead of crashing.

Thread 1 (Thread 0xb5999ac0 (LWP 5048))

  • #0 __kernel_vsyscall
  • #1 __GI_raise
    at ../nptl/sysdeps/unix/sysv/linux/raise.c line 64
  • #2 __GI_abort
    at abort.c line 91
  • #3 __libc_message
    at ../sysdeps/unix/sysv/linux/libc_fatal.c line 201
  • #4 malloc_printerr
    at malloc.c line 5018
  • #5 g_free
    at gmem.c line 252
  • #6 cups_request_ppd
    at gtkprintbackendcups.c line 3434
  • #7 gtk_printer_request_details
    at gtkprinter.c line 895
  • #8 selected_printer_changed
    at gtkprintunixdialog.c line 1912
  • #9 g_cclosure_marshal_VOID__VOIDv
    at gmarshal.c line 115
  • #10 _g_closure_invoke_va
    at gclosure.c line 840
  • #11 g_signal_emit_valist
    at gsignal.c line 3234
  • #12 g_signal_emit
    at gsignal.c line 3384
  • #13 _gtk_tree_selection_internal_select_node
    at gtktreeselection.c line 1604
  • #14 gtk_tree_selection_select_path
    at gtktreeselection.c line 907
  • #15 gtk_tree_selection_select_iter
    at gtktreeselection.c line 985
  • #16 printer_added_cb
    at gtkprintunixdialog.c line 870
  • #17 g_cclosure_marshal_VOID__OBJECTv
    at gmarshal.c line 1312
  • #18 _g_closure_invoke_va
    at gclosure.c line 840
  • #19 g_signal_emit_valist
    at gsignal.c line 3234
  • #20 g_signal_emit_by_name
    at gsignal.c line 3424
  • #21 cups_request_printer_list_cb
    at gtkprintbackendcups.c line 3111
  • #22 cups_dispatch_watch_dispatch
    at gtkprintbackendcups.c line 1363
  • #23 g_main_dispatch
    at gmain.c line 3054
  • #24 g_main_context_dispatch
    at gmain.c line 3630
  • #25 g_main_context_iterate
    at gmain.c line 3701
  • #26 g_main_context_iterate
    at gmain.c line 3638
  • #27 g_main_context_iteration
    at gmain.c line 3762
  • #28 g_application_run
    at gapplication.c line 1623
  • #29 main
    at main.c line 332

Comment 4 Marek Kašík 2014-03-14 15:21:50 UTC
Created attachment 271909 [details] [review]
Fail nicely when /tmp is not writable

This patch fixes most issues with the non-writable /tmp for me. It is applicable also to 3.10.
Comment 5 Marek Kašík 2014-03-14 15:22:22 UTC
Created attachment 271910 [details] [review]
Fail nicely when /tmp is not writable (gtk 2.24)

The same patch for gtk-2-24.
Comment 6 Matthias Clasen 2014-03-14 15:38:22 UTC
Review of attachment 271909 [details] [review]:

::: gtk/gtkprintunixdialog.c
@@ +2053,2 @@
       return;
     }

Does this change make any difference ? Not that there is anything wrong with it, I just don't see how it can be relevant to writable /tmp. Not like gtk_printer_request_details would throw an exception in that case...
Comment 7 Marek Kašík 2014-03-14 15:50:43 UTC
This part makes the dialog to show that the getting of details failed.
If we don't move the gtk_printer_request_details() then the printer state "Getting printer information failed" (as set by processing of gtk_printer_request_details()) is overwritten by the "Getting printer information…" in the gtk_list_store_set() (cursor is also affected by the move).
Comment 8 Matthias Clasen 2014-03-14 16:20:59 UTC
Review of attachment 271909 [details] [review]:

Ah, ok. Makes sense then
Comment 9 Marek Kašík 2014-03-18 12:34:48 UTC
Thank you for the review. Can I commit the 2.24 version to gtk-2-24 branch and the master version to 3.10 too?
Comment 10 Matthias Clasen 2014-03-18 14:57:30 UTC
oh, dang I thought I had seen this on the 2.24 branch. Please go ahead. 3.10 too
Comment 11 Marek Kašík 2014-03-18 15:05:13 UTC
Comment on attachment 271910 [details] [review]
Fail nicely when /tmp is not writable (gtk 2.24)

(In reply to comment #10)
> oh, dang I thought I had seen this on the 2.24 branch. Please go ahead. 3.10 too

Thank you. I've pushed it to gtk-2-24 and gtk-3-10.