Your message dated Tue, 19 Jul 2016 10:26:23 +0000
with message-id <[email protected]>
and subject line Bug#826843: fixed in notmuch 0.22.1-1
has caused the Debian Bug report #826843,
regarding Calls to notmuch_database_add_message() after 
notmuch_database_close() crash
to be marked as done.

This means that you claim that the problem has been dealt with.
If this is not the case it is now your responsibility to reopen the
Bug report if necessary, and/or fix the problem forthwith.

(NB: If you are a system administrator and have no idea what this
message is talking about, this may indicate a serious mail system
misconfiguration somewhere. Please contact [email protected]
immediately.)


-- 
826843: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=826843
Debian Bug Tracking System
Contact [email protected] with problems
--- Begin Message ---
Package: libnotmuch-dev
Version: 0.18.2-1
Severity: important

In the API documentation for notmuch_database_close() it says:

 * After notmuch_database_close has been called, calls to other
 * functions on objects derived from this database may either behave
 * as if the database had not been closed (e.g., if the required data
 * has been cached) or may fail with a
 * NOTMUCH_STATUS_XAPIAN_EXCEPTION.

However, if you call notmuch_database_close() on a database and then
call notmuch_database_add_message(), it doesn't fail nicely with a
NOTMUCH_STATUS_XAPIAN_EXCEPTION, it segfaults.

This should either be fixed so it doesn't crash, as documented, or the
documentation should be changed to describe which functions are unsafe
to call after notmuch_database_close().

I'm attaching a small C program to reproduce the bug. It crashes with
the following backtrace:

(gdb) bt
#0  0xb71f3f27 in Xapian::WritableDatabase::begin_transaction(bool) ()
   from /usr/lib/sse2/libxapian.so.22
#1  0xb779480d in notmuch_database_begin_atomic ()
   from /usr/lib/i386-linux-gnu/libnotmuch.so.3
#2  0xb7794fa0 in notmuch_database_add_message ()
   from /usr/lib/i386-linux-gnu/libnotmuch.so.3
#3  0x080488d3 in add_new_email (db=0x82b5610, 
    filename=0x8048b51 "/[email protected]:2,", content=0x8048b30
"hello")
    at notmuchcrash.c:27
#4  0x080489d7 in main () at notmuchcrash.c:52


Installed version of libxapian22: 1.2.19-1+deb8u1


-- System Information:
Debian Release: 8.5
  APT prefers stable-updates
  APT policy: (500, 'stable-updates'), (500, 'stable')
Architecture: i386 (i686)

Kernel: Linux 3.16.0-4-686-pae (SMP w/2 CPU cores)
Locale: LANG=en_GB.utf8, LC_CTYPE=en_GB.utf8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Init: systemd (via /run/systemd/system)

Versions of packages libnotmuch-dev depends on:
ii  libnotmuch3  0.18.2-1

libnotmuch-dev recommends no packages.

libnotmuch-dev suggests no packages.

-- no debconf information
/* Compile with:
   gcc -g -std=c99 -Wall -Werror -o notmuchcrash -lnotmuch notmuchcrash.c
*/

#define _POSIX_C_SOURCE 200809L

#include <stdio.h>
#include <stdlib.h>
#include <string.h>

#include <notmuch.h>


#define DIE(msg) do { perror(msg); exit(EXIT_FAILURE); } while (0)


void add_new_email(notmuch_database_t* db,
                   char const* filename, char const* content) {
  char mail_path[64];
  strcpy(mail_path, notmuch_database_get_path(db));
  strcat(mail_path, filename);
  FILE* mf = fopen(mail_path, "w+");
  if (!mf) DIE("Failed to open mail file");
  if (fwrite(content, strlen(content), 1, mf) != 1)
    DIE("Failed to write mail");
  if (fclose(mf)) DIE("Failed to close file");
  if (notmuch_database_add_message(db, mail_path, NULL) !=
      NOTMUCH_STATUS_FILE_NOT_EMAIL)
    DIE("Something went wrong when adding the email");
}


int main() {

  /* Create new database. */
  char db_path[32];
  strcpy(db_path, "/tmp/notmuchcrash-XXXXXX");
  if (!mkdtemp(db_path)) DIE("Failed to create unique directory");
  notmuch_database_t* db;
  if (notmuch_database_create(db_path, &db)) DIE("Failed to create database");

  /* This doesn't have to be a valid email, it will crash either way. */
  char const* mail_data = "hello";

  /* First, try to add a file before closing. */
  add_new_email(db, "/[email protected]:2,", mail_data);
  
  /* Close the database. */
  notmuch_database_close(db);

  /* Now try again. This will crash. */
  add_new_email(db, "/[email protected]:2,", mail_data);
  
  return 0;
}

--- End Message ---
--- Begin Message ---
Source: notmuch
Source-Version: 0.22.1-1

We believe that the bug you reported is fixed in the latest version of
notmuch, which is due to be installed in the Debian FTP archive.

