unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
* [PATCH v2 0/3] ruby: add latest config API
@ 2021-06-29 19:08 Felipe Contreras
  2021-06-29 19:08 ` [PATCH v2 1/3] ruby: add new Database.open_with_config Felipe Contreras
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Felipe Contreras @ 2021-06-29 19:08 UTC (permalink / raw)
  To: notmuch; +Cc: David Bremner, Felipe Contreras

Currently the simplest way to open the notmuch database properly a
client must do:

  $config = IO.popen(%w[notmuch config list]) do |io|
    io.each(chomp: true).map { |e| e.split('=') }.to_h
  end
  $db_name = config['database.path']
  $db = Notmuch::Database.new($db_name)

While this works and it's not too overly complicated, the notmuch API
already has much better constucts.

This patch series allows the user to simply do:

  $db = Notmuch::Database.open_with_config
  $config = $db.config.to_h

And much more.

Since v1 this is rebased on top of master to resolve conflicts, and a
minor style update to one test.

Felipe Contreras (3):
  ruby: add new Database.open_with_config
  ruby: add db.config
  ruby: make db.config return an enumerator

 bindings/ruby/database.c | 95 ++++++++++++++++++++++++++++++++++++++++
 bindings/ruby/defs.h     | 10 +++++
 bindings/ruby/init.c     |  2 +
 test/T395-ruby.sh        | 14 ++++++
 4 files changed, 121 insertions(+)

Range-diff against v1:
1:  0d63249e = 1:  beba4602 ruby: add new Database.open_with_config
2:  41bae8f2 ! 2:  92a36061 ruby: add db.config
    @@ Commit message
         Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
     
      ## bindings/ruby/database.c ##
    -@@ bindings/ruby/database.c: notmuch_rb_database_query_create (VALUE self, VALUE qstrv)
    +@@ bindings/ruby/database.c: notmuch_rb_database_query_create (int argc, VALUE *argv, VALUE self)
      
          return Data_Wrap_Notmuch_Object (notmuch_rb_cQuery, &notmuch_rb_query_type, query);
      }
    @@ bindings/ruby/defs.h: extern ID ID_db_mode;
      extern const rb_data_type_t notmuch_rb_database_type;
     @@ bindings/ruby/defs.h: notmuch_rb_database_get_all_tags (VALUE self);
      VALUE
    - notmuch_rb_database_query_create (VALUE self, VALUE qstrv);
    + notmuch_rb_database_query_create (int argc, VALUE *argv, VALUE self);
      
     +VALUE
     +notmuch_rb_database_config (int argc, VALUE *argv, VALUE self);
    @@ bindings/ruby/init.c
     @@ bindings/ruby/init.c: Init_notmuch (void)
      		      notmuch_rb_database_find_message_by_filename, 1); /* in database.c */
          rb_define_method (notmuch_rb_cDatabase, "all_tags", notmuch_rb_database_get_all_tags, 0); /* in database.c */
    -     rb_define_method (notmuch_rb_cDatabase, "query", notmuch_rb_database_query_create, 1); /* in database.c */
    +     rb_define_method (notmuch_rb_cDatabase, "query", notmuch_rb_database_query_create, -1); /* in database.c */
     +    rb_define_method (notmuch_rb_cDatabase, "config", notmuch_rb_database_config, -1); /* in database.c */
      
          /*
    @@ test/T395-ruby.sh: test_ruby <<EOF
     +test_begin_subtest "config"
     +notmuch config list | grep -v '^built_with\.' > EXPECTED
     +test_ruby <<"EOF"
    -+config_db = Notmuch::Database.open_with_config
    -+config_db.config { |e| puts '%s=%s' % e }
    ++Notmuch::Database.open_with_config do |db|
    ++  db.config { |e| puts '%s=%s' % e }
    ++end
     +EOF
     +
      test_done
3:  e6880180 = 3:  4efe195f ruby: make db.config return an enumerator
-- 
2.32.0

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH v2 1/3] ruby: add new Database.open_with_config
  2021-06-29 19:08 [PATCH v2 0/3] ruby: add latest config API Felipe Contreras
@ 2021-06-29 19:08 ` Felipe Contreras
  2021-08-21 14:20   ` David Bremner
  2021-06-29 19:08 ` [PATCH v2 2/3] ruby: add db.config Felipe Contreras
  2021-06-29 19:08 ` [PATCH v2 3/3] ruby: make db.config return an enumerator Felipe Contreras
  2 siblings, 1 reply; 5+ messages in thread
From: Felipe Contreras @ 2021-06-29 19:08 UTC (permalink / raw)
  To: notmuch; +Cc: David Bremner, Felipe Contreras

In order to make use of notmuch_database_open_with_config.

Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
---
 bindings/ruby/database.c | 62 ++++++++++++++++++++++++++++++++++++++++
 bindings/ruby/defs.h     |  6 ++++
 bindings/ruby/init.c     |  1 +
 test/T395-ruby.sh        |  6 ++++
 4 files changed, 75 insertions(+)

diff --git a/bindings/ruby/database.c b/bindings/ruby/database.c
index d6c804ac..89d9619e 100644
--- a/bindings/ruby/database.c
+++ b/bindings/ruby/database.c
@@ -105,6 +105,68 @@ notmuch_rb_database_open (int argc, VALUE *argv, VALUE klass)
     return rb_ensure (rb_yield, obj, notmuch_rb_database_close, obj);
 }
 
+/*
+ * call-seq: Notmuch::Database.open_with_config([database_path:, mode:, config_path:, profile:]) [{|db| ... }]
+ *
+ * Opens a database with a configuration file.
+ *
+ */
+VALUE
+notmuch_rb_database_open_with_config (int argc, VALUE *argv, VALUE klass)
+{
+    VALUE obj;
+    notmuch_database_t *db;
+    notmuch_status_t ret;
+    VALUE opts;
+    const char *database_path = NULL;
+    notmuch_database_mode_t mode = NOTMUCH_DATABASE_MODE_READ_ONLY;
+    const char *config_path = NULL;
+    const char *profile = NULL;
+
+    rb_scan_args (argc, argv, ":", &opts);
+
+    if (!NIL_P (opts)) {
+	VALUE rdatabase_path, rmode, rconfig_path, rprofile;
+	VALUE kwargs[4];
+	static ID keyword_ids[4];
+
+	if (!keyword_ids[0]) {
+	    keyword_ids[0] = rb_intern_const ("database_path");
+	    keyword_ids[1] = rb_intern_const ("mode");
+	    keyword_ids[2] = rb_intern_const ("config_path");
+	    keyword_ids[3] = rb_intern_const ("profile");
+	}
+
+	rb_get_kwargs (opts, keyword_ids, 0, 4, kwargs);
+
+	rdatabase_path = kwargs[0];
+	rmode = kwargs[1];
+	rconfig_path = kwargs[2];
+	rprofile = kwargs[3];
+
+	if (rdatabase_path != Qundef)
+	    database_path = nm_str (rdatabase_path);
+	if (rmode != Qundef)
+	    mode = FIX2INT (rmode);
+	if (rconfig_path != Qundef)
+	    config_path = nm_str (rconfig_path);
+	if (rprofile != Qundef)
+	    profile = nm_str (rprofile);
+    }
+
+    ret = notmuch_database_open_with_config (database_path, mode,
+					     config_path, profile, &db,
+					     NULL);
+    notmuch_rb_status_raise (ret);
+    obj = notmuch_rb_database_alloc (klass);
+    DATA_PTR (obj) = db;
+
+    if (!rb_block_given_p ())
+	return obj;
+
+    return rb_ensure (rb_yield, obj, notmuch_rb_database_close, obj);
+}
+
 /*
  * call-seq: DB.close => nil
  *
diff --git a/bindings/ruby/defs.h b/bindings/ruby/defs.h
index 995bcafd..cba9fd69 100644
--- a/bindings/ruby/defs.h
+++ b/bindings/ruby/defs.h
@@ -55,6 +55,9 @@ extern ID ID_db_mode;
 # define RSTRING_PTR(v) (RSTRING((v))->ptr)
 #endif /* !defined (RSTRING_PTR) */
 
+/* Simple string helpers */
+#define nm_str(str) (str != Qnil ? RSTRING_PTR (str) : NULL)
+
 extern const rb_data_type_t notmuch_rb_object_type;
 extern const rb_data_type_t notmuch_rb_database_type;
 extern const rb_data_type_t notmuch_rb_directory_type;
@@ -134,6 +137,9 @@ notmuch_rb_database_initialize (int argc, VALUE *argv, VALUE klass);
 VALUE
 notmuch_rb_database_open (int argc, VALUE *argv, VALUE klass);
 
+VALUE
+notmuch_rb_database_open_with_config (int argc, VALUE *argv, VALUE klass);
+
 VALUE
 notmuch_rb_database_close (VALUE self);
 
diff --git a/bindings/ruby/init.c b/bindings/ruby/init.c
index d421c601..7b4de86a 100644
--- a/bindings/ruby/init.c
+++ b/bindings/ruby/init.c
@@ -259,6 +259,7 @@ Init_notmuch (void)
     notmuch_rb_cDatabase = rb_define_class_under (mod, "Database", rb_cObject);
     rb_define_alloc_func (notmuch_rb_cDatabase, notmuch_rb_database_alloc);
     rb_define_singleton_method (notmuch_rb_cDatabase, "open", notmuch_rb_database_open, -1); /* in database.c */
+    rb_define_singleton_method (notmuch_rb_cDatabase, "open_with_config", notmuch_rb_database_open_with_config, -1); /* in database.c */
     rb_define_method (notmuch_rb_cDatabase, "initialize", notmuch_rb_database_initialize, -1); /* in database.c */
     rb_define_method (notmuch_rb_cDatabase, "close", notmuch_rb_database_close, 0); /* in database.c */
     rb_define_method (notmuch_rb_cDatabase, "path", notmuch_rb_database_path, 0); /* in database.c */
diff --git a/test/T395-ruby.sh b/test/T395-ruby.sh
index e828efed..9a1df913 100755
--- a/test/T395-ruby.sh
+++ b/test/T395-ruby.sh
@@ -100,4 +100,10 @@ q.search_threads.each do |t|
 end
 EOF
 
+test_begin_subtest "open with config"
+echo "$MAIL_DIR" > EXPECTED
+test_ruby <<EOF
+puts Notmuch::Database.open_with_config.path
+EOF
+
 test_done
-- 
2.32.0

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH v2 2/3] ruby: add db.config
  2021-06-29 19:08 [PATCH v2 0/3] ruby: add latest config API Felipe Contreras
  2021-06-29 19:08 ` [PATCH v2 1/3] ruby: add new Database.open_with_config Felipe Contreras
