[PATCH 2/2] lib: use a stricter unused macro

2021-02-14 Thread David Bremner
This would have caught bugs like the one corrected in the previous commit.
---
 lib/notmuch-private.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/notmuch-private.h b/lib/notmuch-private.h
index 2fbf7ab9..2f5ccd6a 100644
--- a/lib/notmuch-private.h
+++ b/lib/notmuch-private.h
@@ -76,7 +76,7 @@ NOTMUCH_BEGIN_DECLS
 #define NOTMUCH_CLEAR_BIT(valp,  bit) \
 (_NOTMUCH_VALID_BIT (bit) ? (*(valp) &= ~(1ull << (bit))) : *(valp))
 
-#define unused(x) x __attribute__ ((unused))
+#define unused(x) x ## _unused __attribute__ ((unused))
 
 /* Thanks to Andrew Tridgell's (SAMBA's) talloc for this definition of
  * unlikely. The talloc source code comes to us via the GNU LGPL v. 3.
-- 
2.30.0
___
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-le...@notmuchmail.org


[PATCH 1/2] lib/open: remove incorrect unused attribute

2021-02-14 Thread David Bremner
With the current unused macro in lib/notmuch-private.h this seems
harmless, but is misleading, since the parameter is in fact used.
---
 lib/open.cc | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/open.cc b/lib/open.cc
index b4637ec5..3b86065b 100644
--- a/lib/open.cc
+++ b/lib/open.cc
@@ -186,7 +186,7 @@ notmuch_status_t
 notmuch_database_open_with_config (const char *database_path,
   notmuch_database_mode_t mode,
   const char *config_path,
-  unused(const char *profile),
+  const char *profile,
   notmuch_database_t **database,
   char **status_string)
 {
-- 
2.30.0
___
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-le...@notmuchmail.org


[PATCH] test: Fix race condition in T568-lib-thread.sh

2021-02-14 Thread David Bremner
The assignment of thread-ids is (apparently) non-deterministic in a
way that mostly seems to show up on multicore machines. In my tests
the number is different from that previously assumed by this test
about 15% of the time on a 50 thread (25 core) Xeon.

Since message id's are fixed, use a message known to be in the thread
of interest to pick out the correct thread-id.
---
 test/T568-lib-thread.sh | 10 --
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/test/T568-lib-thread.sh b/test/T568-lib-thread.sh
index ac13d986..088e66dd 100755
--- a/test/T568-lib-thread.sh
+++ b/test/T568-lib-thread.sh
@@ -8,6 +8,11 @@ add_email_corpus
 test_begin_subtest "building database"
 test_expect_success "NOTMUCH_NEW"
 
+test_begin_subtest "finding thread"
+THREAD=$(notmuch search --output=threads 
id:20091117190054.gu3...@dottiness.seas.harvard.edu)
+count=$(notmuch count $THREAD)
+test_expect_equal "$count" "7"
+
 cat <<'EOF' > c_tail
if (stat) {
const char *stat_str = notmuch_database_status_string (db);
@@ -30,7 +35,7 @@ int main (int argc, char** argv)
notmuch_thread_t *thread = NULL;
notmuch_threads_t *threads = NULL;
notmuch_query_t *query = NULL;
-   const char *id = "thread:0009";
+   const char *id = "${THREAD}";
 
stat = notmuch_database_open_verbose (argv[1], 
NOTMUCH_DATABASE_MODE_READ_WRITE, , );
if (stat != NOTMUCH_STATUS_SUCCESS) {
@@ -52,10 +57,11 @@ cat c_head - c_tail <<'EOF' | test_C ${MAIL_DIR}
 printf("%d\n%s\n", thread != NULL, id2);
 }
 EOF
+thread_num=${THREAD#thread:}
 cat < EXPECTED
 == stdout ==
 1
-0009
+${thread_num}
 == stderr ==
 EOF
 test_expect_equal_file EXPECTED OUTPUT
-- 
2.30.0
___
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-le...@notmuchmail.org


Re: Emacs sending email via gmailieer

2021-02-14 Thread Matt Armstrong
Mark Gardner  writes:

> I am so close to getting my ideal email setup working...
>
> Instead of offlineimap or mbsync, I use gmailieer to pull down emails. It
> is quite fast and works with notmuch to map Gmail labels to notmuch tags.
> Much cleaner than the awkward way of accessing Gmail through IMAP. Where I
> am stuck is in sending the email.
>
> I could set up smtpmail as described in
> https://notmuchmail.org/emacstips/#index12h2 but gmailieer recently (v1.1)
> gained the capability to send mail. I would like to use that if I can so.
>
> Gmailieer sends a draft through Gmail without a problem (once I create a
> draft using message mode in emacs). Both sending a file and sending from
> stdin work:
> $ gmi send -C path/to/mailbox 1586809748.A123456Z12345.test\:2\,D
> $ cat 1586809748.A123456Z12345.test\:2\,D | gmi send -C path/to/mailbox
>
> But I am stuck configuring emacs to use gmailieer instead of sendmail or
> smtpmail.el. According to the emacs manual, the variable send-mail-function
> can be set but none of the choices looks appropriate for gmailieer:
> https://www.gnu.org/software/emacs/manual/html_node/emacs/Mail-Sending.html
>
> Anyone have an idea how to configure emacs to use gmailieer to send emails?

Mark, you'll likely have to write a send-mail-function that works with
ilieer. Or, you'll have to write a wrapper script that makes ilieer's
command line behave similarly to the classic Unix sendmail. At my former
employer we took the second option. SMTP was locked down but the
security folks provided a command line tool that could send email. The
Emacs afficionados patched that program to be behavior-compatible with
sendmail so we could set Emacs' 'send-mail-function' to
the 'sendmail-send-it' function.

Hope that helps!
___
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-le...@notmuchmail.org