folder: search-term problems

2015-08-20 Thread Charles Celerier
Hello,

I've been having trouble getting the folder: search-term to work
correctly. I can successfully do a query of the count for INBOX, but
nothing else. Here are some examples from running notmuch on the command
line.

$ pwd
/Users/cceleri/Maildir

$ ls
Archive   INBOX NotJunk   Trash
DraftsJunk  Sent Messages

$ notmuch count folder:INBOX
19517

$ notmuch count folder:Junk
0

Am I using the folder: search-term incorrectly?

Best,
Charles
___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch


Re: folder: search-term problems

2015-08-20 Thread Charles Celerier
Doh! I just realized that everything in my Junk folder is tagged junk
which is one of my configured search.exclude_tags. Nevermind, all is
well.

Thank you to all the kind folks who continue to maintain notmuch!

-charles

Charles Celerier ccel...@cs.stanford.edu writes:

 Hello,

 I've been having trouble getting the folder: search-term to work
 correctly. I can successfully do a query of the count for INBOX, but
 nothing else. Here are some examples from running notmuch on the command
 line.

 $ pwd
 /Users/cceleri/Maildir

 $ ls
 Archive   INBOX NotJunk   Trash
 DraftsJunk  Sent Messages

 $ notmuch count folder:INBOX
 19517

 $ notmuch count folder:Junk
 0

 Am I using the folder: search-term incorrectly?

 Best,
 Charles


signature.asc
Description: PGP signature
___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch


[PATCH v2] emacs: Added "is:" style completion to notmuch-read-query.

2014-12-01 Thread Charles Celerier
I see now. I tried using lexical-let*, but now it appears that pulling
the assignment of minibuffer-completion-table into the lexical-let*
breaks the function, while pulling all the other assigments in works
fine. I'm not sure why that happens. I am not a very skilled emacs-lisp
programmer, so I am afraid something funny is happening here that is
beyond my understanding.

charles

David Bremner  writes:

> Charles Celerier  writes:
>
>> Can the variables in the varlist depend on the definition of variables
>> that precede them in the list? I believe I tried your suggestion, but
>> quickly gave up as Emacs gave me an error claiming that all-tags was
>> void.
>
> That's the point of lexical-let* vs lexical-let
>
> d
-- next part --
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 480 bytes
Desc: not available
URL: 
<http://notmuchmail.org/pipermail/notmuch/attachments/20141201/791543e6/attachment.pgp>


[PATCH v2] emacs: Added "is:" style completion to notmuch-read-query.

2014-12-01 Thread Charles Celerier
Can the variables in the varlist depend on the definition of variables
that precede them in the list? I believe I tried your suggestion, but
quickly gave up as Emacs gave me an error claiming that all-tags was
void.

charles

David Edmondson  writes:

