Re: v2 fix leaks in n_d_open_with_config
I can confirm this fixes the leak on my end. Thanks! > I'm slightly worried that ASAN tests will prove to be flaky. If I recall correctly, the Chromium project runs ASAN in their CI pipelines and it's pretty stable. Hopefully that's some evidence towards their stability. Austin -- https://austinray.io Open Source Maintainer, Software Engineer, Keyboard Enthusiast GPG: 0127 ED83 B939 CCC9 8082 476E 1AA0 B115 C8AC 2C9E signature.asc Description: PGP signature ___ notmuch mailing list -- notmuch@notmuchmail.org To unsubscribe send an email to notmuch-le...@notmuchmail.org
nmweb: jquery-ui.js returns a 404
Hi, https://nmbug.notmuchmail.org/nmweb/static/js/jquery-ui.js returns a 404 so nmweb's date pickers don't work. Based on the symlink in the repo, it looks like a deployment issue. Hope this helps! Austin -- https://austinray.io Open Source Maintainer, Software Engineer, Keyboard Enthusiast GPG: 0127 ED83 B939 CCC9 8082 476E 1AA0 B115 C8AC 2C9E signature.asc Description: PGP signature ___ notmuch mailing list -- notmuch@notmuchmail.org To unsubscribe send an email to notmuch-le...@notmuchmail.org
Memory leak in notmuch_database_destroy()
Hi, libnotmuch 5.5.0 (notmuch 0.34.2) leaks memory when opening a database with 'notmuch_database_open_with_config()' and cleaning it up with 'notmuch_database_destroy()'. I've included a reproducer program (based on an existing notmuch test) and ASAN output below. Replacing 'notmuch_database_destroy()' with 'notmuch_database_close()' or omitting the database clean-up entirely resolves all but the first ASAN entry. There's no leak if 'notmuch_database_open_with_config()' returns an error. Thanks! Austin Reproducer program: #include #include int main(int argc, char **argv) { notmuch_database_t *db = NULL; notmuch_status_t st = notmuch_database_open_with_config( argv[1], NOTMUCH_DATABASE_MODE_READ_ONLY, argv[2], NULL, , NULL); if (db != NULL) { notmuch_database_destroy(db); } printf("db != NULL: %d\n", db != NULL); } ASAN output: = ==1059281==ERROR: LeakSanitizer: detected memory leaks Direct leak of 32 byte(s) in 1 object(s) allocated from: #0 0x7fb9d1230777 in __interceptor_malloc (/usr/lib/gcc/x86_64-pc-linux-gnu/11.2.0/libasan.so.6+0xb6777) #1 0x7fb9d0a2b098 in g_malloc (/usr/lib64/libglib-2.0.so.0+0x5b098) Direct leak of 8 byte(s) in 1 object(s) allocated from: #0 0x7fb9d1232137 in operator new(unsigned long) (/usr/lib/gcc/x86_64-pc-linux-gnu/11.2.0/libasan.so.6+0xb8137) #1 0x7fb9d1164ef4 (/usr/lib64/libnotmuch.so.5+0x2aef4) #2 0x7fb9d1165abc in notmuch_database_open_with_config (/usr/lib64/libnotmuch.so.5+0x2babc) Indirect leak of 56 byte(s) in 1 object(s) allocated from: #0 0x7fb9d1232137 in operator new(unsigned long) (/usr/lib/gcc/x86_64-pc-linux-gnu/11.2.0/libasan.so.6+0xb8137) #1 0x7fb9d08ef849 (/usr/lib64/libxapian.so.30+0x15d849) #2 0x7fb9d1165abc in notmuch_database_open_with_config (/usr/lib64/libnotmuch.so.5+0x2babc) Indirect leak of 25 byte(s) in 1 object(s) allocated from: #0 0x7fb9d1230777 in __interceptor_malloc (/usr/lib/gcc/x86_64-pc-linux-gnu/11.2.0/libasan.so.6+0xb6777) #1 0x7fb9d08efded (/usr/lib64/libxapian.so.30+0x15dded) SUMMARY: AddressSanitizer: 121 byte(s) leaked in 4 allocation(s). -- https://austinray.io Open Source Maintainer, Software Engineer, Keyboard Enthusiast GPG: 0127 ED83 B939 CCC9 8082 476E 1AA0 B115 C8AC 2C9E signature.asc Description: PGP signature ___ notmuch mailing list -- notmuch@notmuchmail.org To unsubscribe send an email to notmuch-le...@notmuchmail.org
[PATCH] fix(nmweb): replace deprecated method
Python 3.2 deprecated 'cgi.escape()' and Python 3.8 removed it[1][2]. Its replacement is 'html.escape()'. [0] https://docs.python.org/3.7/library/cgi.html#cgi.escape [1] https://docs.python.org/3/whatsnew/3.8.html#api-and-feature-removals [2] https://bugs.python.org/issue33843 Signed-off-by: Austin Ray --- contrib/notmuch-web/nmweb.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/contrib/notmuch-web/nmweb.py b/contrib/notmuch-web/nmweb.py index 9e337436..0754a502 100755 --- a/contrib/notmuch-web/nmweb.py +++ b/contrib/notmuch-web/nmweb.py @@ -14,7 +14,7 @@ from mailbox import MaildirMessage import mimetypes import email import re -import cgi +import html import os import bleach @@ -265,7 +265,7 @@ def format_message_walk(msg, mid): yield '' out = part.get_payload(decode=True) out = decodeAnyway(out, part.get_content_charset('ascii')) -out = cgi.escape(out) +out = html.escape(out) out = out.encode('ascii', 'xmlcharrefreplace').decode('ascii') if linkify_plaintext: out = bleach.linkify(out, callbacks=[require_protocol_prefix]) yield out -- 2.32.0 ___ notmuch mailing list -- notmuch@notmuchmail.org To unsubscribe send an email to notmuch-le...@notmuchmail.org
Re: WIP fixes for nulling of database argument on error
Hi David, This resolves both the non-NULL pointer and memory leak reported by ASAN. Thanks! Austin -- https://austinray.io Open Source Maintainer, Software Engineer, Keyboard Enthusiast GPG: 0127 ED83 B939 CCC9 8082 476E 1AA0 B115 C8AC 2C9E signature.asc Description: PGP signature ___ notmuch mailing list -- notmuch@notmuchmail.org To unsubscribe send an email to notmuch-le...@notmuchmail.org
Re: notmuch_database_open_with_config() does not NULL pointer on error
Following up on this, ASAN reports a memory leak on a failure. Using 'notmuch_database_close()' or 'notmuch_database_destroy()' results in a SEGFAULT. I've updated my reproducer program to free the database on non-failure cases so it's easier to see the memory leak. #include #include int main() { const char *db_path = "/home/aray/mail"; notmuch_database_t *db = NULL; notmuch_status_t st = notmuch_database_open_with_config( db_path, NOTMUCH_DATABASE_MODE_READ_ONLY, NULL, NULL, , NULL); if (st != NOTMUCH_STATUS_SUCCESS) { printf("Received status: %s\n", notmuch_status_to_string(st)); if (db) { printf("Received non-null DB pointer\n"); return -1; } } if (db) { notmuch_database_destroy(db); } return 0; } If there's an obvious way to fix the memory leak that I may have overlooked, please let me know. I'm not a C expert. Thanks, Austin -- https://austinray.io Open Source Maintainer, Software Engineer, Keyboard Enthusiast GPG: 0127 ED83 B939 CCC9 8082 476E 1AA0 B115 C8AC 2C9E signature.asc Description: PGP signature ___ notmuch mailing list -- notmuch@notmuchmail.org To unsubscribe send an email to notmuch-le...@notmuchmail.org
notmuch_database_open_with_config() does not NULL pointer on error
Submitting this bug report per bremner's request (thanks for the assist today!) The documentation for 'notmuch_database_open_with_config()' states: > In case of any failure, this function returns an error status and > sets *database to NULL. However, it's possible to trigger a failure and leave *database in a partially initialized state. Usage of this pointer causes a segfault in libnotmuch. Below is a small reproducer program that causes a no config file failure and outputs if it has a non-NULL database pointer. #include #include int main() { const char *db_path = "/home/aray/mail/"; notmuch_database_t *db = NULL; notmuch_status_t st = notmuch_database_open_with_config( db_path, NOTMUCH_DATABASE_MODE_READ_ONLY, NULL, NULL, , NULL); if (st != NOTMUCH_STATUS_SUCCESS) { printf("Received status: %s\n", notmuch_status_to_string(st)); if (db) { printf("Received non-null DB pointer\n"); return -1; } } return 0; } Please set 'db_path' to your notmuch database path and call the program like such: NOTMUCH_CONFIG="./nonexistent" ./reprod -- https://austinray.io Open Source Maintainer, Software Engineer, Keyboard Enthusiast GPG: 0127 ED83 B939 CCC9 8082 476E 1AA0 B115 C8AC 2C9E signature.asc Description: PGP signature ___ notmuch mailing list -- notmuch@notmuchmail.org To unsubscribe send an email to notmuch-le...@notmuchmail.org
Re: [PATCH] lib: load user config. in notmuch_database_open_verbose()
> I guess "-v 2" makes sense here. It's just a hint that the new patch > obsoletes a previous one. Thanks! I appreciate the help! Austin signature.asc Description: PGP signature ___ notmuch mailing list -- notmuch@notmuchmail.org To unsubscribe send an email to notmuch-le...@notmuchmail.org
[PATCH v2] lib: correct deprecated db open functions' docs
Both notmuch_database_open() and notmuch_database_open_verbose()'s documentation state they call notmuch_database_open_with_config() with config_path=NULL; however, their implementations pass an empty string. The empty string is the correct value to maintain their original behavior of not loading the user's configuration so their documentation is incorrect. --- lib/notmuch.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/notmuch.h b/lib/notmuch.h index 3b28bea3..876d35d3 100644 --- a/lib/notmuch.h +++ b/lib/notmuch.h @@ -316,7 +316,7 @@ typedef enum { /** * Deprecated alias for notmuch_database_open_with_config with - * config_path=error_message=NULL + * config_path="" and error_message=NULL * @deprecated Deprecated as of libnotmuch 5.4 (notmuch 0.32) */ /* NOTMUCH_DEPRECATED(5, 4) */ @@ -326,7 +326,7 @@ notmuch_database_open (const char *path, notmuch_database_t **database); /** * Deprecated alias for notmuch_database_open_with_config with - * config_path=NULL + * config_path="" * * @deprecated Deprecated as of libnotmuch 5.4 (notmuch 0.32) * -- 2.31.1 ___ notmuch mailing list -- notmuch@notmuchmail.org To unsubscribe send an email to notmuch-le...@notmuchmail.org
Re: [PATCH] lib: load user config. in notmuch_database_open_verbose()
> So maybe it's a doc bug? That sounds good to me. Since notmuch_database_open() has a similar doc bug, would you like the corrections in one or two patches during the resubmit? Also, since I'm new to this git workflow, should I use the "-vN" option for the resubmit or leave it off as this patch won't be included? Thanks! Austin signature.asc Description: PGP signature ___ notmuch mailing list -- notmuch@notmuchmail.org To unsubscribe send an email to notmuch-le...@notmuchmail.org
[PATCH] lib: bump libnotmuch minor version
Notmuch 0.32 corresponds to libnotmuch 5.4 as indicated by docstrings; however, the minor number wasn't bumped. Any libnotmuch downstream consumer using the LIBNOTMUCH_CHECK_VERSION macro to support multiple versions won't be able to access the new 5.4 functions. Signed-off-by: Austin Ray --- lib/notmuch.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/notmuch.h b/lib/notmuch.h index 3b28bea3..98477273 100644 --- a/lib/notmuch.h +++ b/lib/notmuch.h @@ -58,7 +58,7 @@ NOTMUCH_BEGIN_DECLS * version in Makefile.local. */ #define LIBNOTMUCH_MAJOR_VERSION5 -#define LIBNOTMUCH_MINOR_VERSION3 +#define LIBNOTMUCH_MINOR_VERSION4 #define LIBNOTMUCH_MICRO_VERSION0 -- 2.31.1 ___ notmuch mailing list -- notmuch@notmuchmail.org To unsubscribe send an email to notmuch-le...@notmuchmail.org