@ 2021-06-29 19:08 ` Felipe Contreras
  2021-06-29 19:08 ` [PATCH v2 3/3] ruby: make db.config return an enumerator Felipe Contreras
  2 siblings, 0 replies; 5+ messages in thread
From: Felipe Contreras @ 2021-06-29 19:08 UTC (permalink / raw)
  To: notmuch; +Cc: David Bremner, Felipe Contreras

In order to use notmuch_config_get_pairs.

Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
---
 bindings/ruby/database.c | 31 +++++++++++++++++++++++++++++++
 bindings/ruby/defs.h     |  4 ++++
 bindings/ruby/init.c     |  1 +
 test/T395-ruby.sh        |  8 ++++++++
 4 files changed, 44 insertions(+)

diff --git a/bindings/ruby/database.c b/bindings/ruby/database.c
index 89d9619e..571f7e24 100644
--- a/bindings/ruby/database.c
+++ b/bindings/ruby/database.c
@@ -520,3 +520,34 @@ notmuch_rb_database_query_create (int argc, VALUE *argv, VALUE self)
 
     return Data_Wrap_Notmuch_Object (notmuch_rb_cQuery, &notmuch_rb_query_type, query);
 }
+
+/*
+ * call-seq: DB.config(prefix) {|key, value| block} => nil
+ *
+ * Calls +block+ once for each key/value pair.
+ *
+ */
+VALUE
+notmuch_rb_database_config (int argc, VALUE *argv, VALUE self)
+{
+    VALUE prefix;
+    notmuch_database_t *db;
+    notmuch_config_pairs_t *list;
+    const char *cprefix;
+
+    Data_Get_Notmuch_Database (self, db);
+
+    rb_scan_args (argc, argv, "01", &prefix);
+
+    cprefix = prefix != Qnil ? RSTRING_PTR (prefix) : "";
+
+    list = notmuch_config_get_pairs (db, cprefix);
+    for (; notmuch_config_pairs_valid (list); notmuch_config_pairs_move_to_next (list)) {
+	const char *key = notmuch_config_pairs_key (list);
+	const char *value = notmuch_config_pairs_value (list);
+	rb_yield (rb_ary_new3(2, nm_str_new (key), nm_str_new (value)));
+    }
+    notmuch_config_pairs_destroy (list);
+
+    return Qnil;
+}
diff --git a/bindings/ruby/defs.h b/bindings/ruby/defs.h
index cba9fd69..f3371b5d 100644
--- a/bindings/ruby/defs.h
+++ b/bindings/ruby/defs.h
@@ -57,6 +57,7 @@ extern ID ID_db_mode;
 
 /* Simple string helpers */
 #define nm_str(str) (str != Qnil ? RSTRING_PTR (str) : NULL)
+#define nm_str_new(str) (str ? rb_str_new_cstr (str) : Qnil)
 
 extern const rb_data_type_t notmuch_rb_object_type;
 extern const rb_data_type_t notmuch_rb_database_type;
@@ -182,6 +183,9 @@ notmuch_rb_database_get_all_tags (VALUE self);
 VALUE
 notmuch_rb_database_query_create (int argc, VALUE *argv, VALUE self);
 
+VALUE
+notmuch_rb_database_config (int argc, VALUE *argv, VALUE self);
+
 /* directory.c */
 VALUE
 notmuch_rb_directory_destroy (VALUE self);
diff --git a/bindings/ruby/init.c b/bindings/ruby/init.c
index 7b4de86a..fad357dc 100644
--- a/bindings/ruby/init.c
+++ b/bindings/ruby/init.c
@@ -277,6 +277,7 @@ Init_notmuch (void)
 		      notmuch_rb_database_find_message_by_filename, 1); /* in database.c */
     rb_define_method (notmuch_rb_cDatabase, "all_tags", notmuch_rb_database_get_all_tags, 0); /* in database.c */
     rb_define_method (notmuch_rb_cDatabase, "query", notmuch_rb_database_query_create, -1); /* in database.c */
