Bug: SIGABRT if "notmuch dump" output file is not writeable
abbot at monksofcool.net
Tue Jul 23 10:38:37 PDT 2019
* 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.
More information about the notmuch