rc0 / mairix

mairix is a program for indexing and searching email messages stored in Maildir, MH or mbox folders
http://www.rc0.org.uk/mairix
GNU General Public License v2.0
133 stars 24 forks source link

double slashes in output paths #37

Open greg-minshall opened 2 years ago

greg-minshall commented 2 years ago

hi. when i run mairix -r, i get an extra slash after ~/Mail/.

bash apollo2 (master): {49759} mairix -r -f ~/Mail/.mairix/config mh-e | head
/home/minshall/Mail//_06/_05/811
...

my config file looks like this:

bash apollo2 (master): {49760} cat ~/Mail/.mairix/config
base=~/Mail

# List of folders that should be indexed. 3 dots at the end means there
# are subfolders within the folder
mh=...
omit=**/mhe-index/**

database=~/Mail/.mairix/database

and, i index like this:

#!/bin/bash

mairix -f ~/Mail/.mairix/config

i'm running mairix 0.24 (but this problem has been going on for maybe six years?).

any thoughts?

greg-minshall commented 2 years ago

by the way, for what it's worth, i seem to have the following change in my copy of the git repository from 2012 (i've now rebased it on the current master):

1 file changed, 3 insertions(+)
mbox.c | 3 +++

modified   mbox.c
@@ -757,6 +757,9 @@ static void handle_one_path(const char *folder_base,
   last_comp = last_slash ? (last_slash + 1) : full_path;
   if ((len >= 4) && !strcmp(full_path + (len - 3), "...")) {
     full_path[len - 3] = '\0';
+    if (full_path[len - 4] == '/') { /* in case no name specified */
+        full_path[len - 4] = '\0';
+    }
     if (is_wild(last_comp)) {
       handle_wild(full_path, base_len, last_comp, list, append_deep, methods, omit_globs);
     } else {

i apologize -- i no longer remember what "in case no name specified" refers to. :)

this seems, for me, to fix my problem. does it help see what i, or mairix, might be doing wrong?

vandry commented 2 years ago

The comment at the top of the function (which seems to be the closest thing to documentation that this feature has) does not list plain ... as supported:

  /* Valid syntaxen ([.]=optional):
   * [xxx/]foo : single path
   * [xxx/]foo... : if foo is a file, as before; if a directory, every ordinary file under it
   * [xxx/]wild : any single path matching the wildcard
   * [xxx/]wild... : consider each match of the wildcard by the rule 2 lines above

You have ... with no foo or wild before it. Yet it seems to work for you modulo the doubled slash character, so I guess that's good for you. Your comment "in case no name specified" seems to refer to exactly this: there is no filename before the ....

That being said, the doubled slash seems cosmetic to me. Does it cause you any bugs later on down? If not, then I propose to leave it alone.

greg-minshall commented 2 years ago

hi. thanks. yes, later on code in another package (mh-e, emacs e-mail system) removes everything up to one of the slashes, and then decides to look in nmh folder +/inbox (for example), which is invalid.