+    rb_define_method (notmuch_rb_cDatabase, "config", notmuch_rb_database_config, -1); /* in database.c */
 
     /*
      * Document-class: Notmuch::Directory
diff --git a/test/T395-ruby.sh b/test/T395-ruby.sh
index 9a1df913..91c310c6 100755
--- a/test/T395-ruby.sh
+++ b/test/T395-ruby.sh
@@ -106,4 +106,12 @@ test_ruby <<EOF
 puts Notmuch::Database.open_with_config.path
 EOF
 
+test_begin_subtest "config"
+notmuch config list | grep -v '^built_with\.' > EXPECTED
+test_ruby <<"EOF"
+Notmuch::Database.open_with_config do |db|
+  db.config { |e| puts '%s=%s' % e }
+end
+EOF
+
 test_done
-- 
2.32.0

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH v2 3/3] ruby: make db.config return an enumerator
  2021-06-29 19:08 [PATCH v2 0/3] ruby: add latest config API Felipe Contreras
  2021-06-29 19:08 ` [PATCH v2 1/3] ruby: add new Database.open_with_config Felipe Contreras
  2021-06-29 19:08 ` [PATCH v2 2/3] ruby: add db.config Felipe Contreras
@ 2021-06-29 19:08 ` Felipe Contreras
  2 siblings, 0 replies; 5+ messages in thread
From: Felipe Contreras @ 2021-06-29 19:08 UTC (permalink / raw)
  To: notmuch; +Cc: David Bremner, Felipe Contreras

Currently db.config requires a block to work:

  db.config { |k, v| puts '%s=%s' % [k, v] }

If you try to use it without a block you, get an error like:

  in `config': no block given (LocalJumpError)

In Ruby most methods should return an Enumerator if no block is given,
like:

  (1..10).each
  => #<Enumerator: ...>

This allows us to do:

  db.config.to_a
  db.config.to_h
  db.config.each { |k, v| ... }

And of course what is already possible:

  db.config { |k, v| ... }

Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
---
 bindings/ruby/database.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/bindings/ruby/database.c b/bindings/ruby/database.c
index 571f7e24..926b0985 100644
--- a/bindings/ruby/database.c
+++ b/bindings/ruby/database.c
@@ -535,6 +535,8 @@ notmuch_rb_database_config (int argc, VALUE *argv, VALUE self)
     notmuch_config_pairs_t *list;
     const char *cprefix;
 
+    RETURN_ENUMERATOR(self, argc, argv);
+
     Data_Get_Notmuch_Database (self, db);
 
     rb_scan_args (argc, argv, "01", &prefix);
-- 
2.32.0

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH v2 1/3] ruby: add new Database.open_with_config
  2021-06-29 19:08 ` [PATCH v2 1/3] ruby: add new Database.open_with_config Felipe Contreras
@ 2021-08-21 14:20   ` David Bremner
  0 siblings, 0 replies; 5+ messages in thread
From: David Bremner @ 2021-08-21 14:20 UTC (permalink / raw)
  To: Felipe Contreras, notmuch

[-- Attachment #1: Type: text/plain, Size: 303 bytes --]

Felipe Contreras <felipe.contreras@gmail.com> writes:

> In order to make use of notmuch_database_open_with_config.
>
> Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>

This is crashing ruby 2.7 when applied against master.

I did have to use am -3 to get it to apply; the result is below


[-- Attachment #2: crash output --]
[-- Type: application/octet-stream, Size: 33274 bytes --]

-:3: [BUG] Segmentation fault at 0x00000000000000b8
ruby 2.7.4p191 (2021-07-07 revision a21a3b7d23) [x86_64-linux-gnu]

-- Control frame information -----------------------------------------------
c:0003 p:---- s:0012 e:000011 CFUNC  :path
c:0002 p:0043 s:0008 E:0021d8 EVAL   -:3 [FINISH]
c:0001 p:0000 s:0003 E:0002c0 (none) [FINISH]

-- Ruby level backtrace information ----------------------------------------
-:3:in `<main>'
-:3:in `path'

-- Machine register context ------------------------------------------------
 RIP: 0x00007f652de273f7 RBP: 0x00005556ca3a8100 RSP: 0x00007fffb94baa18
 RAX: 0x00007f652de27408 RBX: 0x00005556ca396e28 RCX: 0x00007f652de47ac0
 RDX: 0x00007f652de338cc RDI: 0x0000000000000000 RSI: 0x00007f652de33576
  R8: 0x0000000000000000  R9: 0x0000000055550083 R10: 0x0000000000000000
 R11: 0x00007f65313fcfa0 R12: 0x00005556ca6931c0 R13: 0x0000000000000000
 R14: 0x00005556ca396e28 R15: 0x00005556ca38c570 EFL: 0x0000000000010213

-- C level backtrace information -------------------------------------------
/lib/x86_64-linux-gnu/libruby-2.7.so.2.7(0x7f6531a3287a) [0x7f6531a3287a]
/lib/x86_64-linux-gnu/libruby-2.7.so.2.7(0x7f65318a2e57) [0x7f65318a2e57]
/lib/x86_64-linux-gnu/libruby-2.7.so.2.7(0x7f65319aed09) [0x7f65319aed09]
/lib/x86_64-linux-gnu/libc.so.6(0x7f6531671d60) [0x7f6531671d60]
/home/bremner/software/upstream/notmuch/lib/libnotmuch.so.5(notmuch_config_get+0x27) [0x7f652de273f7] lib/config.cc:597
/home/bremner/software/upstream/notmuch/lib/libnotmuch.so.5(notmuch_config_get) (null):0
/home/bremner/software/upstream/notmuch/bindings/ruby/notmuch.so(notmuch_rb_database_path+0x1f) [0x7f652de47adf] database.c:214
/home/bremner/software/upstream/notmuch/bindings/ruby/notmuch.so(notmuch_rb_database_path) (null):0
/lib/x86_64-linux-gnu/libruby-2.7.so.2.7(0x7f6531a17fd2) [0x7f6531a17fd2]
/lib/x86_64-linux-gnu/libruby-2.7.so.2.7(0x7f6531a0c7f6) [0x7f6531a0c7f6]
/lib/x86_64-linux-gnu/libruby-2.7.so.2.7(0x7f6531a1c76c) [0x7f6531a1c76c]
/lib/x86_64-linux-gnu/libruby-2.7.so.2.7(rb_vm_exec+0x1bb) [0x7f6531a222bb]
/lib/x86_64-linux-gnu/libruby-2.7.so.2.7(0x7f65318a6f60) [0x7f65318a6f60]
/lib/x86_64-linux-gnu/libruby-2.7.so.2.7(ruby_run_node+0x48) [0x7f65318ab378]
ruby(0x5556c83ef10b) [0x5556c83ef10b]
/lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xea) [0x7f653165cd0a]
ruby(_start+0x2a) [0x5556c83ef15a]

-- Other runtime information -----------------------------------------------

* Loaded script: -

* Loaded features:

    0 enumerator.so
    1 thread.rb
    2 rational.so
    3 complex.so
    4 ruby2_keywords.rb
    5 /usr/lib/x86_64-linux-gnu/ruby/2.7.0/enc/encdb.so
    6 /usr/lib/x86_64-linux-gnu/ruby/2.7.0/enc/trans/transdb.so
    7 /usr/lib/x86_64-linux-gnu/ruby/2.7.0/rbconfig.rb
    8 /usr/lib/ruby/vendor_ruby/rubygems/compatibility.rb
    9 /usr/lib/ruby/vendor_ruby/rubygems/defaults.rb
   10 /usr/lib/ruby/vendor_ruby/rubygems/deprecate.rb
   11 /usr/lib/ruby/vendor_ruby/rubygems/errors.rb
   12 /usr/lib/ruby/vendor_ruby/rubygems/exceptions.rb
   13 /usr/lib/ruby/vendor_ruby/rubygems/basic_specification.rb
   14 /usr/lib/ruby/vendor_ruby/rubygems/stub_specification.rb
   15 /usr/lib/ruby/vendor_ruby/rubygems/text.rb
   16 /usr/lib/ruby/vendor_ruby/rubygems/user_interaction.rb
   17 /usr/lib/ruby/vendor_ruby/rubygems/specification_policy.rb
   18 /usr/lib/ruby/vendor_ruby/rubygems/util/list.rb
   19 /usr/lib/ruby/vendor_ruby/rubygems/platform.rb
   20 /usr/lib/ruby/vendor_ruby/rubygems/version.rb
   21 /usr/lib/ruby/vendor_ruby/rubygems/requirement.rb
   22 /usr/lib/ruby/vendor_ruby/rubygems/specification.rb
   23 /usr/lib/ruby/vendor_ruby/rubygems/defaults/operating_system.rb
   24 /usr/lib/ruby/vendor_ruby/rubygems/util.rb
   25 /usr/lib/ruby/vendor_ruby/rubygems/dependency.rb
   26 /usr/lib/ruby/vendor_ruby/rubygems/core_ext/kernel_gem.rb
   27 /usr/lib/x86_64-linux-gnu/ruby/2.7.0/monitor.so
   28 /usr/lib/ruby/2.7.0/monitor.rb
   29 /usr/lib/ruby/vendor_ruby/rubygems/core_ext/kernel_require.rb
   30 /usr/lib/ruby/vendor_ruby/rubygems/core_ext/kernel_warn.rb
   31 /usr/lib/ruby/vendor_ruby/rubygems.rb
   32 /usr/lib/ruby/vendor_ruby/rubygems/path_support.rb
   33 /usr/lib/ruby/2.7.0/did_you_mean/version.rb
   34 /usr/lib/ruby/2.7.0/did_you_mean/core_ext/name_error.rb
   35 /usr/lib/ruby/2.7.0/did_you_mean/levenshtein.rb
   36 /usr/lib/ruby/2.7.0/did_you_mean/jaro_winkler.rb
   37 /usr/lib/ruby/2.7.0/did_you_mean/spell_checker.rb
   38 /usr/lib/ruby/2.7.0/did_you_mean/spell_checkers/name_error_checkers/class_name_checker.rb
   39 /usr/lib/ruby/2.7.0/did_you_mean/spell_checkers/name_error_checkers/variable_name_checker.rb
   40 /usr/lib/ruby/2.7.0/did_you_mean/spell_checkers/name_error_checkers.rb
   41 /usr/lib/ruby/2.7.0/did_you_mean/spell_checkers/method_name_checker.rb
   42 /usr/lib/ruby/2.7.0/did_you_mean/spell_checkers/key_error_checker.rb
   43 /usr/lib/ruby/2.7.0/did_you_mean/spell_checkers/null_checker.rb
   44 /usr/lib/ruby/2.7.0/did_you_mean/formatters/plain_formatter.rb
   45 /usr/lib/ruby/2.7.0/did_you_mean/tree_spell_checker.rb
   46 /usr/lib/ruby/2.7.0/did_you_mean.rb
   47 /home/bremner/software/upstream/notmuch/bindings/ruby/notmuch.so

* Process memory map:

5556c83ee000-5556c83ef000 r--p 00000000 fe:01 802608                     /usr/bin/ruby2.7
5556c83ef000-5556c83f0000 r-xp 00001000 fe:01 802608                     /usr/bin/ruby2.7
5556c83f0000-5556c83f1000 r--p 00002000 fe:01 802608                     /usr/bin/ruby2.7
5556c83f1000-5556c83f2000 r--p 00002000 fe:01 802608                     /usr/bin/ruby2.7
5556c83f2000-5556c83f3000 rw-p 00003000 fe:01 802608                     /usr/bin/ruby2.7
5556ca38b000-5556ca787000 rw-p 00000000 00:00 0                          [heap]
7f652cb13000-7f652ce17000 r--s 00000000 fe:05 1049549                    /home/bremner/software/upstream/notmuch/lib/libnotmuch.so.5.4.0
7f652ce17000-7f652cfd9000 r--s 00000000 fe:01 784855                     /usr/lib/x86_64-linux-gnu/libc-2.31.so
7f652cfd9000-7f652d31d000 r--s 00000000 fe:01 788032                     /usr/lib/x86_64-linux-gnu/libruby-2.7.so.2.7.4
7f652d31d000-7f652d320000 r--p 00000000 fe:01 784876                     /usr/lib/x86_64-linux-gnu/libnss_files-2.31.so
7f652d320000-7f652d327000 r-xp 00003000 fe:01 784876                     /usr/lib/x86_64-linux-gnu/libnss_files-2.31.so
7f652d327000-7f652d329000 r--p 0000a000 fe:01 784876                     /usr/lib/x86_64-linux-gnu/libnss_files-2.31.so
7f652d329000-7f652d32a000 r--p 0000b000 fe:01 784876                     /usr/lib/x86_64-linux-gnu/libnss_files-2.31.so
7f652d32a000-7f652d32b000 rw-p 0000c000 fe:01 784876                     /usr/lib/x86_64-linux-gnu/libnss_files-2.31.so
7f652d32b000-7f652d331000 rw-p 00000000 00:00 0 
7f652d331000-7f652d333000 r--p 00000000 fe:01 807692                     /usr/lib/x86_64-linux-gnu/libpcre2-8.so.0.10.1
7f652d333000-7f652d39e000 r-xp 00002000 fe:01 807692                     /usr/lib/x86_64-linux-gnu/libpcre2-8.so.0.10.1
7f652d39e000-7f652d3c7000 r--p 0006d000 fe:01 807692                     /usr/lib/x86_64-linux-gnu/libpcre2-8.so.0.10.1
7f652d3c7000-7f652d3c8000 r--p 00095000 fe:01 807692                     /usr/lib/x86_64-linux-gnu/libpcre2-8.so.0.10.1
7f652d3c8000-7f652d3c9000 rw-p 00096000 fe:01 807692                     /usr/lib/x86_64-linux-gnu/libpcre2-8.so.0.10.1
7f652d3c9000-7f652d3d2000 r--p 00000000 fe:01 785488                     /usr/lib/x86_64-linux-gnu/libblkid.so.1.1.0
7f652d3d2000-7f652d404000 r-xp 00009000 fe:01 785488                     /usr/lib/x86_64-linux-gnu/libblkid.so.1.1.0
7f652d404000-7f652d414000 r--p 0003b000 fe:01 785488                     /usr/lib/x86_64-linux-gnu/libblkid.so.1.1.0
7f652d414000-7f652d415000 ---p 0004b000 fe:01 785488                     /usr/lib/x86_64-linux-gnu/libblkid.so.1.1.0
7f652d415000-7f652d419000 r--p 0004b000 fe:01 785488                     /usr/lib/x86_64-linux-gnu/libblkid.so.1.1.0
7f652d419000-7f652d41a000 rw-p 0004f000 fe:01 785488                     /usr/lib/x86_64-linux-gnu/libblkid.so.1.1.0
7f652d41a000-7f652d41e000 r--p 00000000 fe:01 792473                     /usr/lib/x86_64-linux-gnu/libgpg-error.so.0.29.0
7f652d41e000-7f652d433000 r-xp 00004000 fe:01 792473                     /usr/lib/x86_64-linux-gnu/libgpg-error.so.0.29.0
7f652d433000-7f652d43d000 r--p 00019000 fe:01 792473                     /usr/lib/x86_64-linux-gnu/libgpg-error.so.0.29.0
7f652d43d000-7f652d43e000 ---p 00023000 fe:01 792473                     /usr/lib/x86_64-linux-gnu/libgpg-error.so.0.29.0
7f652d43e000-7f652d43f000 r--p 00023000 fe:01 792473                     /usr/lib/x86_64-linux-gnu/libgpg-error.so.0.29.0
7f652d43f000-7f652d440000 rw-p 00024000 fe:01 792473                     /usr/lib/x86_64-linux-gnu/libgpg-error.so.0.29.0
7f652d440000-7f652d444000 r--p 00000000 fe:01 791776                     /usr/lib/x86_64-linux-gnu/libassuan.so.0.8.3
7f652d444000-7f652d44f000 r-xp 00004000 fe:01 791776                     /usr/lib/x86_64-linux-gnu/libassuan.so.0.8.3
7f652d44f000-7f652d454000 r--p 0000f000 fe:01 791776                     /usr/lib/x86_64-linux-gnu/libassuan.so.0.8.3
7f652d454000-7f652d455000 r--p 00013000 fe:01 791776                     /usr/lib/x86_64-linux-gnu/libassuan.so.0.8.3
7f652d455000-7f652d456000 rw-p 00014000 fe:01 791776                     /usr/lib/x86_64-linux-gnu/libassuan.so.0.8.3
7f652d456000-7f652d45a000 r--p 00000000 fe:01 784881                     /usr/lib/x86_64-linux-gnu/libresolv-2.31.so
7f652d45a000-7f652d468000 r-xp 00004000 fe:01 784881                     /usr/lib/x86_64-linux-gnu/libresolv-2.31.so
7f652d468000-7f652d46b000 r--p 00012000 fe:01 784881                     /usr/lib/x86_64-linux-gnu/libresolv-2.31.so
7f652d46b000-7f652d46c000 ---p 00015000 fe:01 784881                     /usr/lib/x86_64-linux-gnu/libresolv-2.31.so
7f652d46c000-7f652d46d000 r--p 00015000 fe:01 784881                     /usr/lib/x86_64-linux-gnu/libresolv-2.31.so
7f652d46d000-7f652d46e000 rw-p 00016000 fe:01 784881                     /usr/lib/x86_64-linux-gnu/libresolv-2.31.so
7f652d46e000-7f652d470000 rw-p 00000000 00:00 0 
7f652d470000-7f652d477000 r--p 00000000 fe:01 784907                     /usr/lib/x86_64-linux-gnu/libselinux.so.1
7f652d477000-7f652d490000 r-xp 00007000 fe:01 784907                     /usr/lib/x86_64-linux-gnu/libselinux.so.1
7f652d490000-7f652d498000 r--p 00020000 fe:01 784907                     /usr/lib/x86_64-linux-gnu/libselinux.so.1
7f652d498000-7f652d499000 r--p 00027000 fe:01 784907                     /usr/lib/x86_64-linux-gnu/libselinux.so.1
7f652d499000-7f652d49a000 rw-p 00028000 fe:01 784907                     /usr/lib/x86_64-linux-gnu/libselinux.so.1
7f652d49a000-7f652d49c000 rw-p 00000000 00:00 0 
7f652d49c000-7f652d4a7000 r--p 00000000 fe:01 783758                     /usr/lib/x86_64-linux-gnu/libmount.so.1.1.0
7f652d4a7000-7f652d4e3000 r-xp 0000b000 fe:01 783758                     /usr/lib/x86_64-linux-gnu/libmount.so.1.1.0
7f652d4e3000-7f652d4f5000 r--p 00047000 fe:01 783758                     /usr/lib/x86_64-linux-gnu/libmount.so.1.1.0
7f652d4f5000-7f652d4f6000 ---p 00059000 fe:01 783758                     /usr/lib/x86_64-linux-gnu/libmount.so.1.1.0
7f652d4f6000-7f652d4f8000 r--p 00059000 fe:01 783758                     /usr/lib/x86_64-linux-gnu/libmount.so.1.1.0
7f652d4f8000-7f652d4f9000 rw-p 0005b000 fe:01 783758                     /usr/lib/x86_64-linux-gnu/libmount.so.1.1.0
7f652d4f9000-7f652d4fa000 r--p 00000000 fe:01 799375                     /usr/lib/x86_64-linux-gnu/libgmodule-2.0.so.0.6600.8
7f652d4fa000-7f652d4fc000 r-xp 00001000 fe:01 799375                     /usr/lib/x86_64-linux-gnu/libgmodule-2.0.so.0.6600.8
7f652d4fc000-7f652d4fd000 r--p 00003000 fe:01 799375                     /usr/lib/x86_64-linux-gnu/libgmodule-2.0.so.0.6600.8
7f652d4fd000-7f652d4fe000 r--p 00003000 fe:01 799375                     /usr/lib/x86_64-linux-gnu/libgmodule-2.0.so.0.6600.8
7f652d4fe000-7f652d4ff000 rw-p 00004000 fe:01 799375                     /usr/lib/x86_64-linux-gnu/libgmodule-2.0.so.0.6600.8
7f652d4ff000-7f652d501000 r--p 00000000 fe:01 808018                     /usr/lib/x86_64-linux-gnu/libpcre.so.3.13.3
7f652d501000-7f652d552000 r-xp 00002000 fe:01 808018                     /usr/lib/x86_64-linux-gnu/libpcre.so.3.13.3
7f652d552000-7f652d570000 r--p 00053000 fe:01 808018                     /usr/lib/x86_64-linux-gnu/libpcre.so.3.13.3
7f652d570000-7f652d571000 r--p 00070000 fe:01 808018                     /usr/lib/x86_64-linux-gnu/libpcre.so.3.13.3
7f652d571000-7f652d572000 rw-p 00071000 fe:01 808018                     /usr/lib/x86_64-linux-gnu/libpcre.so.3.13.3
7f652d572000-7f652d574000 r--p 00000000 fe:01 784163                     /usr/lib/x86_64-linux-gnu/libffi.so.7.1.0
7f652d574000-7f652d57a000 r-xp 00002000 fe:01 784163                     /usr/lib/x86_64-linux-gnu/libffi.so.7.1.0
7f652d57a000-7f652d57c000 r--p 00008000 fe:01 784163                     /usr/lib/x86_64-linux-gnu/libffi.so.7.1.0
7f652d57c000-7f652d57d000 r--p 00009000 fe:01 784163                     /usr/lib/x86_64-linux-gnu/libffi.so.7.1.0
7f652d57d000-7f652d57e000 rw-p 0000a000 fe:01 784163                     /usr/lib/x86_64-linux-gnu/libffi.so.7.1.0
7f652d57e000-7f652d585000 r--p 00000000 fe:01 792272                     /usr/lib/x86_64-linux-gnu/libgpgme.so.11.23.0
7f652d585000-7f652d5b9000 r-xp 00007000 fe:01 792272                     /usr/lib/x86_64-linux-gnu/libgpgme.so.11.23.0
7f652d5b9000-7f652d5cc000 r--p 0003b000 fe:01 792272                     /usr/lib/x86_64-linux-gnu/libgpgme.so.11.23.0
7f652d5cc000-7f652d5cd000 r--p 0004d000 fe:01 792272                     /usr/lib/x86_64-linux-gnu/libgpgme.so.11.23.0
7f652d5cd000-7f652d5cf000 rw-p 0004e000 fe:01 792272                     /usr/lib/x86_64-linux-gnu/libgpgme.so.11.23.0
7f652d5cf000-7f652d5d2000 r--p 00000000 fe:01 783770                     /usr/lib/x86_64-linux-gnu/libz.so.1.2.11
7f652d5d2000-7f652d5e3000 r-xp 00003000 fe:01 783770                     /usr/lib/x86_64-linux-gnu/libz.so.1.2.11
7f652d5e3000-7f652d5e9000 r--p 00014000 fe:01 783770                     /usr/lib/x86_64-linux-gnu/libz.so.1.2.11
7f652d5e9000-7f652d5ea000 ---p 0001a000 fe:01 783770                     /usr/lib/x86_64-linux-gnu/libz.so.1.2.11
7f652d5ea000-7f652d5eb000 r--p 0001a000 fe:01 783770                     /usr/lib/x86_64-linux-gnu/libz.so.1.2.11
7f652d5eb000-7f652d5ec000 rw-p 0001b000 fe:01 783770                     /usr/lib/x86_64-linux-gnu/libz.so.1.2.11
7f652d5ec000-7f652d624000 r--p 00000000 fe:01 799373                     /usr/lib/x86_64-linux-gnu/libgio-2.0.so.0.6600.8
7f652d624000-7f652d734000 r-xp 00038000 fe:01 799373                     /usr/lib/x86_64-linux-gnu/libgio-2.0.so.0.6600.8
7f652d734000-7f652d7be000 r--p 00148000 fe:01 799373                     /usr/lib/x86_64-linux-gnu/libgio-2.0.so.0.6600.8
7f652d7be000-7f652d7c7000 r--p 001d1000 fe:01 799373                     /usr/lib/x86_64-linux-gnu/libgio-2.0.so.0.6600.8
7f652d7c7000-7f652d7c8000 rw-p 001da000 fe:01 799373                     /usr/lib/x86_64-linux-gnu/libgio-2.0.so.0.6600.8
7f652d7c8000-7f652d7ca000 rw-p 00000000 00:00 0 
7f652d7ca000-7f652d7cd000 r--p 00000000 fe:01 784862                     /usr/lib/x86_64-linux-gnu/libgcc_s.so.1
7f652d7cd000-7f652d7de000 r-xp 00003000 fe:01 784862                     /usr/lib/x86_64-linux-gnu/libgcc_s.so.1
7f652d7de000-7f652d7e2000 r--p 00014000 fe:01 784862                     /usr/lib/x86_64-linux-gnu/libgcc_s.so.1
7f652d7e2000-7f652d7e3000 r--p 00017000 fe:01 784862                     /usr/lib/x86_64-linux-gnu/libgcc_s.so.1
7f652d7e3000-7f652d7e4000 rw-p 00018000 fe:01 784862                     /usr/lib/x86_64-linux-gnu/libgcc_s.so.1
7f652d7e4000-7f652d87a000 r--p 00000000 fe:01 787072                     /usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.28
7f652d87a000-7f652d956000 r-xp 00096000 fe:01 787072                     /usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.28
7f652d956000-7f652d9a0000 r--p 00172000 fe:01 787072                     /usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.28
7f652d9a0000-7f652d9ab000 r--p 001bb000 fe:01 787072                     /usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.28
7f652d9ab000-7f652d9ae000 rw-p 001c6000 fe:01 787072                     /usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.28
7f652d9ae000-7f652d9b1000 rw-p 00000000 00:00 0 
7f652d9b1000-7f652d9e8000 r--p 00000000 fe:01 785403                     /usr/lib/x86_64-linux-gnu/libxapian.so.30.11.0
7f652d9e8000-7f652db4f000 r-xp 00037000 fe:01 785403                     /usr/lib/x86_64-linux-gnu/libxapian.so.30.11.0
7f652db4f000-7f652dbc9000 r--p 0019e000 fe:01 785403                     /usr/lib/x86_64-linux-gnu/libxapian.so.30.11.0
7f652dbc9000-7f652dbd2000 r--p 00217000 fe:01 785403                     /usr/lib/x86_64-linux-gnu/libxapian.so.30.11.0
7f652dbd2000-7f652dbd3000 rw-p 00220000 fe:01 785403                     /usr/lib/x86_64-linux-gnu/libxapian.so.30.11.0
7f652dbd3000-7f652dbef000 r--p 00000000 fe:01 799374                     /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0.6600.8
7f652dbef000-7f652dc77000 r-xp 0001c000 fe:01 799374                     /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0.6600.8
7f652dc77000-7f652dcff000 r--p 000a4000 fe:01 799374                     /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0.6600.8
7f652dcff000-7f652dd00000 r--p 0012b000 fe:01 799374                     /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0.6600.8
7f652dd00000-7f652dd01000 rw-p 0012c000 fe:01 799374                     /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0.6600.8
7f652dd01000-7f652dd02000 rw-p 00000000 00:00 0 
7f652dd02000-7f652dd10000 r--p 00000000 fe:01 799376                     /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0.6600.8
7f652dd10000-7f652dd3f000 r-xp 0000e000 fe:01 799376                     /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0.6600.8
7f652dd3f000-7f652dd57000 r--p 0003d000 fe:01 799376                     /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0.6600.8
7f652dd57000-7f652dd58000 ---p 00055000 fe:01 799376                     /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0.6600.8
7f652dd58000-7f652dd5b000 r--p 00055000 fe:01 799376                     /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0.6600.8
7f652dd5b000-7f652dd5c000 rw-p 00058000 fe:01 799376                     /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0.6600.8
7f652dd5c000-7f652dd72000 r--p 00000000 fe:01 806149                     /usr/lib/x86_64-linux-gnu/libgmime-3.0.so.0.206.1
7f652dd72000-7f652dda9000 r-xp 00016000 fe:01 806149                     /usr/lib/x86_64-linux-gnu/libgmime-3.0.so.0.206.1
7f652dda9000-7f652ddc3000 r--p 0004d000 fe:01 806149                     /usr/lib/x86_64-linux-gnu/libgmime-3.0.so.0.206.1
7f652ddc3000-7f652ddc9000 r--p 00066000 fe:01 806149                     /usr/lib/x86_64-linux-gnu/libgmime-3.0.so.0.206.1
7f652ddc9000-7f652ddda000 rw-p 0006c000 fe:01 806149                     /usr/lib/x86_64-linux-gnu/libgmime-3.0.so.0.206.1
7f652ddda000-7f652dddd000 r--p 00000000 fe:01 799956                     /usr/lib/x86_64-linux-gnu/libtalloc.so.2.3.1
7f652dddd000-7f652dde4000 r-xp 00003000 fe:01 799956                     /usr/lib/x86_64-linux-gnu/libtalloc.so.2.3.1
7f652dde4000-7f652dde6000 r--p 0000a000 fe:01 799956                     /usr/lib/x86_64-linux-gnu/libtalloc.so.2.3.1
7f652dde6000-7f652dde7000 ---p 0000c000 fe:01 799956                     /usr/lib/x86_64-linux-gnu/libtalloc.so.2.3.1
7f652dde7000-7f652dde8000 r--p 0000c000 fe:01 799956                     /usr/lib/x86_64-linux-gnu/libtalloc.so.2.3.1
7f652dde8000-7f652dde9000 rw-p 0000d000 fe:01 799956                     /usr/lib/x86_64-linux-gnu/libtalloc.so.2.3.1
7f652de00000-7f652de04000 r--s 00000000 fe:01 802608                     /usr/bin/ruby2.7
7f652de04000-7f652de11000 r--p 00000000 fe:05 1049549                    /home/bremner/software/upstream/notmuch/lib/libnotmuch.so.5.4.0
7f652de11000-7f652de31000 r-xp 0000d000 fe:05 1049549                    /home/bremner/software/upstream/notmuch/lib/libnotmuch.so.5.4.0
7f652de31000-7f652de3d000 r--p 0002d000 fe:05 1049549                    /home/bremner/software/upstream/notmuch/lib/libnotmuch.so.5.4.0
7f652de3d000-7f652de3e000 ---p 00039000 fe:05 1049549                    /home/bremner/software/upstream/notmuch/lib/libnotmuch.so.5.4.0
7f652de3e000-7f652de3f000 r--p 00039000 fe:05 1049549                    /home/bremner/software/upstream/notmuch/lib/libnotmuch.so.5.4.0
7f652de3f000-7f652de41000 rw-p 0003a000 fe:05 1049549                    /home/bremner/software/upstream/notmuch/lib/libnotmuch.so.5.4.0
7f652de41000-7f652de47000 r--p 00000000 fe:05 1049569                    /home/bremner/software/upstream/notmuch/bindings/ruby/notmuch.so
7f652de47000-7f652de4e000 r-xp 00006000 fe:05 1049569                    /home/bremner/software/upstream/notmuch/bindings/ruby/notmuch.so
7f652de4e000-7f652de50000 r--p 0000d000 fe:05 1049569                    /home/bremner/software/upstream/notmuch/bindings/ruby/notmuch.so
7f652de50000-7f652de51000 ---p 0000f000 fe:05 1049569                    /home/bremner/software/upstream/notmuch/bindings/ruby/notmuch.so
7f652de51000-7f652de52000 r--p 0000f000 fe:05 1049569                    /home/bremner/software/upstream/notmuch/bindings/ruby/notmuch.so
7f652de52000-7f652de53000 rw-p 00010000 fe:05 1049569                    /home/bremner/software/upstream/notmuch/bindings/ruby/notmuch.so
7f652de53000-7f652de54000 ---p 00000000 00:00 0 
7f652de54000-7f652def5000 rw-p 00000000 00:00 0 
7f652def5000-7f652def6000 ---p 00000000 00:00 0 
7f652def6000-7f652df97000 rw-p 00000000 00:00 0 
7f652df97000-7f652df98000 ---p 00000000 00:00 0 
7f652df98000-7f652e039000 rw-p 00000000 00:00 0 
7f652e039000-7f652e03a000 ---p 00000000 00:00 0 
7f652e03a000-7f652e0db000 rw-p 00000000 00:00 0 
7f652e0db000-7f652e0dc000 ---p 00000000 00:00 0 
7f652e0dc000-7f652e17d000 rw-p 00000000 00:00 0 
7f652e17d000-7f652e17e000 ---p 00000000 00:00 0 
7f652e17e000-7f652e21f000 rw-p 00000000 00:00 0 
7f652e21f000-7f652e220000 ---p 00000000 00:00 0 
7f652e220000-7f652e2c1000 rw-p 00000000 00:00 0 
7f652e2c1000-7f652e2c2000 ---p 00000000 00:00 0 
7f652e2c2000-7f652e363000 rw-p 00000000 00:00 0 
7f652e363000-7f652e364000 ---p 00000000 00:00 0 
7f652e364000-7f652e405000 rw-p 00000000 00:00 0 
7f652e405000-7f652e406000 ---p 00000000 00:00 0 
7f652e406000-7f652e4a7000 rw-p 00000000 00:00 0 
7f652e4a7000-7f652e4a8000 ---p 00000000 00:00 0 
7f652e4a8000-7f652e549000 rw-p 00000000 00:00 0 
7f652e549000-7f652e54a000 ---p 00000000 00:00 0 
7f652e54a000-7f652e5eb000 rw-p 00000000 00:00 0 
7f652e5eb000-7f652e5ec000 ---p 00000000 00:00 0 
7f652e5ec000-7f652e68d000 rw-p 00000000 00:00 0 
7f652e68d000-7f652e68e000 ---p 00000000 00:00 0 
7f652e68e000-7f652e72f000 rw-p 00000000 00:00 0 
7f652e72f000-7f652e730000 ---p 00000000 00:00 0 
7f652e730000-7f652e7d1000 rw-p 00000000 00:00 0 
7f652e7d1000-7f652e7d2000 ---p 00000000 00:00 0 
7f652e7d2000-7f652e873000 rw-p 00000000 00:00 0 
7f652e873000-7f652e874000 ---p 00000000 00:00 0 
7f652e874000-7f652e915000 rw-p 00000000 00:00 0 
7f652e915000-7f652e916000 ---p 00000000 00:00 0 
7f652e916000-7f652e9b7000 rw-p 00000000 00:00 0 
7f652e9b7000-7f652e9b8000 ---p 00000000 00:00 0 
7f652e9b8000-7f652ea59000 rw-p 00000000 00:00 0 
7f652ea59000-7f652ea5a000 ---p 00000000 00:00 0 
7f652ea5a000-7f652eafb000 rw-p 00000000 00:00 0 
7f652eafb000-7f652eafc000 ---p 00000000 00:00 0 
7f652eafc000-7f652eb9d000 rw-p 00000000 00:00 0 
7f652eb9d000-7f652eb9e000 ---p 00000000 00:00 0 
7f652eb9e000-7f652ec3f000 rw-p 00000000 00:00 0 
7f652ec3f000-7f652ec40000 ---p 00000000 00:00 0 
7f652ec40000-7f652ece1000 rw-p 00000000 00:00 0 
7f652ece1000-7f652ece2000 ---p 00000000 00:00 0 
7f652ece2000-7f652ed83000 rw-p 00000000 00:00 0 
7f652ed83000-7f652ed84000 ---p 00000000 00:00 0 
7f652ed84000-7f652ee25000 rw-p 00000000 00:00 0 
7f652ee25000-7f652ee26000 ---p 00000000 00:00 0 
7f652ee26000-7f652eec7000 rw-p 00000000 00:00 0 
7f652eec7000-7f652eec8000 ---p 00000000 00:00 0 
7f652eec8000-7f652ef69000 rw-p 00000000 00:00 0 
7f652ef69000-7f652ef6a000 ---p 00000000 00:00 0 
7f652ef6a000-7f652f00b000 rw-p 00000000 00:00 0 
7f652f00b000-7f652f00c000 ---p 00000000 00:00 0 
7f652f00c000-7f652f0ad000 rw-p 00000000 00:00 0 
7f652f0ad000-7f652f0ae000 ---p 00000000 00:00 0 
7f652f0ae000-7f652f14f000 rw-p 00000000 00:00 0 
7f652f14f000-7f652f150000 ---p 00000000 00:00 0 
7f652f150000-7f652f1f1000 rw-p 00000000 00:00 0 
7f652f1f1000-7f652f1f2000 ---p 00000000 00:00 0 
7f652f1f2000-7f6531401000 rw-p 00000000 00:00 0 
7f6531401000-7f6531410000 r--p 00000000 fe:01 784857                     /usr/lib/x86_64-linux-gnu/libm-2.31.so
7f6531410000-7f65314aa000 r-xp 0000f000 fe:01 784857                     /usr/lib/x86_64-linux-gnu/libm-2.31.so
7f65314aa000-7f6531543000 r--p 000a9000 fe:01 784857                     /usr/lib/x86_64-linux-gnu/libm-2.31.so
7f6531543000-7f6531544000 r--p 00141000 fe:01 784857                     /usr/lib/x86_64-linux-gnu/libm-2.31.so
7f6531544000-7f6531545000 rw-p 00142000 fe:01 784857                     /usr/lib/x86_64-linux-gnu/libm-2.31.so
7f6531545000-7f6531547000 r--p 00000000 fe:01 783888                     /usr/lib/x86_64-linux-gnu/libcrypt.so.1.1.0
7f6531547000-7f653155c000 r-xp 00002000 fe:01 783888                     /usr/lib/x86_64-linux-gnu/libcrypt.so.1.1.0
7f653155c000-7f6531576000 r--p 00017000 fe:01 783888                     /usr/lib/x86_64-linux-gnu/libcrypt.so.1.1.0
7f6531576000-7f6531577000 r--p 00030000 fe:01 783888                     /usr/lib/x86_64-linux-gnu/libcrypt.so.1.1.0
7f6531577000-7f6531578000 rw-p 00031000 fe:01 783888                     /usr/lib/x86_64-linux-gnu/libcrypt.so.1.1.0
7f6531578000-7f6531582000 rw-p 00000000 00:00 0 
7f6531582000-7f6531583000 r--p 00000000 fe:01 784856                     /usr/lib/x86_64-linux-gnu/libdl-2.31.so
7f6531583000-7f6531585000 r-xp 00001000 fe:01 784856                     /usr/lib/x86_64-linux-gnu/libdl-2.31.so
7f6531585000-7f6531586000 r--p 00003000 fe:01 784856                     /usr/lib/x86_64-linux-gnu/libdl-2.31.so
7f6531586000-7f6531587000 r--p 00003000 fe:01 784856                     /usr/lib/x86_64-linux-gnu/libdl-2.31.so
7f6531587000-7f6531588000 rw-p 00004000 fe:01 784856                     /usr/lib/x86_64-linux-gnu/libdl-2.31.so
7f6531588000-7f6531593000 r--p 00000000 fe:01 786362                     /usr/lib/x86_64-linux-gnu/libgmp.so.10.4.1
7f6531593000-7f65315ef000 r-xp 0000b000 fe:01 786362                     /usr/lib/x86_64-linux-gnu/libgmp.so.10.4.1
7f65315ef000-7f6531606000 r--p 00067000 fe:01 786362                     /usr/lib/x86_64-linux-gnu/libgmp.so.10.4.1
7f6531606000-7f6531607000 ---p 0007e000 fe:01 786362                     /usr/lib/x86_64-linux-gnu/libgmp.so.10.4.1
7f6531607000-7f6531608000 r--p 0007e000 fe:01 786362                     /usr/lib/x86_64-linux-gnu/libgmp.so.10.4.1
7f6531608000-7f6531609000 rw-p 0007f000 fe:01 786362                     /usr/lib/x86_64-linux-gnu/libgmp.so.10.4.1
7f6531609000-7f653160c000 r--p 00000000 fe:01 785076                     /usr/lib/x86_64-linux-gnu/librt-2.31.so
7f653160c000-7f6531610000 r-xp 00003000 fe:01 785076                     /usr/lib/x86_64-linux-gnu/librt-2.31.so
7f6531610000-7f6531611000 r--p 00007000 fe:01 785076                     /usr/lib/x86_64-linux-gnu/librt-2.31.so
7f6531611000-7f6531612000 ---p 00008000 fe:01 785076                     /usr/lib/x86_64-linux-gnu/librt-2.31.so
7f6531612000-7f6531613000 r--p 00008000 fe:01 785076                     /usr/lib/x86_64-linux-gnu/librt-2.31.so
7f6531613000-7f6531614000 rw-p 00009000 fe:01 785076                     /usr/lib/x86_64-linux-gnu/librt-2.31.so
7f6531614000-7f653161b000 r--p 00000000 fe:01 784880                     /usr/lib/x86_64-linux-gnu/libpthread-2.31.so
7f653161b000-7f653162b000 r-xp 00007000 fe:01 784880                     /usr/lib/x86_64-linux-gnu/libpthread-2.31.so
7f653162b000-7f6531630000 r--p 00017000 fe:01 784880                     /usr/lib/x86_64-linux-gnu/libpthread-2.31.so
7f6531630000-7f6531631000 r--p 0001b000 fe:01 784880                     /usr/lib/x86_64-linux-gnu/libpthread-2.31.so
7f6531631000-7f6531632000 rw-p 0001c000 fe:01 784880                     /usr/lib/x86_64-linux-gnu/libpthread-2.31.so
7f6531632000-7f6531636000 rw-p 00000000 00:00 0 
7f6531636000-7f653165b000 r--p 00000000 fe:01 784855                     /usr/lib/x86_64-linux-gnu/libc-2.31.so
7f653165b000-7f65317a6000 r-xp 00025000 fe:01 784855                     /usr/lib/x86_64-linux-gnu/libc-2.31.so
7f65317a6000-7f65317f0000 r--p 00170000 fe:01 784855                     /usr/lib/x86_64-linux-gnu/libc-2.31.so
7f65317f0000-7f65317f1000 ---p 001ba000 fe:01 784855                     /usr/lib/x86_64-linux-gnu/libc-2.31.so
7f65317f1000-7f65317f4000 r--p 001ba000 fe:01 784855                     /usr/lib/x86_64-linux-gnu/libc-2.31.so
7f65317f4000-7f65317f7000 rw-p 001bd000 fe:01 784855                     /usr/lib/x86_64-linux-gnu/libc-2.31.so
7f65317f7000-7f65317fb000 rw-p 00000000 00:00 0 
7f65317fb000-7f6531828000 r--p 00000000 fe:01 788032                     /usr/lib/x86_64-linux-gnu/libruby-2.7.so.2.7.4
7f6531828000-7f6531a3d000 r-xp 0002d000 fe:01 788032                     /usr/lib/x86_64-linux-gnu/libruby-2.7.so.2.7.4
7f6531a3d000-7f6531b35000 r--p 00242000 fe:01 788032                     /usr/lib/x86_64-linux-gnu/libruby-2.7.so.2.7.4
7f6531b35000-7f6531b3e000 r--p 00339000 fe:01 788032                     /usr/lib/x86_64-linux-gnu/libruby-2.7.so.2.7.4
7f6531b3e000-7f6531b3f000 rw-p 00342000 fe:01 788032                     /usr/lib/x86_64-linux-gnu/libruby-2.7.so.2.7.4
7f6531b3f000-7f6531b5c000 rw-p 00000000 00:00 0 
7f6531b5e000-7f6531b60000 r--p 00000000 fe:01 785465                     /usr/lib/x86_64-linux-gnu/libuuid.so.1.3.0
7f6531b60000-7f6531b64000 r-xp 00002000 fe:01 785465                     /usr/lib/x86_64-linux-gnu/libuuid.so.1.3.0
7f6531b64000-7f6531b65000 r--p 00006000 fe:01 785465                     /usr/lib/x86_64-linux-gnu/libuuid.so.1.3.0
7f6531b65000-7f6531b66000 r--p 00006000 fe:01 785465                     /usr/lib/x86_64-linux-gnu/libuuid.so.1.3.0
7f6531b66000-7f6531b67000 rw-p 00007000 fe:01 785465                     /usr/lib/x86_64-linux-gnu/libuuid.so.1.3.0
7f6531b67000-7f6531b68000 r--p 00000000 fe:01 816039                     /usr/lib/x86_64-linux-gnu/ruby/2.7.0/monitor.so
7f6531b68000-7f6531b69000 r-xp 00001000 fe:01 816039                     /usr/lib/x86_64-linux-gnu/ruby/2.7.0/monitor.so
7f6531b69000-7f6531b6a000 r--p 00002000 fe:01 816039                     /usr/lib/x86_64-linux-gnu/ruby/2.7.0/monitor.so
7f6531b6a000-7f6531b6b000 r--p 00002000 fe:01 816039                     /usr/lib/x86_64-linux-gnu/ruby/2.7.0/monitor.so
7f6531b6b000-7f6531b6c000 rw-p 00003000 fe:01 816039                     /usr/lib/x86_64-linux-gnu/ruby/2.7.0/monitor.so
7f6531b6c000-7f6531b6d000 r--p 00000000 fe:01 815313                     /usr/lib/x86_64-linux-gnu/ruby/2.7.0/enc/trans/transdb.so
7f6531b6d000-7f6531b6f000 r-xp 00001000 fe:01 815313                     /usr/lib/x86_64-linux-gnu/ruby/2.7.0/enc/trans/transdb.so
7f6531b6f000-7f6531b70000 r--p 00003000 fe:01 815313                     /usr/lib/x86_64-linux-gnu/ruby/2.7.0/enc/trans/transdb.so
7f6531b70000-7f6531b71000 r--p 00003000 fe:01 815313                     /usr/lib/x86_64-linux-gnu/ruby/2.7.0/enc/trans/transdb.so
7f6531b71000-7f6531b72000 rw-p 00004000 fe:01 815313                     /usr/lib/x86_64-linux-gnu/ruby/2.7.0/enc/trans/transdb.so
7f6531b72000-7f6531b73000 r--p 00000000 fe:01 794148                     /usr/lib/x86_64-linux-gnu/ruby/2.7.0/enc/encdb.so
7f6531b73000-7f6531b74000 r-xp 00001000 fe:01 794148                     /usr/lib/x86_64-linux-gnu/ruby/2.7.0/enc/encdb.so
7f6531b74000-7f6531b75000 r--p 00002000 fe:01 794148                     /usr/lib/x86_64-linux-gnu/ruby/2.7.0/enc/encdb.so
7f6531b75000-7f6531b76000 r--p 00002000 fe:01 794148                     /usr/lib/x86_64-linux-gnu/ruby/2.7.0/enc/encdb.so
7f6531b76000-7f6531b77000 rw-p 00003000 fe:01 794148                     /usr/lib/x86_64-linux-gnu/ruby/2.7.0/enc/encdb.so
7f6531b77000-7f6531b78000 r--p 00000000 fe:01 784063                     /usr/lib/x86_64-linux-gnu/ld-2.31.so
7f6531b78000-7f6531b98000 r-xp 00001000 fe:01 784063                     /usr/lib/x86_64-linux-gnu/ld-2.31.so
7f6531b98000-7f6531ba0000 r--p 00021000 fe:01 784063                     /usr/lib/x86_64-linux-gnu/ld-2.31.so
7f6531ba1000-7f6531ba2000 r--p 00029000 fe:01 784063                     /usr/lib/x86_64-linux-gnu/ld-2.31.so
7f6531ba2000-7f6531ba3000 rw-p 0002a000 fe:01 784063                     /usr/lib/x86_64-linux-gnu/ld-2.31.so
7f6531ba3000-7f6531ba4000 rw-p 00000000 00:00 0 
7fffb8cbe000-7fffb94bd000 rw-p 00000000 00:00 0                          [stack]
7fffb95be000-7fffb95c2000 r--p 00000000 00:00 0                          [vvar]
7fffb95c2000-7fffb95c4000 r-xp 00000000 00:00 0                          [vdso]


./T395-ruby.sh: line 18: 784028 Done                    ( cat <<-EOF
require 'notmuch'
db = Notmuch::Database.new('$MAIL_DIR')
EOF
 cat )
     784029 Aborted                 | $NOTMUCH_RUBY -I "$NOTMUCH_BUILDDIR/bindings/ruby" > OUTPUT

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #3: merged.patch --]
[-- Type: text/x-diff, Size: 4510 bytes --]

commit 00a67f9534fc4802dd5d9624d9c173c5b0560536
Author: Felipe Contreras <felipe.contreras@gmail.com>
Date:   Tue Jun 29 14:08:33 2021 -0500

    ruby: add new Database.open_with_config
    
    In order to make use of notmuch_database_open_with_config.
    
    Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>

diff --git a/bindings/ruby/database.c b/bindings/ruby/database.c
index 9c3dbd96..f885c66c 100644
--- a/bindings/ruby/database.c
+++ b/bindings/ruby/database.c
@@ -118,6 +118,68 @@ notmuch_rb_database_open (int argc, VALUE *argv, VALUE klass)
     return rb_ensure (rb_yield, obj, notmuch_rb_database_close, obj);
 }
 
+/*
+ * call-seq: Notmuch::Database.open_with_config([database_path:, mode:, config_path:, profile:]) [{|db| ... }]
+ *
+ * Opens a database with a configuration file.
+ *
+ */
+VALUE
+notmuch_rb_database_open_with_config (int argc, VALUE *argv, VALUE klass)
+{
+    VALUE obj;
+    notmuch_database_t *db;
+    notmuch_status_t ret;
+    VALUE opts;
+    const char *database_path = NULL;
+    notmuch_database_mode_t mode = NOTMUCH_DATABASE_MODE_READ_ONLY;
+    const char *config_path = NULL;
+    const char *profile = NULL;
+
+    rb_scan_args (argc, argv, ":", &opts);
+
+    if (!NIL_P (opts)) {
+	VALUE rdatabase_path, rmode, rconfig_path, rprofile;
+	VALUE kwargs[4];
+	static ID keyword_ids[4];
+
+	if (!keyword_ids[0]) {
+	    keyword_ids[0] = rb_intern_const ("database_path");
+	    keyword_ids[1] = rb_intern_const ("mode");
+	    keyword_ids[2] = rb_intern_const ("config_path");
+	    keyword_ids[3] = rb_intern_const ("profile");
+	}
+
+	rb_get_kwargs (opts, keyword_ids, 0, 4, kwargs);
+
+	rdatabase_path = kwargs[0];
+	rmode = kwargs[1];
+	rconfig_path = kwargs[2];
+	rprofile = kwargs[3];
+
+	if (rdatabase_path != Qundef)
+	    database_path = nm_str (rdatabase_path);
+	if (rmode != Qundef)
+	    mode = FIX2INT (rmode);
+	if (rconfig_path != Qundef)
+	    config_path = nm_str (rconfig_path);
+	if (rprofile != Qundef)
+	    profile = nm_str (rprofile);
+    }
+
+    ret = notmuch_database_open_with_config (database_path, mode,
+					     config_path, profile, &db,
+					     NULL);
+    notmuch_rb_status_raise (ret);
+    obj = notmuch_rb_database_alloc (klass);
+    DATA_PTR (obj) = db;
+
+    if (!rb_block_given_p ())
+	return obj;
+
+    return rb_ensure (rb_yield, obj, notmuch_rb_database_close, obj);
+}
+
 /*
  * call-seq: DB.close => nil
  *
diff --git a/bindings/ruby/defs.h b/bindings/ruby/defs.h
index e2541e8f..5cc95ef2 100644
--- a/bindings/ruby/defs.h
+++ b/bindings/ruby/defs.h
@@ -56,6 +56,9 @@ extern ID ID_db_mode;
 # define RSTRING_PTR(v) (RSTRING((v))->ptr)
 #endif /* !defined (RSTRING_PTR) */
 
