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

Charles Celerier cceleri at cs.stanford.edu
Thu May 8 08:03:05 PDT 2014


David Bremner <david at tethera.net> writes:

> Charles Celerier <cceleri at 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.000000000 +0000
	+++ T360-symbol-hiding.3.ACTUAL 2014-05-08 14:48:52.000000000
     +0000
	@@ -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
	 notmuch_message_tags_to_maildir_flags
	 notmuch_message_thaw
	@@ -58,6 +63,8 @@
	 notmuch_query_search_threads
	 notmuch_query_set_omit_excluded
	 notmuch_query_set_sort
	+notmuch_sha1_of_file
	+notmuch_sha1_of_string
	 notmuch_status_to_string
	 notmuch_tags_destroy
	 notmuch_tags_get

This output was a clear motivation for the patch in
id:1399402716-13714-1-git-send-email-cceleri at cs.stanford.edu.

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'
    00000000000028c0 T _notmuch_database_add_message
    0000000000002280 T _notmuch_database_begin_atomic
    0000000000001af0 T _notmuch_database_close
    0000000000001de0 T _notmuch_database_compact
    0000000000000300 T _notmuch_database_create
    0000000000001db0 T _notmuch_database_destroy
    0000000000002300 T _notmuch_database_end_atomic
    ...

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/6a7b36c4/attachment.pgp>


More information about the notmuch mailing list