A summary of the changes between this version and the previous one is
attached.

Thank you for reporting the bug, which will now be closed.  If you
have further comments please address them to [email protected],
and the maintainer will reopen the bug report if appropriate.

Debian distribution maintenance software
pp.
David Bremner <[email protected]> (supplier of updated notmuch package)

(This message was generated automatically at their request; if you
believe that there is a problem with it please contact the archive
administrators by mailing [email protected])


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

Format: 1.8
Date: Tue, 19 Jul 2016 06:42:09 -0300
Source: notmuch
Binary: notmuch libnotmuch4 libnotmuch-dev python-notmuch python3-notmuch 
ruby-notmuch notmuch-emacs notmuch-vim notmuch-mutt notmuch-dbg
Architecture: source
Version: 0.22.1-1
Distribution: unstable
Urgency: medium
Maintainer: Carl Worth <[email protected]>
Changed-By: David Bremner <[email protected]>
Description:
 libnotmuch-dev - thread-based email index, search and tagging (development)
 libnotmuch4 - thread-based email index, search and tagging (runtime)
 notmuch    - thread-based email index, search and tagging
 notmuch-dbg - thread-based email index, search and tagging - debugging symbols
 notmuch-emacs - thread-based email index, search and tagging (emacs interface)
 notmuch-mutt - thread-based email index, search and tagging (Mutt interface)
 notmuch-vim - thread-based email index, search and tagging (vim interface)
 python-notmuch - python interface to the notmuch mail search and index library
 python3-notmuch - Python 3 interface to the notmuch mail search and index 
library
 ruby-notmuch - Ruby interface to the notmuch mail search and index library
Closes: 826843
Changes:
 notmuch (0.22.1-1) unstable; urgency=medium
 .
   * Correct the definition of `LIBNOTMUCH_CHECK_VERSION`.
   * Document the (lack of) operations permitted on a closed database
     (Closes: #826843).
   * Fix race condition in dump / restore tests.
   * [notmuch-emacs] Tell `message-mode` mode that outgoing messages are mail
   * [notmuch-emacs] Respect charset of MIME parts when reading them
Checksums-Sha1:
 1acf2b860e4000d4a4d875cb3730db7f98bba15e 2788 notmuch_0.22.1-1.dsc
 216615e10d17a4917089c491361bc5844c0a86b9 683286 notmuch_0.22.1.orig.tar.gz
 91912cee33b8e8729b20ad4d32c34e6e5fcd32d6 15220 notmuch_0.22.1-1.debian.tar.xz
Checksums-Sha256:
 92f802a36d633901658c9330c3a27b2c68db9d01b452568d02926c36b065b4d4 2788 
notmuch_0.22.1-1.dsc
 e739457794f3c2b363beffa3ed9e8a2786921031c80672f5b06d0880876a974b 683286 
notmuch_0.22.1.orig.tar.gz
 2add4357e4775227ba22bb0297852cb72da19f62e4e7a820cbcf8924473baa08 15220 
notmuch_0.22.1-1.debian.tar.xz
Files:
 fde131395bed45f2d3b6d99e1ec11499 2788 mail optional notmuch_0.22.1-1.dsc
 5093abaca53f3690f091022eb9a75d8a 683286 mail optional 
notmuch_0.22.1.orig.tar.gz
 e1d28d10a1354f1848590c22354ecdd6 15220 mail optional 
notmuch_0.22.1-1.debian.tar.xz

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1

iQGcBAEBCAAGBQJXjflJAAoJEPIClx2kp54sUTsL/2nYlHtiBVrB0Zuhjd6PSmfr
6iUOpbMAXXR/8/QtoJ2pEk+hpRFR8cb/UJGWymHRhnEQKpS13a/EZgQ5bqP1/4uD
lTPoFKJeliJpUUoRicNls1hYCnSzN593LGVIahVIwgxedD8twNi8PR5sxBL5R/+D
Llmnhhv1Wo9HUiA8syAPmZRgKXhEamNg2tHHf39jJgnnOHQDKTIaR2+OwU6HzjvT
eDhCkLoiznR1hVGuoAuCdojj7Sl/vti4QFS5+s0OoY2Qc59E9Mv4WUu+iynLpTn8
Nw3H8UhPDAx+6K1yp9at2a/sx+mIInAka04pDeu4uI4fwNBD6q7aKDwsgWG1b3WJ
9ZpAkwv2I8rH/Jk+6qZwWnwD323M4lHuMLMc59/rkdeUP/OU3NGSNe+kYE8nXiAl
6QknZoq4t/5WSvjhHfoU6C4DnbwnrEwUUMn4/o6hhPnWsNKTZF9fFa7J3sjMVvNW
gMiryxWtIDsV/AT6WiZEvUT/WdJ5q+0pLRsgmp03ug==
=87LW
-----END PGP SIGNATURE-----

--- End Message ---

Reply via email to