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 741786 - Gets stuck while closing fds before execing gpg
Gets stuck while closing fds before execing gpg
Status: RESOLVED FIXED
Product: evolution-data-server
Classification: Platform
Component: Mailer
3.12.x (obsolete)
Other Linux
: Normal normal
: ---
Assigned To: evolution-mail-maintainers
Evolution QA team
Depends on:
Blocks:
 
 
Reported: 2014-12-19 20:56 UTC by Debarshi Ray
Modified: 2015-01-05 15:54 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Don't get stuck while closing fds before execing GPG (973 bytes, patch)
2014-12-19 20:59 UTC, Debarshi Ray
reviewed Details | Review

Description Debarshi Ray 2014-12-19 20:56:38 UTC
While closing fds using fcntl, if the call fails (eg., due to "bad file descriptor" when the fd being closed was never open in the first place) the attempt to write the debug message to stdout causes the system call to never return. Possibly because stdin has already been redirected to the parent process.

Backtrace of stillborn child process:

(gdb) bt
  • #0 write
    at ../sysdeps/unix/syscall-template.S line 81
  • #1 write_string
  • #2 g_log_default_handler
  • #3 g_logv
    at gmessages.c line 1020
  • #4 g_log
  • #5 gpg_ctx_op_start
    at camel-gpg-context.c line 652
  • #6 gpg_verify_sync
    at camel-gpg-context.c line 1902
  • #7 camel_cipher_context_verify_sync
    at camel-cipher-context.c line 493
  • #8 empe_mp_signed_parse
    at e-mail-parser-multipart-signed.c line 129
  • #9 e_mail_parser_parse_part_as
    at e-mail-parser.c line 563
  • #10 empe_message_parse
    at e-mail-parser-message.c line 91
  • #11 mail_parser_run
    at e-mail-parser.c line 127
  • #12 e_mail_parser_parse_sync
    at e-mail-parser.c line 349
  • #13 mail_reader_parse_message_run
    at e-mail-reader-utils.c line 2374
  • #14 run_in_thread
    at gsimpleasyncresult.c line 858
  • #15 io_job_thread
    at gioscheduler.c line 85
  • #16 g_task_thread_pool_thread
    at gtask.c line 1215
  • #17 g_thread_pool_thread_proxy
    at gthreadpool.c line 307
  • #18 g_thread_proxy
    at gthread.c line 764
  • #19 start_thread
    at pthread_create.c line 310
  • #20 clone
    at ../sysdeps/unix/sysv/linux/x86_64/clone.S line 109
  • #1 write_string
  • #2 g_log_default_handler
  • #3 g_logv
    at gmessages.c line 1020
  • #4 g_log
  • #5 gpg_ctx_op_start
    at camel-gpg-context.c line 652
$1 = 589
(gdb) print maxfd
$2 = 1024
(gdb)
Comment 1 Debarshi Ray 2014-12-19 20:59:03 UTC
Created attachment 293098 [details] [review]
Don't get stuck while closing fds before execing GPG

Possible fix - not printing the error message is probably harmless in this case and fixes the problem for me.
Comment 2 Milan Crha 2015-01-05 15:53:35 UTC
Review of attachment 293098 [details] [review]:

Thanks for a bug report and patch. I took your version and slightly modified it. My change may just silence Coverity Scan warnings, plus I added a comment to not print error messages there.
Comment 3 Milan Crha 2015-01-05 15:54:37 UTC
Created commit 1254674 in eds master (3.13.10+) [1]
Created commit 46b678b in eds evolution-data-server-3-12 (3.12.10+)

[1] https://git.gnome.org/browse/evolution-data-server/commit/?id=1254674