> On Sat, Nov 29 2014, Charles Celerier wrote:
>> The notmuch-search-terms man page states that "tag:" is equivalent
>> to "is:". Completion for "is:" style searches is now supported
>> in the Emacs interface.
>>
>> Signed-off-by: Charles Celerier 
>> ---
>>  emacs/notmuch.el | 11 +++
>>  1 file changed, 7 insertions(+), 4 deletions(-)
>>
>> diff --git a/emacs/notmuch.el b/emacs/notmuch.el
>> index 218486a..d29499c 100644
>> --- a/emacs/notmuch.el
>> +++ b/emacs/notmuch.el
>> @@ -856,12 +856,15 @@ See `notmuch-tag' for information on the format of 
>> TAG-CHANGES."
>>  
>>  PROMPT is the string to prompt with."
>>(lexical-let
>> +(( all-tags
>> +(mapcar (lambda (tag) (notmuch-escape-boolean-term tag))
>> +(process-lines notmuch-command "search" "--output=tags" 
>> "*"
>> +  (let
>
> I think that David's suggestion was that you would have only one `let'
> form, so something like:
>
>  (lexical-let*
>((all-tags (mapcar ...))
> (completions (append ...))
> (keymap (copy-keymap ...))
> (current-query ...))
>  ...)
>
>>((completions
>>  (append (list "folder:" "path:" "thread:" "id:" "date:" "from:" "to:"
>>"subject:" "attachment:")
>> -(mapcar (lambda (tag)
>> -  (concat "tag:" (notmuch-escape-boolean-term tag)))
>> -(process-lines notmuch-command "search" "--output=tags" 
>> "*")
>> +(mapcar (lambda (tag) (concat "tag:" tag)) all-tags)
>> +(mapcar (lambda (tag) (concat "is:" tag)) all-tags
>>  (let ((keymap (copy-keymap minibuffer-local-map))
>>(current-query (case major-mode
>> (notmuch-search-mode (notmuch-search-get-query))
>> @@ -884,7 +887,7 @@ PROMPT is the string to prompt with."
>>(define-key keymap (kbd "TAB") 'minibuffer-complete)
>>(let ((history-delete-duplicates t))
>>  (read-from-minibuffer prompt nil keymap nil
>> -  'notmuch-search-history current-query nil)
>> +  'notmuch-search-history current-query nil))
>>  
>>  (defun notmuch-search-get-query ()
>>"Return the current query in this search buffer"
>> -- 
>> 2.1.2
>>
>> ___
>> notmuch mailing list
>> notmuch at notmuchmail.org
>> http://notmuchmail.org/mailman/listinfo/notmuch
-- next part --
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 480 bytes
Desc: not available
URL: 
<http://notmuchmail.org/pipermail/notmuch/attachments/20141201/e5bc8e86/attachment.pgp>


Re: [PATCH v2] emacs: Added is:tag style completion to notmuch-read-query.

2014-12-01 Thread Charles Celerier
I see now. I tried using lexical-let*, but now it appears that pulling
the assignment of minibuffer-completion-table into the lexical-let*
breaks the function, while pulling all the other assigments in works
fine. I'm not sure why that happens. I am not a very skilled emacs-lisp
programmer, so I am afraid something funny is happening here that is
beyond my understanding.

charles

David Bremner da...@tethera.net writes:

 Charles Celerier ccel...@cs.stanford.edu writes:

 Can the variables in the varlist depend on the definition of variables
 that precede them in the list? I believe I tried your suggestion, but
 quickly gave up as Emacs gave me an error claiming that all-tags was
 void.

 That's the point of lexical-let* vs lexical-let

 d


signature.asc
Description: PGP signature
___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch


[PATCH] emacs: Added "is:" style completion to notmuch-read-query.

2014-11-29 Thread Charles Celerier
Just updated the patch to use lexical-let as suggested. I'm not too
familiar with emacs-lisp, so please tell me if you had something else in
mind.

charles

David Bremner  writes:

> David Edmondson  writes:
>
>> On Sat, Nov 29 2014, Charles Celerier wrote:
>
>>
>> Should use a `let' binding rather than `setq'. Otherwise, looks good.
>>
>>>(lexical-let
>>>((completions
>>> (append (list "folder:" "path:" "thread:" "id:" "date:" "f
>
> What about using lexical-let*  to combine the two binding forms?
>
> d
-- next part --
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 480 bytes
Desc: not available
URL: 
<http://notmuchmail.org/pipermail/notmuch/attachments/20141129/b00b763d/attachment.pgp>


[PATCH v2] emacs: Added "is:" style completion to notmuch-read-query.

2014-11-29 Thread Charles Celerier
The notmuch-search-terms man page states that "tag:" is equivalent
to "is:". Completion for "is:" style searches is now supported
in the Emacs interface.

Signed-off-by: Charles Celerier 
---
 emacs/notmuch.el | 11 +++
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/emacs/notmuch.el b/emacs/notmuch.el
index 218486a..d29499c 100644
--- a/emacs/notmuch.el
+++ b/emacs/notmuch.el
@@ -856,12 +856,15 @@ See `notmuch-tag' for information on the format of 
TAG-CHANGES."

 PROMPT is the string to prompt with."
   (lexical-let
+(( all-tags
+(mapcar (lambda (tag) (notmuch-escape-boolean-term tag))
+(process-lines notmuch-command "search" "--output=tags" "*"
+  (let
   ((completions
(append (list "folder:" "path:" "thread:" "id:" "date:" "from:" "to:"
  "subject:" "attachment:")
-   (mapcar (lambda (tag)
- (concat "tag:" (notmuch-escape-boolean-term tag)))
-   (process-lines notmuch-command "search" "--output=tags" 
"*")
+   (mapcar (lambda (tag) (concat "tag:" tag)) all-tags)
+   (mapcar (lambda (tag) (concat "is:" tag)) all-tags
 (let ((keymap (copy-keymap minibuffer-local-map))
  (current-query (case major-mode
   (notmuch-search-mode (notmuch-search-get-query))
@@ -884,7 +887,7 @@ PROMPT is the string to prompt with."
   (define-key keymap (kbd "TAB") 'minibuffer-complete)
   (let ((history-delete-duplicates t))
(read-from-minibuffer prompt nil keymap nil
- 'notmuch-search-history current-query nil)
+ 'notmuch-search-history current-query nil))

 (defun notmuch-search-get-query ()
   "Return the current query in this search buffer"
-- 
2.1.2



[PATCH v2] emacs: Added is:tag style completion to notmuch-read-query.

2014-11-29 Thread Charles Celerier
The notmuch-search-terms man page states that tag:tag is equivalent
to is:tag. Completion for is:tag style searches is now supported
in the Emacs interface.

Signed-off-by: Charles Celerier ccel...@cs.stanford.edu
---
 emacs/notmuch.el | 11 +++
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/emacs/notmuch.el b/emacs/notmuch.el
index 218486a..d29499c 100644
--- a/emacs/notmuch.el
+++ b/emacs/notmuch.el
@@ -856,12 +856,15 @@ See `notmuch-tag' for information on the format of 
TAG-CHANGES.
 
 PROMPT is the string to prompt with.
   (lexical-let
+(( all-tags
+(mapcar (lambda (tag) (notmuch-escape-boolean-term tag))
+(process-lines notmuch-command search --output=tags *
+  (let
   ((completions
(append (list folder: path: thread: id: date: from: to:
  subject: attachment:)
-   (mapcar (lambda (tag)
- (concat tag: (notmuch-escape-boolean-term tag)))
-   (process-lines notmuch-command search --output=tags 
*)
+   (mapcar (lambda (tag) (concat tag: tag)) all-tags)
+   (mapcar (lambda (tag) (concat is: tag)) all-tags
 (let ((keymap (copy-keymap minibuffer-local-map))
  (current-query (case major-mode
   (notmuch-search-mode (notmuch-search-get-query))
@@ -884,7 +887,7 @@ PROMPT is the string to prompt with.
   (define-key keymap (kbd TAB) 'minibuffer-complete)
   (let ((history-delete-duplicates t))
(read-from-minibuffer prompt nil keymap nil
- 'notmuch-search-history current-query nil)
+ 'notmuch-search-history current-query nil))
 
 (defun notmuch-search-get-query ()
   Return the current query in this search buffer
-- 
2.1.2

___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch


Re: [PATCH] emacs: Added is:tag style completion to notmuch-read-query.

2014-11-29 Thread Charles Celerier
Just updated the patch to use lexical-let as suggested. I'm not too
familiar with emacs-lisp, so please tell me if you had something else in
mind.

charles

David Bremner da...@tethera.net writes:

 David Edmondson d...@dme.org writes:

 On Sat, Nov 29 2014, Charles Celerier wrote:


 Should use a `let' binding rather than `setq'. Otherwise, looks good.

(lexical-let
((completions
 (append (list folder: path: thread: id: date: f

 What about using lexical-let*  to combine the two binding forms?

 d


signature.asc
Description: PGP signature
___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch


[PATCH] emacs: Added "is:" style completion to notmuch-read-query.

2014-11-28 Thread Charles Celerier
The notmuch-search-terms man page states that "tag:" is equivalent
to "is:". Completion for "is:" style searches is now supported
in the Emacs interface.

Signed-off-by: Charles Celerier 
---
 emacs/notmuch.el | 8 +---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/emacs/notmuch.el b/emacs/notmuch.el
index 218486a..e4b77c7 100644
--- a/emacs/notmuch.el
+++ b/emacs/notmuch.el
@@ -855,13 +855,15 @@ See `notmuch-tag' for information on the format of 
TAG-CHANGES."
   "Read a notmuch-query from the minibuffer with completion.

 PROMPT is the string to prompt with."
+  (setq all-tags
+(mapcar (lambda (tag) (notmuch-escape-boolean-term tag))
+(process-lines notmuch-command "search" "--output=tags" "*")))
   (lexical-let
   ((completions
(append (list "folder:" "path:" "thread:" "id:" "date:" "from:" "to:"
  "subject:" "attachment:")
-   (mapcar (lambda (tag)
- (concat "tag:" (notmuch-escape-boolean-term tag)))
-   (process-lines notmuch-command "search" "--output=tags" 
"*")
+   (mapcar (lambda (tag) (concat "tag:" tag)) all-tags)
+   (mapcar (lambda (tag) (concat "is:" tag)) all-tags
 (let ((keymap (copy-keymap minibuffer-local-map))
  (current-query (case major-mode
   (notmuch-search-mode (notmuch-search-get-query))
-- 
2.1.2



[PATCH] emacs: Added is:tag style completion to notmuch-read-query.

2014-11-28 Thread Charles Celerier
The notmuch-search-terms man page states that tag:tag is equivalent
to is:tag. Completion for is:tag style searches is now supported
in the Emacs interface.

Signed-off-by: Charles Celerier ccel...@cs.stanford.edu
---
 emacs/notmuch.el | 8 +---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/emacs/notmuch.el b/emacs/notmuch.el
index 218486a..e4b77c7 100644
--- a/emacs/notmuch.el
+++ b/emacs/notmuch.el
@@ -855,13 +855,15 @@ See `notmuch-tag' for information on the format of 
TAG-CHANGES.
   Read a notmuch-query from the minibuffer with completion.
 
 PROMPT is the string to prompt with.
+  (setq all-tags
+(mapcar (lambda (tag) (notmuch-escape-boolean-term tag))
+(process-lines notmuch-command search --output=tags *)))
   (lexical-let
   ((completions
(append (list folder: path: thread: id: date: from: to:
  subject: attachment:)
-   (mapcar (lambda (tag)
- (concat tag: (notmuch-escape-boolean-term tag)))
-   (process-lines notmuch-command search --output=tags 
*)
+   (mapcar (lambda (tag) (concat tag: tag)) all-tags)
+   (mapcar (lambda (tag) (concat is: tag)) all-tags
 (let ((keymap (copy-keymap minibuffer-local-map))
  (current-query (case major-mode
   (notmuch-search-mode (notmuch-search-get-query))
-- 
2.1.2

___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch


[PATCH] lib: Precede all function names in notmuch-private.h with an underscore.

2014-05-13 Thread Charles Celerier
As noted in the In-Reply-To header, this patch replaces
id:1399402716-13714-1-git-send-email-cceleri at cs.stanford.edu.
-- next part --
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 494 bytes
Desc: not available
URL: 



[PATCH v2] lib: Start all function names in notmuch-private.h with

2014-05-13 Thread Charles Celerier
As noted in devel/STYLE, every private library function should start
with _notmuch. This patch corrects function naming that did not adhere
to this style in lib/notmuch-private.h. In particular, the old function
names that now begin with _notmuch are

notmuch_sha1_of_file
notmuch_sha1_of_string
notmuch_message_file_close
notmuch_message_file_get_header
notmuch_message_file_open
notmuch_message_get_author
notmuch_message_set_author

Signed-off-by: Charles Celerier 
---
 lib/database.cc   | 24 
 lib/message-file.c|  8 
 lib/message.cc|  8 
 lib/notmuch-private.h | 14 +++---
 lib/sha1.c|  4 ++--
 lib/thread.cc |  4 ++--
 6 files changed, 31 insertions(+), 31 deletions(-)

diff --git a/lib/database.cc b/lib/database.cc
index 1efb14d..d9a01b7 100644
--- a/lib/database.cc
+++ b/lib/database.cc
@@ -356,7 +356,7 @@ _message_id_compressed (void *ctx, const char *message_id)
 {
 char *sha1, *compressed;

-sha1 = notmuch_sha1_of_string (message_id);
+sha1 = _notmuch_sha1_of_string (message_id);

 compressed = talloc_asprintf (ctx, "notmuch-sha1-%s", sha1);
 free (sha1);
@@ -1356,7 +1356,7 @@ _notmuch_database_get_directory_db_path (const char *path)
 int term_len = strlen (_find_prefix ("directory")) + strlen (path);

 if (term_len > NOTMUCH_TERM_MAX)
-   return notmuch_sha1_of_string (path);
+   return _notmuch_sha1_of_string (path);
 else
return path;
 }
@@ -1758,12 +1758,12 @@ _notmuch_database_link_message_to_parents 
(notmuch_database_t *notmuch,
 _my_talloc_free_for_g_hash, NULL);
 this_message_id = notmuch_message_get_message_id (message);

-refs = notmuch_message_file_get_header (message_file, "references");
+refs = _notmuch_message_file_get_header (message_file, "references");
 last_ref_message_id = parse_references (message,
this_message_id,
parents, refs);

-in_reply_to = notmuch_message_file_get_header (message_file, 
"in-reply-to");
+in_reply_to = _notmuch_message_file_get_header (message_file, 
"in-reply-to");
 in_reply_to_message_id = parse_references (message,
   this_message_id,
   parents, in_reply_to);
@@ -1961,7 +1961,7 @@ notmuch_database_add_message (notmuch_database_t *notmuch,
 if (ret)
return ret;

-message_file = notmuch_message_file_open (filename);
+message_file = _notmuch_message_file_open (filename);
 if (message_file == NULL)
return NOTMUCH_STATUS_FILE_ERROR;

@@ -1982,9 +1982,9 @@ notmuch_database_add_message (notmuch_database_t *notmuch,
 * let's make sure that what we're looking at looks like an
 * actual email message.
 */
-   from = notmuch_message_file_get_header (message_file, "from");
-   subject = notmuch_message_file_get_header (message_file, "subject");
-   to = notmuch_message_file_get_header (message_file, "to");
+   from = _notmuch_message_file_get_header (message_file, "from");
+   subject = _notmuch_message_file_get_header (message_file, "subject");
+   to = _notmuch_message_file_get_header (message_file, "to");

if ((from == NULL || *from == '\0') &&
(subject == NULL || *subject == '\0') &&
@@ -1997,7 +1997,7 @@ notmuch_database_add_message (notmuch_database_t *notmuch,
/* Now that we're sure it's mail, the first order of business
 * is to find a message ID (or else create one ourselves). */

-   header = notmuch_message_file_get_header (message_file, "message-id");
+   header = _notmuch_message_file_get_header (message_file, "message-id");
if (header && *header != '\0') {
message_id = _parse_message_id (message_file, header, NULL);

@@ -2018,7 +2018,7 @@ notmuch_database_add_message (notmuch_database_t *notmuch,
if (message_id == NULL ) {
/* No message-id at all, let's generate one by taking a
 * hash over the file's contents. */
-   char *sha1 = notmuch_sha1_of_file (filename);
+   char *sha1 = _notmuch_sha1_of_file (filename);

/* If that failed too, something is really wrong. Give up. */
if (sha1 == NULL) {
@@ -2058,7 +2058,7 @@ notmuch_database_add_message (notmuch_database_t *notmuch,
if (ret)
goto DONE;

-   date = notmuch_message_file_get_header (message_file, "date");
+   date = _notmuch_message_file_get_header (message_file, "date");
_notmuch_message_set_header_values (message, date, from, subje

[PATCH] lib: Precede all function names in notmuch-private.h with an underscore.

2014-05-13 Thread Charles Celerier
David Bremner  writes:

> David Bremner  writes:
>
>> Originally I thought this was uneccesarily intrusive, but on a second
>> look I see that there is only one symbol changed that doesn't start with
>> _notmuch, so I guess for consistency it's fine.

Actually, they all start with _notmuch. The symbol
_thread_add_matched_author is not changed.

>> I'm thinking about a 0.18.1 point release for build and portability
>> fixes; I do think this is a bit too much change for that (especially
>> since it doesn't actually fix the symbol hiding test (or more precisely,
>> your fix for OS/X breaks the linux test).

I agree.

> Also, I'd like a less confusing commit message.  Do you understand the
> situation enough to write one now? In particular it's just a convention
> that private symbols should not start with "notmuch", and the actual
> hiding happens elsewhere.
>
> d

Yes, I now understand the hiding happens elsewhere. There is a note in
devel/STYLE in the "libnotmuch conventions" section that discusses the
use of underscores to denote private library functions; I will cite
that as the reason for the patch instead.

chuck
-- next part --
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 494 bytes
Desc: not available
URL: 



Re: [PATCH] lib: Precede all function names in notmuch-private.h with an underscore.

2014-05-13 Thread Charles Celerier
David Bremner da...@tethera.net writes:

 David Bremner da...@tethera.net writes:

 Originally I thought this was uneccesarily intrusive, but on a second
 look I see that there is only one symbol changed that doesn't start with
 _notmuch, so I guess for consistency it's fine.

Actually, they all start with _notmuch. The symbol
_thread_add_matched_author is not changed.

 I'm thinking about a 0.18.1 point release for build and portability
 fixes; I do think this is a bit too much change for that (especially
 since it doesn't actually fix the symbol hiding test (or more precisely,
 your fix for OS/X breaks the linux test).

I agree.

 Also, I'd like a less confusing commit message.  Do you understand the
 situation enough to write one now? In particular it's just a convention
 that private symbols should not start with notmuch, and the actual
 hiding happens elsewhere.

 d

Yes, I now understand the hiding happens elsewhere. There is a note in
devel/STYLE in the libnotmuch conventions section that discusses the
use of underscores to denote private library functions; I will cite
that as the reason for the patch instead.

chuck


pgpfZkPzAC03k.pgp
Description: PGP signature
___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch


[PATCH v2] lib: Start all function names in notmuch-private.h with

2014-05-13 Thread Charles Celerier
As noted in devel/STYLE, every private library function should start
with _notmuch. This patch corrects function naming that did not adhere
to this style in lib/notmuch-private.h. In particular, the old function
names that now begin with _notmuch are

notmuch_sha1_of_file
notmuch_sha1_of_string
notmuch_message_file_close
notmuch_message_file_get_header
notmuch_message_file_open
notmuch_message_get_author
notmuch_message_set_author

Signed-off-by: Charles Celerier ccel...@cs.stanford.edu
---
 lib/database.cc   | 24 
 lib/message-file.c|  8 
 lib/message.cc|  8 
 lib/notmuch-private.h | 14 +++---
 lib/sha1.c|  4 ++--
 lib/thread.cc |  4 ++--
 6 files changed, 31 insertions(+), 31 deletions(-)

diff --git a/lib/database.cc b/lib/database.cc
index 1efb14d..d9a01b7 100644
--- a/lib/database.cc
+++ b/lib/database.cc
@@ -356,7 +356,7 @@ _message_id_compressed (void *ctx, const char *message_id)
 {
 char *sha1, *compressed;
 
-sha1 = notmuch_sha1_of_string (message_id);
+sha1 = _notmuch_sha1_of_string (message_id);
 
 compressed = talloc_asprintf (ctx, notmuch-sha1-%s, sha1);
 free (sha1);
@@ -1356,7 +1356,7 @@ _notmuch_database_get_directory_db_path (const char *path)
 int term_len = strlen (_find_prefix (directory)) + strlen (path);
 
 if (term_len  NOTMUCH_TERM_MAX)
-   return notmuch_sha1_of_string (path);
+   return _notmuch_sha1_of_string (path);
 else
return path;
 }
@@ -1758,12 +1758,12 @@ _notmuch_database_link_message_to_parents 
(notmuch_database_t *notmuch,
 _my_talloc_free_for_g_hash, NULL);
 this_message_id = notmuch_message_get_message_id (message);
 
-refs = notmuch_message_file_get_header (message_file, references);
+refs = _notmuch_message_file_get_header (message_file, references);
 last_ref_message_id = parse_references (message,
this_message_id,
parents, refs);
 
-in_reply_to = notmuch_message_file_get_header (message_file, 
in-reply-to);
+in_reply_to = _notmuch_message_file_get_header (message_file, 
in-reply-to);
 in_reply_to_message_id = parse_references (message,
   this_message_id,
   parents, in_reply_to);
@@ -1961,7 +1961,7 @@ notmuch_database_add_message (notmuch_database_t *notmuch,
 if (ret)
return ret;
 
-message_file = notmuch_message_file_open (filename);
+message_file = _notmuch_message_file_open (filename);
 if (message_file == NULL)
return NOTMUCH_STATUS_FILE_ERROR;
 
@@ -1982,9 +1982,9 @@ notmuch_database_add_message (notmuch_database_t *notmuch,
 * let's make sure that what we're looking at looks like an
 * actual email message.
 */
-   from = notmuch_message_file_get_header (message_file, from);
-   subject = notmuch_message_file_get_header (message_file, subject);
-   to = notmuch_message_file_get_header (message_file, to);
+   from = _notmuch_message_file_get_header (message_file, from);
+   subject = _notmuch_message_file_get_header (message_file, subject);
+   to = _notmuch_message_file_get_header (message_file, to);
 
if ((from == NULL || *from == '\0') 
(subject == NULL || *subject == '\0') 
@@ -1997,7 +1997,7 @@ notmuch_database_add_message (notmuch_database_t *notmuch,
/* Now that we're sure it's mail, the first order of business
 * is to find a message ID (or else create one ourselves). */
 
-   header = notmuch_message_file_get_header (message_file, message-id);
+   header = _notmuch_message_file_get_header (message_file, message-id);
if (header  *header != '\0') {
message_id = _parse_message_id (message_file, header, NULL);
 
@@ -2018,7 +2018,7 @@ notmuch_database_add_message (notmuch_database_t *notmuch,
if (message_id == NULL ) {
/* No message-id at all, let's generate one by taking a
 * hash over the file's contents. */
-   char *sha1 = notmuch_sha1_of_file (filename);
+   char *sha1 = _notmuch_sha1_of_file (filename);
 
/* If that failed too, something is really wrong. Give up. */
if (sha1 == NULL) {
@@ -2058,7 +2058,7 @@ notmuch_database_add_message (notmuch_database_t *notmuch,
if (ret)
goto DONE;
 
-   date = notmuch_message_file_get_header (message_file, date);
+   date = _notmuch_message_file_get_header (message_file, date);
_notmuch_message_set_header_values (message, date, from, subject);
 
ret = _notmuch_message_index_file (message, message_file);
@@ -2087,7 +2087,7 @@ notmuch_database_add_message (notmuch_database_t *notmuch,
 }
 
 if (message_file

Re: [PATCH] lib: Precede all function names in notmuch-private.h with an underscore.

2014-05-13 Thread Charles Celerier
As noted in the In-Reply-To header, this patch replaces
id:1399402716-13714-1-git-send-email-ccel...@cs.stanford.edu.


pgpOnVsuIV3Xa.pgp
Description: PGP signature
___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch


[PATCH v2 2/5] test: Made T010-help-test and T020-compact tests more portable.

2014-05-10 Thread Charles Celerier
The tests T010-help-test and T020-compact use the files have-man and
have-compact, respectively, as indicators of how notmuch is configured.
These were symbolic links to true and false for use in bash tests.
Unfortunately, the paths to true and false may not be the same on all
platforms (e.g. on Mac OS X they are in /usr/bin), so hard-coding
symbolic links to /bin/true and /bin/false is not portable. This patch
writes a 1 to have-man and have-compact to indicate true, and a 0 to
indicate false, instead. The tests now read the contents of the file to
determine the truth value instead of following the symbolic link.

Signed-off-by: Charles Celerier 
---
 test/Makefile.local| 8 
 test/T010-help-test.sh | 2 +-
 test/T020-compact.sh   | 2 +-
 3 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/test/Makefile.local b/test/Makefile.local
index d622eaf..8fd333c 100644
--- a/test/Makefile.local
+++ b/test/Makefile.local
@@ -37,16 +37,16 @@ $(dir)/parse-time: $(dir)/parse-time.o 
parse-time-string/parse-time-string.o

 $(dir)/have-compact: Makefile.config
 ifeq ($(HAVE_XAPIAN_COMPACT),1)
-   ln -sf /bin/true $@
+   echo 1 > $@
 else
-   ln -sf /bin/false $@
+   echo 0 > $@
 endif

 $(dir)/have-man: Makefile.config
 ifeq ($(HAVE_SPHINX)$(HAVE_RST2MAN),00)
-   ln -sf /bin/false $@
+   echo 0 > $@
 else
-   ln -sf /bin/true $@
+   echo 1 > $@
 endif

 .PHONY: test check
diff --git a/test/T010-help-test.sh b/test/T010-help-test.sh
index 77410bc..02162ca 100755
--- a/test/T010-help-test.sh
+++ b/test/T010-help-test.sh
@@ -7,7 +7,7 @@ test_expect_success 'notmuch --help' 'notmuch --help'
 test_expect_success 'notmuch help' 'notmuch help'
 test_expect_success 'notmuch --version' 'notmuch --version'

-if ${TEST_DIRECTORY}/have-man; then
+if grep -q 1 ${TEST_DIRECTORY}/have-man ; then
 test_expect_success 'notmuch --help tag' 'notmuch --help tag'
 test_expect_success 'notmuch help tag' 'notmuch help tag'
 else
diff --git a/test/T020-compact.sh b/test/T020-compact.sh
index 77bb963..0139584 100755
--- a/test/T020-compact.sh
+++ b/test/T020-compact.sh
@@ -10,7 +10,7 @@ notmuch tag +tag1 \*
 notmuch tag +tag2 subject:Two
 notmuch tag -tag1 +tag3 subject:Three

-if ! ${TEST_DIRECTORY}/have-compact; then
+if grep -q 0 ${TEST_DIRECTORY}/have-compact; then
 test_begin_subtest "Compact unsupported: error message"
 output=$(notmuch compact --quiet 2>&1)
 test_expect_equal "$output" "notmuch was compiled against a xapian version 
lacking compaction support.
-- 
1.8.5.2 (Apple Git-48)



[PATCH v2 5/5] T360-symbol-hiding: Use nm instead of objdump.

2014-05-10 Thread Charles Celerier
David Bremner  writes:

> Charles Celerier  writes:
>
>> At this point, I'm not sure how to create a better version of this
>> patch. Are we renaming functions in notmuch-private.h? Should we stick
>> with objdump or switch to using nm?
>
> I'd go with renaming any functions that start with notmuch to start with
> _notmuch.

Ok. Should I pull the patch from
id:1399402716-13714-1-git-send-email-cceleri at cs.stanford.edu into this
patch series?

> Since it seems neither nm nor objdump provides uniform output between
> OS/X and Linux, there isn't an obvious advantage to switching to nm. Any
> idea if objdump can be made to work (in this test) on OS/X ?

I can install GNU objdump on OS/X, but the problem seems to be that
objdump changes its output depending on the object file format (see -t
option documentation in objdump(1)). What does the output of nm look
like for you? Is really that different? Here is what my objdump output
looks like:

$ objdump -t lib/*.o | sed -n '/\[\.text\] __\?notmuch/p' | tail
09a0 g   0f SECT   01  [.text] 
_notmuch_thread_get_authors
0990 g   0f SECT   01  [.text] 
_notmuch_thread_get_matched_messages
0960 g   0f SECT   01  [.text] 
_notmuch_thread_get_messages
09d0 g   0f SECT   01  [.text] 
_notmuch_thread_get_newest_date
09c0 g   0f SECT   01  [.text] 
_notmuch_thread_get_oldest_date
09b0 g   0f SECT   01  [.text] 
_notmuch_thread_get_subject
09e0 g   0f SECT   01  [.text] _notmuch_thread_get_tags
0970 g   0f SECT   01  [.text] 
_notmuch_thread_get_thread_id
0950 g   0f SECT   01  [.text] 
_notmuch_thread_get_toplevel_messages
0980 g   0f SECT   01  [.text] 
_notmuch_thread_get_total_messages

I suppose we could just account for the difference in output of objdump
on OS/X, but I was hoping that the output of nm would be more consistent
since its a simpler program.

chuck
-- next part --
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 494 bytes
Desc: not available
URL: 
<http://notmuchmail.org/pipermail/notmuch/attachments/20140510/4f22a64f/attachment-0001.pgp>


Re: [PATCH v2 5/5] T360-symbol-hiding: Use nm instead of objdump.

2014-05-10 Thread Charles Celerier
David Bremner da...@tethera.net writes:

 Charles Celerier ccel...@cs.stanford.edu writes:

 At this point, I'm not sure how to create a better version of this
 patch. Are we renaming functions in notmuch-private.h? Should we stick
 with objdump or switch to using nm?

 I'd go with renaming any functions that start with notmuch to start with
 _notmuch.

Ok. Should I pull the patch from
id:1399402716-13714-1-git-send-email-ccel...@cs.stanford.edu into this
patch series?

 Since it seems neither nm nor objdump provides uniform output between
 OS/X and Linux, there isn't an obvious advantage to switching to nm. Any
 idea if objdump can be made to work (in this test) on OS/X ?

I can install GNU objdump on OS/X, but the problem seems to be that
objdump changes its output depending on the object file format (see -t
option documentation in objdump(1)). What does the output of nm look
like for you? Is really that different? Here is what my objdump output
looks like:

$ objdump -t lib/*.o | sed -n '/\[\.text\] __\?notmuch/p' | tail
09a0 g   0f SECT   01  [.text] 
_notmuch_thread_get_authors
0990 g   0f SECT   01  [.text] 
_notmuch_thread_get_matched_messages
0960 g   0f SECT   01  [.text] 
_notmuch_thread_get_messages
09d0 g   0f SECT   01  [.text] 
_notmuch_thread_get_newest_date
09c0 g   0f SECT   01  [.text] 
_notmuch_thread_get_oldest_date
09b0 g   0f SECT   01  [.text] 
_notmuch_thread_get_subject
09e0 g   0f SECT   01  [.text] _notmuch_thread_get_tags
0970 g   0f SECT   01  [.text] 
_notmuch_thread_get_thread_id
0950 g   0f SECT   01  [.text] 
_notmuch_thread_get_toplevel_messages
0980 g   0f SECT   01  [.text] 
_notmuch_thread_get_total_messages

I suppose we could just account for the difference in output of objdump
on OS/X, but I was hoping that the output of nm would be more consistent
since its a simpler program.

chuck


pgpr9n5DpJbhD.pgp
Description: PGP signature
___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch


[PATCH v2 2/5] test: Made T010-help-test and T020-compact tests more portable.

2014-05-10 Thread Charles Celerier
The tests T010-help-test and T020-compact use the files have-man and
have-compact, respectively, as indicators of how notmuch is configured.
These were symbolic links to true and false for use in bash tests.
Unfortunately, the paths to true and false may not be the same on all
platforms (e.g. on Mac OS X they are in /usr/bin), so hard-coding
symbolic links to /bin/true and /bin/false is not portable. This patch
writes a 1 to have-man and have-compact to indicate true, and a 0 to
indicate false, instead. The tests now read the contents of the file to
determine the truth value instead of following the symbolic link.

Signed-off-by: Charles Celerier ccel...@cs.stanford.edu
---
 test/Makefile.local| 8 
 test/T010-help-test.sh | 2 +-
 test/T020-compact.sh   | 2 +-
 3 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/test/Makefile.local b/test/Makefile.local
index d622eaf..8fd333c 100644
--- a/test/Makefile.local
+++ b/test/Makefile.local
@@ -37,16 +37,16 @@ $(dir)/parse-time: $(dir)/parse-time.o 
parse-time-string/parse-time-string.o
 
 $(dir)/have-compact: Makefile.config
 ifeq ($(HAVE_XAPIAN_COMPACT),1)
-   ln -sf /bin/true $@
+   echo 1  $@
 else
-   ln -sf /bin/false $@
+   echo 0  $@
 endif
 
 $(dir)/have-man: Makefile.config
 ifeq ($(HAVE_SPHINX)$(HAVE_RST2MAN),00)
-   ln -sf /bin/false $@
+   echo 0  $@
 else
-   ln -sf /bin/true $@
+   echo 1  $@
 endif
 
 .PHONY: test check
diff --git a/test/T010-help-test.sh b/test/T010-help-test.sh
index 77410bc..02162ca 100755
--- a/test/T010-help-test.sh
+++ b/test/T010-help-test.sh
@@ -7,7 +7,7 @@ test_expect_success 'notmuch --help' 'notmuch --help'
 test_expect_success 'notmuch help' 'notmuch help'
 test_expect_success 'notmuch --version' 'notmuch --version'
 
-if ${TEST_DIRECTORY}/have-man; then
+if grep -q 1 ${TEST_DIRECTORY}/have-man ; then
 test_expect_success 'notmuch --help tag' 'notmuch --help tag'
 test_expect_success 'notmuch help tag' 'notmuch help tag'
 else
diff --git a/test/T020-compact.sh b/test/T020-compact.sh
index 77bb963..0139584 100755
--- a/test/T020-compact.sh
+++ b/test/T020-compact.sh
@@ -10,7 +10,7 @@ notmuch tag +tag1 \*
 notmuch tag +tag2 subject:Two
 notmuch tag -tag1 +tag3 subject:Three
 
-if ! ${TEST_DIRECTORY}/have-compact; then
+if grep -q 0 ${TEST_DIRECTORY}/have-compact; then
 test_begin_subtest Compact unsupported: error message
 output=$(notmuch compact --quiet 21)
 test_expect_equal $output notmuch was compiled against a xapian version 
lacking compaction support.
-- 
1.8.5.2 (Apple Git-48)

___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch


[PATCH v2 5/5] T360-symbol-hiding: Use nm instead of objdump.

2014-05-08 Thread Charles Celerier
David Bremner  writes:

> Charles Celerier  writes:
>>  test_begin_subtest 'comparing existing to exported symbols'
>> -objdump -t $TEST_DIRECTORY/../lib/*.o | awk '$4 == ".text" && $6 ~ 
>> "^notmuch" {print $6}' | sort | uniq > ACTUAL
>> +nm -g $TEST_DIRECTORY/../lib/*.o | sed -n 
>> 's/.*\s\+T\s\+_\(notmuch_.*\)/\1/p' | sort | uniq > ACTUAL
>>  sed -n 's/[[:blank:]]*\(notmuch_[^;]*\);/\1/p' 
>> $TEST_DIRECTORY/../notmuch.sym | sort | uniq > EXPORTED
>
> Hmm. It seems like the _ there is wrong. It grabs all of the symbols
> starting with _notmuch, which are symbols we _don't_ want exported.
> It makes me wonder what ends up in "notmuch.sym" on MacOS, if that test
> passes for you.

Ok. Apologies in advance for the verbose content of this email. Here is my 
notmuch.sym:

$ cat notmuch.sym
{
global:
__ZTIN6Xapian10LogicErrorE;
__ZTIN6Xapian12RuntimeErrorE;
__ZTIN6Xapian16DocNotFoundErrorE;
__ZTIN6Xapian20InvalidArgumentErrorE;
__ZTIN6Xapian5ErrorE;
__ZTSN6Xapian10LogicErrorE;
__ZTSN6Xapian12RuntimeErrorE;
__ZTSN6Xapian16DocNotFoundErrorE;
__ZTSN6Xapian20InvalidArgumentErrorE;
__ZTSN6Xapian5ErrorE;
 notmuch_status_to_string;
 notmuch_database_create;
 notmuch_database_open;
 notmuch_database_close;
 notmuch_database_compact;
 notmuch_database_destroy;
 notmuch_database_get_path;
 notmuch_database_get_version;
 notmuch_database_needs_upgrade;
 notmuch_database_upgrade;
 notmuch_database_begin_atomic;
 notmuch_database_end_atomic;
 notmuch_database_get_directory;
 notmuch_database_add_message;
 notmuch_database_remove_message;
 notmuch_database_find_message;
 notmuch_database_find_message_by_filename;
 notmuch_database_get_all_tags;
 notmuch_query_create;
 notmuch_query_get_query_string;
 notmuch_query_set_omit_excluded;
 notmuch_query_set_sort;
 notmuch_query_get_sort;
 notmuch_query_add_tag_exclude;
 notmuch_query_search_threads;
 notmuch_query_search_messages;
 notmuch_query_destroy;
 notmuch_threads_valid;
 notmuch_threads_get;
 notmuch_threads_move_to_next;
 notmuch_threads_destroy;
 notmuch_query_count_messages;
 notmuch_query_count_threads;
 notmuch_thread_get_thread_id;
 notmuch_thread_get_total_messages;
 notmuch_thread_get_toplevel_messages;
 notmuch_thread_get_messages;
 notmuch_thread_get_matched_messages;
 notmuch_thread_get_authors;
 notmuch_thread_get_subject;
 notmuch_thread_get_oldest_date;
 notmuch_thread_get_newest_date;
 notmuch_thread_get_tags;
 notmuch_thread_destroy;
 notmuch_messages_valid;
 notmuch_messages_get;
 notmuch_messages_move_to_next;
 notmuch_messages_destroy;
 notmuch_messages_collect_tags;
 notmuch_message_get_message_id;
 notmuch_message_get_thread_id;
 notmuch_message_get_replies;
 notmuch_message_get_filename;
 notmuch_message_get_filenames;
 notmuch_message_get_flag;
 notmuch_message_set_flag;
 notmuch_message_get_date;
 notmuch_message_get_header;
 notmuch_message_get_tags;
 notmuch_message_add_tag;
 notmuch_message_remove_tag;
 notmuch_message_remove_all_tags;
 notmuch_message_maildir_flags_to_tags;
 notmuch_message_tags_to_maildir_flags;
 notmuch_message_freeze;
 notmuch_message_thaw;
 notmuch_message_destroy;
 notmuch_tags_valid;
 notmuch_tags_get;
 notmuch_tags_move_to_next;
 notmuch_tags_destroy;
 notmuch_directory_set_mtime;
 notmuch_directory_get_mtime;
 notmuch_directory_get_child_files;
 notmuch_directory_get_child_directories;
 notmuch_directory_destroy;
 notmuch_filenames_valid;
 notmuch_filenames_get;
 notmuch_filenames_move_to_next;
 notmuch_filenames_destroy;
local: *;
};

The output of the test in question (T360-symbol-hiding) after
applying all of the patches in this series is

T360-symbol-hiding: Testing exception symbol hiding
 PASS   running test
 PASS   checking output
 FAIL   comparing existing to exported symbols
--- T360-symbol-hiding.3.EXPORTED   2014-05-08
 14:48:52.0 +
+++ T360-symbol-hiding.3.ACTUAL 2014-05-08 14:48:52.0
 +
@@ -26,7 +26,11 @@
 notmuch_filenames_valid
 notmuch_message_add_tag
 notmuch_message_destroy
+notmuch_message_file_close
+notmuch_message_file_get_header
+notmuch_message_file_open
 notmuch_message_freeze
+notmuch_message_get_author
 notmuch_message_get_date
 notmuch_message_get_filename
 notmuch_message_get_filenames
@@ -39,6 +43,7 @@
 notmuch_message_maildir_flags_to_tags
 notmuch_message_remove_all_tag

[PATCH 2/5] configure, test: Added variables for paths to true and false.

2014-05-08 Thread Charles Celerier
David Bremner  writes:

> Charles Celerier  writes:
>
>> The path to true may not be the same on all platforms (e.g. on Mac OS X
>> it is /usr/bin/true), so the hard-coded path of /bin/true is not
>> portable. This is resolved by adding a step to the configure script to
>> locate the path of true and to use the TRUE variable wherever /bin/true
>> was needed. The same was done for false.
>
> Does this really need a configure script variable? It seems like
> overkill.

I will be the first too admit that I do not know much about configure
scripts, but adding a TRUE variable seemed straightforward. The problem
is that you want to make softlinks for test/have-man and
test/have-compact for how they are used in tests T010-help-test and
T020-compact; making softlinks requires full paths. You could use
`$(which true)` in test/Makefile.local, but I felt the code repetition
there was unecessary since you could just create a TRUE variable in the
configure script. An alternative is to change the tests so that the
location of true (and false) is no longer an issue.

chuck
-- next part --
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 494 bytes
Desc: not available
URL: 
<http://notmuchmail.org/pipermail/notmuch/attachments/20140508/81bd4240/attachment.pgp>


Re: [PATCH 2/5] configure, test: Added variables for paths to true and false.

2014-05-08 Thread Charles Celerier
David Bremner da...@tethera.net writes:

 Charles Celerier ccel...@cs.stanford.edu writes:

 The path to true may not be the same on all platforms (e.g. on Mac OS X
 it is /usr/bin/true), so the hard-coded path of /bin/true is not
 portable. This is resolved by adding a step to the configure script to
 locate the path of true and to use the TRUE variable wherever /bin/true
 was needed. The same was done for false.

 Does this really need a configure script variable? It seems like
 overkill.

I will be the first too admit that I do not know much about configure
scripts, but adding a TRUE variable seemed straightforward. The problem
is that you want to make softlinks for test/have-man and
test/have-compact for how they are used in tests T010-help-test and
T020-compact; making softlinks requires full paths. You could use
`$(which true)` in test/Makefile.local, but I felt the code repetition
there was unecessary since you could just create a TRUE variable in the
configure script. An alternative is to change the tests so that the
location of true (and false) is no longer an issue.

chuck


pgpxHIbfkihaB.pgp
Description: PGP signature
___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch


Re: [PATCH v2 5/5] T360-symbol-hiding: Use nm instead of objdump.

2014-05-08 Thread Charles Celerier
David Bremner da...@tethera.net writes:

 Charles Celerier ccel...@cs.stanford.edu writes:
  test_begin_subtest 'comparing existing to exported symbols'
 -objdump -t $TEST_DIRECTORY/../lib/*.o | awk '$4 == .text  $6 ~ 
 ^notmuch {print $6}' | sort | uniq  ACTUAL
 +nm -g $TEST_DIRECTORY/../lib/*.o | sed -n 
 's/.*\s\+T\s\+_\(notmuch_.*\)/\1/p' | sort | uniq  ACTUAL
  sed -n 's/[[:blank:]]*\(notmuch_[^;]*\);/\1/p' 
 $TEST_DIRECTORY/../notmuch.sym | sort | uniq  EXPORTED

 Hmm. It seems like the _ there is wrong. It grabs all of the symbols
 starting with _notmuch, which are symbols we _don't_ want exported.
 It makes me wonder what ends up in notmuch.sym on MacOS, if that test
 passes for you.

Ok. Apologies in advance for the verbose content of this email. Here is my 
notmuch.sym:

$ cat notmuch.sym
{
global:
__ZTIN6Xapian10LogicErrorE;
__ZTIN6Xapian12RuntimeErrorE;
__ZTIN6Xapian16DocNotFoundErrorE;
__ZTIN6Xapian20InvalidArgumentErrorE;
__ZTIN6Xapian5ErrorE;
__ZTSN6Xapian10LogicErrorE;
__ZTSN6Xapian12RuntimeErrorE;
__ZTSN6Xapian16DocNotFoundErrorE;
__ZTSN6Xapian20InvalidArgumentErrorE;
__ZTSN6Xapian5ErrorE;
 notmuch_status_to_string;
 notmuch_database_create;
 notmuch_database_open;
 notmuch_database_close;
 notmuch_database_compact;
 notmuch_database_destroy;
 notmuch_database_get_path;
 notmuch_database_get_version;
 notmuch_database_needs_upgrade;
 notmuch_database_upgrade;
 notmuch_database_begin_atomic;
 notmuch_database_end_atomic;
 notmuch_database_get_directory;
 notmuch_database_add_message;
 notmuch_database_remove_message;
 notmuch_database_find_message;
 notmuch_database_find_message_by_filename;
 notmuch_database_get_all_tags;
 notmuch_query_create;
 notmuch_query_get_query_string;
 notmuch_query_set_omit_excluded;
 notmuch_query_set_sort;
 notmuch_query_get_sort;
 notmuch_query_add_tag_exclude;
 notmuch_query_search_threads;
 notmuch_query_search_messages;
 notmuch_query_destroy;
 notmuch_threads_valid;
 notmuch_threads_get;
 notmuch_threads_move_to_next;
 notmuch_threads_destroy;
 notmuch_query_count_messages;
 notmuch_query_count_threads;
 notmuch_thread_get_thread_id;
 notmuch_thread_get_total_messages;
 notmuch_thread_get_toplevel_messages;
 notmuch_thread_get_messages;
 notmuch_thread_get_matched_messages;
 notmuch_thread_get_authors;
 notmuch_thread_get_subject;
 notmuch_thread_get_oldest_date;
 notmuch_thread_get_newest_date;
 notmuch_thread_get_tags;
 notmuch_thread_destroy;
 notmuch_messages_valid;
 notmuch_messages_get;
 notmuch_messages_move_to_next;
 notmuch_messages_destroy;
 notmuch_messages_collect_tags;
 notmuch_message_get_message_id;
 notmuch_message_get_thread_id;
 notmuch_message_get_replies;
 notmuch_message_get_filename;
 notmuch_message_get_filenames;
 notmuch_message_get_flag;
 notmuch_message_set_flag;
 notmuch_message_get_date;
 notmuch_message_get_header;
 notmuch_message_get_tags;
 notmuch_message_add_tag;
 notmuch_message_remove_tag;
 notmuch_message_remove_all_tags;
 notmuch_message_maildir_flags_to_tags;
 notmuch_message_tags_to_maildir_flags;
 notmuch_message_freeze;
 notmuch_message_thaw;
 notmuch_message_destroy;
 notmuch_tags_valid;
 notmuch_tags_get;
 notmuch_tags_move_to_next;
 notmuch_tags_destroy;
 notmuch_directory_set_mtime;
 notmuch_directory_get_mtime;
 notmuch_directory_get_child_files;
 notmuch_directory_get_child_directories;
 notmuch_directory_destroy;
 notmuch_filenames_valid;
 notmuch_filenames_get;
 notmuch_filenames_move_to_next;
 notmuch_filenames_destroy;
local: *;
};

The output of the test in question (T360-symbol-hiding) after
applying all of the patches in this series is

T360-symbol-hiding: Testing exception symbol hiding
 PASS   running test
 PASS   checking output
 FAIL   comparing existing to exported symbols
--- T360-symbol-hiding.3.EXPORTED   2014-05-08
 14:48:52.0 +
+++ T360-symbol-hiding.3.ACTUAL 2014-05-08 14:48:52.0
 +
@@ -26,7 +26,11 @@
 notmuch_filenames_valid
 notmuch_message_add_tag
 notmuch_message_destroy
+notmuch_message_file_close
+notmuch_message_file_get_header
+notmuch_message_file_open
 notmuch_message_freeze
+notmuch_message_get_author
 notmuch_message_get_date
 notmuch_message_get_filename
 notmuch_message_get_filenames
@@ -39,6 +43,7 @@
 notmuch_message_maildir_flags_to_tags
 notmuch_message_remove_all_tags
 notmuch_message_remove_tag
+notmuch_message_set_author
 notmuch_message_set_flag

Re: [PATCH v2 5/5] T360-symbol-hiding: Use nm instead of objdump.

2014-05-08 Thread Charles Celerier
David Bremner da...@tethera.net writes:

 Charles Celerier ccel...@cs.stanford.edu writes:

 Here is some of output of the matches made on the output of nm:

 $ nm -g test/../lib/*.o | sed -n '/.*\s\+T\s\+_\(notmuch_.*\)/p'
 28c0 T _notmuch_database_add_message
 2280 T _notmuch_database_begin_atomic
 1af0 T _notmuch_database_close
 1de0 T _notmuch_database_compact

 With GNU nm, there is no leading _ in front of notmuch here, which is
 what causes your version of the test to fail for me.

What version of GNU nm are you using?

$ nm --version
GNU nm (GNU Binutils) 2.24
Copyright 2013 Free Software Foundation, Inc.
This program is free software; you may redistribute it under the terms of
the GNU General Public License version 3 or (at your option) any later 
version.
This program has absolutely no warranty.

I'm not convinced the insertion of an underscore is nm's doing.

At this point, I'm not sure how to create a better version of this
patch. Are we renaming functions in notmuch-private.h? Should we stick
with objdump or switch to using nm?

chuck


pgp5rNT7GYSGn.pgp
Description: PGP signature
___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch


[PATCH v2 5/5] T360-symbol-hiding: Use nm instead of objdump.

2014-05-07 Thread Charles Celerier
The output of `objdump -t` depends on the format of the object files
which are different across platforms (e.g. Mac OS X). Since we really
just want to filter the symbols in the object file, nm is a more
appropriate tool since it only lists symbols from object files (nm(1))
and has a consistent output format.

Signed-off-by: Charles Celerier 
---
 test/T360-symbol-hiding.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/test/T360-symbol-hiding.sh b/test/T360-symbol-hiding.sh
index 9239fc1..21cabca 100755
--- a/test/T360-symbol-hiding.sh
+++ b/test/T360-symbol-hiding.sh
@@ -33,7 +33,7 @@ test_begin_subtest 'checking output'
 test_expect_equal "$result" "$output"

 test_begin_subtest 'comparing existing to exported symbols'
-objdump -t $TEST_DIRECTORY/../lib/*.o | awk '$4 == ".text" && $6 ~ "^notmuch" 
{print $6}' | sort | uniq > ACTUAL
+nm -g $TEST_DIRECTORY/../lib/*.o | sed -n 's/.*\s\+T\s\+_\(notmuch_.*\)/\1/p' 
| sort | uniq > ACTUAL
 sed -n 's/[[:blank:]]*\(notmuch_[^;]*\);/\1/p' $TEST_DIRECTORY/../notmuch.sym 
| sort | uniq > EXPORTED
 test_expect_equal_file EXPORTED ACTUAL

-- 
1.8.5.2 (Apple Git-48)



[PATCH v2 4/5] T360-symbol-hiding: Added code to support testing on Mac OS X.

2014-05-07 Thread Charles Celerier
The Mac OS X platform uses *.dylib object files instead of *.so object
files for linking. Adding the path to notmuch.dylib to the end of
DYLD_FALLBACK_LIBRARY_PATH has a similar effect to adding the path to
notmuch.so to LD_LIBRARY_PATH on most Linux-based platforms (see
dyld(1)).

Signed-off-by: Charles Celerier 
---
 test/T360-symbol-hiding.sh | 9 -
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/test/T360-symbol-hiding.sh b/test/T360-symbol-hiding.sh
index 636ec91..9239fc1 100755
--- a/test/T360-symbol-hiding.sh
+++ b/test/T360-symbol-hiding.sh
@@ -12,7 +12,14 @@ test_description='exception symbol hiding'
 . ./test-lib.sh

 run_test(){
-
result=$(LD_LIBRARY_PATH="$TEST_DIRECTORY/../lib${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}"
 $TEST_DIRECTORY/symbol-test 2>&1)
+case $(uname -s) in
+Darwin)
+
result=$(DYLD_FALLBACK_LIBRARY_PATH="$TEST_DIRECTORY/../lib${DYLD_FALLBACK_LIBRARY_PATH:+:$DYLD_FALLBACK_LIBRARY_PATH}"
 $TEST_DIRECTORY/symbol-test 2>&1)
+;;
+*)
+
result=$(LD_LIBRARY_PATH="$TEST_DIRECTORY/../lib${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}"
 $TEST_DIRECTORY/symbol-test 2>&1)
+;;
+esac
 }

 output="A Xapian exception occurred opening database: Couldn't stat 
'fakedb/.notmuch/xapian'
-- 
1.8.5.2 (Apple Git-48)



[PATCH] lib: Precede all function names in notmuch-private.h with an underscore.

2014-05-06 Thread Charles Celerier
An underscore should precede every function name in
lib/notmuch-private.h. This was not true and was noted by the failure of
test T360-symbol-hiding on Mac OS/X. This patch inserts an underscore
before each function name in lib/notmuch-private.h where the underscore
was missing and renames functions appropriately where they are used.

Signed-off-by: Charles Celerier 
---
 lib/database.cc   | 24 
 lib/message-file.c|  8 
 lib/message.cc|  8 
 lib/notmuch-private.h | 14 +++---
 lib/sha1.c|  4 ++--
 lib/thread.cc |  4 ++--
 6 files changed, 31 insertions(+), 31 deletions(-)

diff --git a/lib/database.cc b/lib/database.cc
index 1efb14d..d9a01b7 100644
--- a/lib/database.cc
+++ b/lib/database.cc
@@ -356,7 +356,7 @@ _message_id_compressed (void *ctx, const char *message_id)
 {
 char *sha1, *compressed;

-sha1 = notmuch_sha1_of_string (message_id);
+sha1 = _notmuch_sha1_of_string (message_id);

 compressed = talloc_asprintf (ctx, "notmuch-sha1-%s", sha1);
 free (sha1);
@@ -1356,7 +1356,7 @@ _notmuch_database_get_directory_db_path (const char *path)
 int term_len = strlen (_find_prefix ("directory")) + strlen (path);

 if (term_len > NOTMUCH_TERM_MAX)
-   return notmuch_sha1_of_string (path);
+   return _notmuch_sha1_of_string (path);
 else
return path;
 }
@@ -1758,12 +1758,12 @@ _notmuch_database_link_message_to_parents 
(notmuch_database_t *notmuch,
 _my_talloc_free_for_g_hash, NULL);
 this_message_id = notmuch_message_get_message_id (message);

-refs = notmuch_message_file_get_header (message_file, "references");
+refs = _notmuch_message_file_get_header (message_file, "references");
 last_ref_message_id = parse_references (message,
this_message_id,
parents, refs);

-in_reply_to = notmuch_message_file_get_header (message_file, 
"in-reply-to");
+in_reply_to = _notmuch_message_file_get_header (message_file, 
"in-reply-to");
 in_reply_to_message_id = parse_references (message,
   this_message_id,
   parents, in_reply_to);
@@ -1961,7 +1961,7 @@ notmuch_database_add_message (notmuch_database_t *notmuch,
 if (ret)
return ret;

-message_file = notmuch_message_file_open (filename);
+message_file = _notmuch_message_file_open (filename);
 if (message_file == NULL)
return NOTMUCH_STATUS_FILE_ERROR;

@@ -1982,9 +1982,9 @@ notmuch_database_add_message (notmuch_database_t *notmuch,
 * let's make sure that what we're looking at looks like an
 * actual email message.
 */
-   from = notmuch_message_file_get_header (message_file, "from");
-   subject = notmuch_message_file_get_header (message_file, "subject");
-   to = notmuch_message_file_get_header (message_file, "to");
+   from = _notmuch_message_file_get_header (message_file, "from");
+   subject = _notmuch_message_file_get_header (message_file, "subject");
+   to = _notmuch_message_file_get_header (message_file, "to");

if ((from == NULL || *from == '\0') &&
(subject == NULL || *subject == '\0') &&
@@ -1997,7 +1997,7 @@ notmuch_database_add_message (notmuch_database_t *notmuch,
/* Now that we're sure it's mail, the first order of business
 * is to find a message ID (or else create one ourselves). */

-   header = notmuch_message_file_get_header (message_file, "message-id");
+   header = _notmuch_message_file_get_header (message_file, "message-id");
if (header && *header != '\0') {
message_id = _parse_message_id (message_file, header, NULL);

@@ -2018,7 +2018,7 @@ notmuch_database_add_message (notmuch_database_t *notmuch,
if (message_id == NULL ) {
/* No message-id at all, let's generate one by taking a
 * hash over the file's contents. */
-   char *sha1 = notmuch_sha1_of_file (filename);
+   char *sha1 = _notmuch_sha1_of_file (filename);

/* If that failed too, something is really wrong. Give up. */
if (sha1 == NULL) {
@@ -2058,7 +2058,7 @@ notmuch_database_add_message (notmuch_database_t *notmuch,
if (ret)
goto DONE;

-   date = notmuch_message_file_get_header (message_file, "date");
+   date = _notmuch_message_file_get_header (message_file, "date");
_notmuch_message_set_header_values (message, date, from, subject);

ret = _notmuch_message_index_file (message, message_file);
@@ -2087,7 +2087,7 @@ notmuch_database_add_message (notmuch_database

[PATCH 5/5] T360-symbol-hiding: Use nm instead of objdump.

2014-05-06 Thread Charles Celerier
The output of `objdump -t` depends on the format of the object files
which are different across platforms (e.g. Mac OS X). Since we really
just want to filter the symbols in the object file, nm is a more
appropriate tool since it only lists symbols from object files (nm(1))
and has a consistent output format.

Signed-off-by: Charles Celerier 
---
 test/T360-symbol-hiding.sh | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/test/T360-symbol-hiding.sh b/test/T360-symbol-hiding.sh
index 97c734a..c5bbf27 100755
--- a/test/T360-symbol-hiding.sh
+++ b/test/T360-symbol-hiding.sh
@@ -33,7 +33,8 @@ test_begin_subtest 'checking output'
 test_expect_equal "$result" "$output"

 test_begin_subtest 'comparing existing to exported symbols'
-objdump -t $TEST_DIRECTORY/../lib/*.o | awk '$4 == ".text" && $6 ~ "^notmuch" 
{print $6}' | sort | uniq > ACTUAL
+
+nm -g $TEST_DIRECTORY/../lib/*.o | sed -n 's/.*\s\+T\s\+_\(notmuch_.*\)/\1/p' 
| sort | uniq > ACTUAL
 sed -n 's/[[:blank:]]*\(notmuch_[^;]*\);/\1/p' $TEST_DIRECTORY/../notmuch.sym 
| sort | uniq > EXPORTED
 test_expect_equal_file EXPORTED ACTUAL

-- 
1.8.5.2 (Apple Git-48)



[PATCH 2/5] configure, test: Added variables for paths to true and false.

2014-05-06 Thread Charles Celerier
The path to true may not be the same on all platforms (e.g. on Mac OS X
it is /usr/bin/true), so the hard-coded path of /bin/true is not
portable. This is resolved by adding a step to the configure script to
locate the path of true and to use the TRUE variable wherever /bin/true
was needed. The same was done for false.

Signed-off-by: Charles Celerier 
---
 configure   | 6 ++
 test/Makefile.local | 8 
 2 files changed, 10 insertions(+), 4 deletions(-)

diff --git a/configure b/configure
index 9bde2eb..0bce0a3 100755
--- a/configure
+++ b/configure
@@ -50,6 +50,8 @@ CPPFLAGS=${CPPFLAGS:-}
 CXXFLAGS=${CXXFLAGS:-\$(CFLAGS)}
 LDFLAGS=${LDFLAGS:-}
 XAPIAN_CONFIG=${XAPIAN_CONFIG:-xapian-config}
+TRUE=$(which true)
+FALSE=$(which false)

 # We don't allow the EMACS or GZIP Makefile variables inherit values
 # from the environment as we do with CC and CXX above. The reason is
@@ -761,6 +763,10 @@ CXX = ${CXX}
 # Command to execute emacs from Makefiles
 EMACS = emacs --quick

+# Define the paths to true and false.
+TRUE = ${TRUE}
+FALSE = ${FALSE}
+
 # Default FLAGS for C compiler (can be overridden by user such as "make 
CFLAGS=-g")
 CFLAGS = ${CFLAGS}

diff --git a/test/Makefile.local b/test/Makefile.local
index d622eaf..e422c06 100644
--- a/test/Makefile.local
+++ b/test/Makefile.local
@@ -37,16 +37,16 @@ $(dir)/parse-time: $(dir)/parse-time.o 
parse-time-string/parse-time-string.o

 $(dir)/have-compact: Makefile.config
 ifeq ($(HAVE_XAPIAN_COMPACT),1)
-   ln -sf /bin/true $@
+   ln -sf $(TRUE) $@
 else
-   ln -sf /bin/false $@
+   ln -sf $(FALSE) $@
 endif

 $(dir)/have-man: Makefile.config
 ifeq ($(HAVE_SPHINX)$(HAVE_RST2MAN),00)
-   ln -sf /bin/false $@
+   ln -sf $(FALSE) $@
 else
-   ln -sf /bin/true $@
+   ln -sf $(TRUE) $@
 endif

 .PHONY: test check
-- 
1.8.5.2 (Apple Git-48)



[PATCH 1/5] test/Makefile.local: Added configured TALLOC_LDFLAGS.

2014-05-06 Thread Charles Celerier
The linking to talloc is hard-coded in the testing Makefile. This patch
causes the linking to talloc to be done according to how TALLOC_LDFLAGS
was configured.

Signed-off-by: Charles Celerier 
---
 test/Makefile.local | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/test/Makefile.local b/test/Makefile.local
index 987441f..d622eaf 100644
--- a/test/Makefile.local
+++ b/test/Makefile.local
@@ -16,7 +16,7 @@ $(dir)/arg-test: $(dir)/arg-test.o command-line-arguments.o 
util/libutil.a
$(call quiet,CC) $^ -o $@

 $(dir)/hex-xcode: $(dir)/hex-xcode.o command-line-arguments.o util/libutil.a
-   $(call quiet,CC) $^ -o $@ -ltalloc
+   $(call quiet,CC) $^ $(TALLOC_LDFLAGS) -o $@

 random_corpus_deps =  $(dir)/random-corpus.o  $(dir)/database-test.o \
notmuch-config.o command-line-arguments.o \
-- 
1.8.5.2 (Apple Git-48)



[PATCH 0/5] Improving portability to Mac OS X

2014-05-06 Thread Charles Celerier
The patches in this series include a number of minor changes intended to better
support the portability of notmuch to Mac OS X. The changes are relatively
non-intrusive. You may observe that these patches apply entirely to the notmuch
tests; it turns out, with the exception of the tests, notmuch ports very well
to Mac OS X. =]

Note that I have used GNU programs where possible (e.g. nm, sed, date, etc.) so
as to not introduce changes to the testing framework that are easily resolved
by installing standard GNU programs. For example, on Mac OS X the date program
is a BSD variant that does not include the '-d' option that allows specifying a
time to display. This appears to be necessary when testing on Mac OS X; I will
try to note this somewhere on the notmuch wiki soon.

Best,
Chuck

P.S. This is my first time submitting patches to a mailing list, so forgive me 
if I
have made any foolish mistakes in my attempt to submit changes.


Charles Celerier (5):
  test/Makefile.local: Added configured TALLOC_LDFLAGS.
  configure, test: Added variables for paths to true and false.
  atomicity.gdb: Allow breakpoint symbols to be resolved later.
  T360-symbol-hiding: Added code to support testing on Mac OS X.
  T360-symbol-hiding: Use nm instead of objdump.

 configure  |  6 ++
 test/Makefile.local| 10 +-
 test/T360-symbol-hiding.sh | 12 ++--
 test/atomicity.gdb |  3 +++
 4 files changed, 24 insertions(+), 7 deletions(-)

-- 
1.8.5.2 (Apple Git-48)



[PATCH 1/5] test/Makefile.local: Added configured TALLOC_LDFLAGS.

2014-05-06 Thread Charles Celerier
The linking to talloc is hard-coded in the testing Makefile. This patch
causes the linking to talloc to be done according to how TALLOC_LDFLAGS
was configured.

Signed-off-by: Charles Celerier ccel...@cs.stanford.edu
---
 test/Makefile.local | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/test/Makefile.local b/test/Makefile.local
index 987441f..d622eaf 100644
--- a/test/Makefile.local
+++ b/test/Makefile.local
@@ -16,7 +16,7 @@ $(dir)/arg-test: $(dir)/arg-test.o command-line-arguments.o 
util/libutil.a
$(call quiet,CC) $^ -o $@
 
 $(dir)/hex-xcode: $(dir)/hex-xcode.o command-line-arguments.o util/libutil.a
-   $(call quiet,CC) $^ -o $@ -ltalloc
+   $(call quiet,CC) $^ $(TALLOC_LDFLAGS) -o $@
 
 random_corpus_deps =  $(dir)/random-corpus.o  $(dir)/database-test.o \
notmuch-config.o command-line-arguments.o \
-- 
1.8.5.2 (Apple Git-48)

___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch


[PATCH 5/5] T360-symbol-hiding: Use nm instead of objdump.

2014-05-06 Thread Charles Celerier
The output of `objdump -t` depends on the format of the object files
which are different across platforms (e.g. Mac OS X). Since we really
just want to filter the symbols in the object file, nm is a more
appropriate tool since it only lists symbols from object files (nm(1))
and has a consistent output format.

Signed-off-by: Charles Celerier ccel...@cs.stanford.edu
---
 test/T360-symbol-hiding.sh | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/test/T360-symbol-hiding.sh b/test/T360-symbol-hiding.sh
index 97c734a..c5bbf27 100755
--- a/test/T360-symbol-hiding.sh
+++ b/test/T360-symbol-hiding.sh
@@ -33,7 +33,8 @@ test_begin_subtest 'checking output'
 test_expect_equal $result $output
 
 test_begin_subtest 'comparing existing to exported symbols'
-objdump -t $TEST_DIRECTORY/../lib/*.o | awk '$4 == .text  $6 ~ ^notmuch 
{print $6}' | sort | uniq  ACTUAL
+
+nm -g $TEST_DIRECTORY/../lib/*.o | sed -n 's/.*\s\+T\s\+_\(notmuch_.*\)/\1/p' 
| sort | uniq  ACTUAL
 sed -n 's/[[:blank:]]*\(notmuch_[^;]*\);/\1/p' $TEST_DIRECTORY/../notmuch.sym 
| sort | uniq  EXPORTED
 test_expect_equal_file EXPORTED ACTUAL
 
-- 
1.8.5.2 (Apple Git-48)

___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch


Re: [PATCH 4/5] T360-symbol-hiding: Added code to support testing on Mac OS X.

2014-05-06 Thread Charles Celerier
Tomi Ollila tomi.oll...@iki.fi writes:

 On Tue, May 06 2014, Charles Celerier ccel...@cs.stanford.edu wrote:

 The Mac OS X platform uses *.dylib object files instead of *.so object
 files for linking. Adding the path to notmuch.dylib to the end of
 DYLD_FALLBACK_LIBRARY_PATH has a similar effect to adding the path to
 notmuch.so to LD_LIBRARY_PATH on most Linux-based platforms (see
 dyld(1)).

 This series LGTM. I don't understand this difference suffixing
 DYLD_FALLBACK_LIBRARY_PATH with $TEST_DIRECTORY/../lib on Mac OS X
 compared to prefixing LD_LIBRARY_PATH with the same on other
 systems, so I take your word that it works :D

I just went back and read dyld(1) again. Prefixing would be fine, and I
agree it would look cleaner.


 Signed-off-by: Charles Celerier ccel...@cs.stanford.edu
 ---
  test/T360-symbol-hiding.sh | 9 -
  1 file changed, 8 insertions(+), 1 deletion(-)

 diff --git a/test/T360-symbol-hiding.sh b/test/T360-symbol-hiding.sh
 index 636ec91..97c734a 100755
 --- a/test/T360-symbol-hiding.sh
 +++ b/test/T360-symbol-hiding.sh
 @@ -12,7 +12,14 @@ test_description='exception symbol hiding'
  . ./test-lib.sh
  
  run_test(){
 -
 result=$(LD_LIBRARY_PATH=$TEST_DIRECTORY/../lib${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}
  $TEST_DIRECTORY/symbol-test 21)
 +case $(uname -s) in
 +Darwin)
 +
 result=$(DYLD_FALLBACK_LIBRARY_PATH=${DYLD_FALLBACK_LIBRARY_PATH:+$DYLD_FALLBACK_LIBRARY_PATH:}$TEST_DIRECTORY/../lib
  $TEST_DIRECTORY/symbol-test 21)
 +;;
 +*)
 +
 result=$(LD_LIBRARY_PATH=$TEST_DIRECTORY/../lib${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}
  $TEST_DIRECTORY/symbol-test 21)
 +;;
 +esac
  }
  
  output=A Xapian exception occurred opening database: Couldn't stat 
 'fakedb/.notmuch/xapian'
 -- 
 1.8.5.2 (Apple Git-48)

 ___
 notmuch mailing list
 notmuch@notmuchmail.org
 http://notmuchmail.org/mailman/listinfo/notmuch


pgpaHdsikiQIi.pgp
Description: PGP signature
___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch


[PATCH] lib: Precede all function names in notmuch-private.h with an underscore.

2014-05-06 Thread Charles Celerier
An underscore should precede every function name in
lib/notmuch-private.h. This was not true and was noted by the failure of
test T360-symbol-hiding on Mac OS/X. This patch inserts an underscore
before each function name in lib/notmuch-private.h where the underscore
was missing and renames functions appropriately where they are used.

Signed-off-by: Charles Celerier ccel...@cs.stanford.edu
---
 lib/database.cc   | 24 
 lib/message-file.c|  8 
 lib/message.cc|  8 
 lib/notmuch-private.h | 14 +++---
 lib/sha1.c|  4 ++--
 lib/thread.cc |  4 ++--
 6 files changed, 31 insertions(+), 31 deletions(-)

diff --git a/lib/database.cc b/lib/database.cc
index 1efb14d..d9a01b7 100644
--- a/lib/database.cc
+++ b/lib/database.cc
@@ -356,7 +356,7 @@ _message_id_compressed (void *ctx, const char *message_id)
 {
 char *sha1, *compressed;
 
-sha1 = notmuch_sha1_of_string (message_id);
+sha1 = _notmuch_sha1_of_string (message_id);
 
 compressed = talloc_asprintf (ctx, notmuch-sha1-%s, sha1);
 free (sha1);
@@ -1356,7 +1356,7 @@ _notmuch_database_get_directory_db_path (const char *path)
 int term_len = strlen (_find_prefix (directory)) + strlen (path);
 
 if (term_len  NOTMUCH_TERM_MAX)
-   return notmuch_sha1_of_string (path);
+   return _notmuch_sha1_of_string (path);
 else
return path;
 }
@@ -1758,12 +1758,12 @@ _notmuch_database_link_message_to_parents 
(notmuch_database_t *notmuch,
 _my_talloc_free_for_g_hash, NULL);
 this_message_id = notmuch_message_get_message_id (message);
 
-refs = notmuch_message_file_get_header (message_file, references);
+refs = _notmuch_message_file_get_header (message_file, references);
 last_ref_message_id = parse_references (message,
this_message_id,
parents, refs);
 
-in_reply_to = notmuch_message_file_get_header (message_file, 
in-reply-to);
+in_reply_to = _notmuch_message_file_get_header (message_file, 
in-reply-to);
 in_reply_to_message_id = parse_references (message,
   this_message_id,
   parents, in_reply_to);
@@ -1961,7 +1961,7 @@ notmuch_database_add_message (notmuch_database_t *notmuch,
 if (ret)
return ret;
 
-message_file = notmuch_message_file_open (filename);
+message_file = _notmuch_message_file_open (filename);
 if (message_file == NULL)
return NOTMUCH_STATUS_FILE_ERROR;
 
@@ -1982,9 +1982,9 @@ notmuch_database_add_message (notmuch_database_t *notmuch,
 * let's make sure that what we're looking at looks like an
 * actual email message.
 */
-   from = notmuch_message_file_get_header (message_file, from);
-   subject = notmuch_message_file_get_header (message_file, subject);
-   to = notmuch_message_file_get_header (message_file, to);
+   from = _notmuch_message_file_get_header (message_file, from);
+   subject = _notmuch_message_file_get_header (message_file, subject);
+   to = _notmuch_message_file_get_header (message_file, to);
 
if ((from == NULL || *from == '\0') 
(subject == NULL || *subject == '\0') 
@@ -1997,7 +1997,7 @@ notmuch_database_add_message (notmuch_database_t *notmuch,
/* Now that we're sure it's mail, the first order of business
 * is to find a message ID (or else create one ourselves). */
 
-   header = notmuch_message_file_get_header (message_file, message-id);
+   header = _notmuch_message_file_get_header (message_file, message-id);
if (header  *header != '\0') {
message_id = _parse_message_id (message_file, header, NULL);
 
@@ -2018,7 +2018,7 @@ notmuch_database_add_message (notmuch_database_t *notmuch,
if (message_id == NULL ) {
/* No message-id at all, let's generate one by taking a
 * hash over the file's contents. */
-   char *sha1 = notmuch_sha1_of_file (filename);
+   char *sha1 = _notmuch_sha1_of_file (filename);
 
/* If that failed too, something is really wrong. Give up. */
if (sha1 == NULL) {
@@ -2058,7 +2058,7 @@ notmuch_database_add_message (notmuch_database_t *notmuch,
if (ret)
goto DONE;
 
-   date = notmuch_message_file_get_header (message_file, date);
+   date = _notmuch_message_file_get_header (message_file, date);
_notmuch_message_set_header_values (message, date, from, subject);
 
ret = _notmuch_message_index_file (message, message_file);
@@ -2087,7 +2087,7 @@ notmuch_database_add_message (notmuch_database_t *notmuch,
 }
 
 if (message_file)
-   notmuch_message_file_close (message_file);
+   _notmuch_message_file_close (message_file);
 
 ret2 = notmuch_database_end_atomic

[PATCH v2 5/5] T360-symbol-hiding: Use nm instead of objdump.

2014-05-06 Thread Charles Celerier
The output of `objdump -t` depends on the format of the object files
which are different across platforms (e.g. Mac OS X). Since we really
just want to filter the symbols in the object file, nm is a more
appropriate tool since it only lists symbols from object files (nm(1))
and has a consistent output format.

Signed-off-by: Charles Celerier ccel...@cs.stanford.edu
---
 test/T360-symbol-hiding.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/test/T360-symbol-hiding.sh b/test/T360-symbol-hiding.sh
index 9239fc1..21cabca 100755
--- a/test/T360-symbol-hiding.sh
+++ b/test/T360-symbol-hiding.sh
@@ -33,7 +33,7 @@ test_begin_subtest 'checking output'
 test_expect_equal $result $output
 
 test_begin_subtest 'comparing existing to exported symbols'
-objdump -t $TEST_DIRECTORY/../lib/*.o | awk '$4 == .text  $6 ~ ^notmuch 
{print $6}' | sort | uniq  ACTUAL
+nm -g $TEST_DIRECTORY/../lib/*.o | sed -n 's/.*\s\+T\s\+_\(notmuch_.*\)/\1/p' 
| sort | uniq  ACTUAL
 sed -n 's/[[:blank:]]*\(notmuch_[^;]*\);/\1/p' $TEST_DIRECTORY/../notmuch.sym 
| sort | uniq  EXPORTED
 test_expect_equal_file EXPORTED ACTUAL
 
-- 
1.8.5.2 (Apple Git-48)

___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch


[PATCH v2 4/5] T360-symbol-hiding: Added code to support testing on Mac OS X.

2014-05-06 Thread Charles Celerier
The Mac OS X platform uses *.dylib object files instead of *.so object
files for linking. Adding the path to notmuch.dylib to the end of
DYLD_FALLBACK_LIBRARY_PATH has a similar effect to adding the path to
notmuch.so to LD_LIBRARY_PATH on most Linux-based platforms (see
dyld(1)).

Signed-off-by: Charles Celerier ccel...@cs.stanford.edu
---
 test/T360-symbol-hiding.sh | 9 -
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/test/T360-symbol-hiding.sh b/test/T360-symbol-hiding.sh
index 636ec91..9239fc1 100755
--- a/test/T360-symbol-hiding.sh
+++ b/test/T360-symbol-hiding.sh
@@ -12,7 +12,14 @@ test_description='exception symbol hiding'
 . ./test-lib.sh
 
 run_test(){
-
result=$(LD_LIBRARY_PATH=$TEST_DIRECTORY/../lib${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}
 $TEST_DIRECTORY/symbol-test 21)
+case $(uname -s) in
+Darwin)
+
result=$(DYLD_FALLBACK_LIBRARY_PATH=$TEST_DIRECTORY/../lib${DYLD_FALLBACK_LIBRARY_PATH:+:$DYLD_FALLBACK_LIBRARY_PATH}
 $TEST_DIRECTORY/symbol-test 21)
+;;
+*)
+
result=$(LD_LIBRARY_PATH=$TEST_DIRECTORY/../lib${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}
 $TEST_DIRECTORY/symbol-test 21)
+;;
+esac
 }
 
 output=A Xapian exception occurred opening database: Couldn't stat 
'fakedb/.notmuch/xapian'
-- 
1.8.5.2 (Apple Git-48)

___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch