unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
From: Ralph Seichter <abbot@monksofcool.net>
To: David Bremner <david@tethera.net>, notmuch@notmuchmail.org
Subject: Re: Bug: SIGABRT if "notmuch dump" output file is not writeable
Date: Tue, 23 Jul 2019 19:38:37 +0200	[thread overview]
Message-ID: <875zns4pnm.fsf@ra.horus-it.com> (raw)
In-Reply-To: <877e88u7cl.fsf@tethera.net>

* David Bremner:

> that's a message / abort from deep within libz. So odds of our being
> able to fix it are pretty small.

Based on a quick glance on notmuch_database_dump() in notmuch-dump.c, it
seems to me that SIGABRT occurs in line 351:

  350: if (ret != EXIT_SUCCESS && output)
  351:   (void) gzclose_w (output);

gzclose_w(output) has already been called in line 332, before Notmuch
attempts to rename the temp file to the output file. At that point,
'output' should be set to null as it is being checked later, but that
erroneously only happens in case the close operation fails.

The rename in line 341 fails because of permission/ownership issues,
'ret' contains the error code for that, 'output' is still non-null, so
gzclose_w is called again -- ergo boom.

I have not tested or debugged this so far, it is just a Mark-I-Eyeball
analysis. I think I got it right, though. If you agree, I can provide a
fix, which I will actually test.

-Ralph

  reply	other threads:[~2019-07-23 17:38 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-07-22 18:47 Bug: SIGABRT if "notmuch dump" output file is not writeable Ralph Seichter
2019-07-22 22:15 ` David Bremner
2019-07-22 23:37   ` Ralph Seichter
2019-07-23 14:57     ` David Bremner
2019-07-23 17:38       ` Ralph Seichter [this message]
2019-07-23 18:53         ` David Bremner

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://notmuchmail.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=875zns4pnm.fsf@ra.horus-it.com \
    --to=abbot@monksofcool.net \
    --cc=david@tethera.net \
    --cc=notmuch@notmuchmail.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://yhetil.org/notmuch.git/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).