+/* Simple string helpers */
+#define nm_str(str) (str != Qnil ? RSTRING_PTR (str) : NULL)
+
 extern const rb_data_type_t notmuch_rb_object_type;
 extern const rb_data_type_t notmuch_rb_database_type;
 extern const rb_data_type_t notmuch_rb_directory_type;
@@ -166,6 +169,9 @@ notmuch_rb_database_initialize (int argc, VALUE *argv, VALUE klass);
 VALUE
 notmuch_rb_database_open (int argc, VALUE *argv, VALUE klass);
 
+VALUE
+notmuch_rb_database_open_with_config (int argc, VALUE *argv, VALUE klass);
+
 VALUE
 notmuch_rb_database_close (VALUE self);
 
diff --git a/bindings/ruby/init.c b/bindings/ruby/init.c
index cd9f04cd..d81101c7 100644
--- a/bindings/ruby/init.c
+++ b/bindings/ruby/init.c
@@ -265,6 +265,7 @@ Init_notmuch (void)
     notmuch_rb_cDatabase = rb_define_class_under (mod, "Database", rb_cObject);
     rb_define_alloc_func (notmuch_rb_cDatabase, notmuch_rb_database_alloc);
     rb_define_singleton_method (notmuch_rb_cDatabase, "open", notmuch_rb_database_open, -1); /* in database.c */
+    rb_define_singleton_method (notmuch_rb_cDatabase, "open_with_config", notmuch_rb_database_open_with_config, -1); /* in database.c */
     rb_define_method (notmuch_rb_cDatabase, "initialize", notmuch_rb_database_initialize, -1); /* in database.c */
     rb_define_method (notmuch_rb_cDatabase, "destroy!", notmuch_rb_database_destroy, 0); /* in database.c */
     rb_define_method (notmuch_rb_cDatabase, "close", notmuch_rb_database_close, 0); /* in database.c */
diff --git a/test/T395-ruby.sh b/test/T395-ruby.sh
index e828efed..9a1df913 100755
--- a/test/T395-ruby.sh
+++ b/test/T395-ruby.sh
@@ -100,4 +100,10 @@ q.search_threads.each do |t|
 end
 EOF
 
+test_begin_subtest "open with config"
+echo "$MAIL_DIR" > EXPECTED
+test_ruby <<EOF
+puts Notmuch::Database.open_with_config.path
+EOF
+
 test_done

[-- Attachment #4: Type: text/plain, Size: 0 bytes --]



^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2021-08-21 14:20 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-29 19:08 [PATCH v2 0/3] ruby: add latest config API Felipe Contreras
2021-06-29 19:08 ` [PATCH v2 1/3] ruby: add new Database.open_with_config Felipe Contreras
2021-08-21 14:20   ` David Bremner
2021-06-29 19:08 ` [PATCH v2 2/3] ruby: add db.config Felipe Contreras
2021-06-29 19:08 ` [PATCH v2 3/3] ruby: make db.config return an enumerator Felipe Contreras

Code repositories for project(s) associated with this inbox:

	notmuch.git.git (no URL configured)

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).