Paul Wise <pa...@bonedaddy.net> writes: > I think a better option is to detect if the search cache Maildir is > actually a Maildir and doesn't contain any data that could be lost. > > I have attached three patches I created to improve notmuch-mutt safety.
If possible, please use git-send-email for future series. > + my %required = map { $_ => 1 } @required; > + foreach my $d (@contents) { > + -l "$maildir/$d" and die_dir( $maildir, "contains symlink $d"); > + -d "$maildir/$d" or die_dir( $maildir, "contains non-directory $d"); > + exists($required[$d]) or die_dir( $maildir, "contains directory $d"); > + } > +} This seems to have introduced a warning, and I think there's a bug. % notmuch mutt search tag:inbox Argument "new" isn't numeric in array or hash lookup at /usr/bin/notmuch-mutt line 70. Argument "cur" isn't numeric in array or hash lookup at /usr/bin/notmuch-mutt line 70. Argument "tmp" isn't numeric in array or hash lookup at /usr/bin/notmuch-mutt line 70. If I remember correctly you need to use {} for hash references in Perl. > > # create an empty search cache maildir (if missing) or empty existing one > sub empty_search_cache_maildir($) { > my ($maildir) = (@_); > + check_search_cache_maildir($maildir); > rmtree($maildir) if (-d $maildir); > my $folder = new Mail::Box::Maildir(folder => $maildir, > create => 1); It might clearer to use the return value from (a possibly renamed check_search_cache (then the -d can be eliminated / folded into the new function). _______________________________________________ notmuch mailing list -- notmuch@notmuchmail.org To unsubscribe send an email to notmuch-le...@notmuchmail.org