Konstantin Ryabitsev <konstan...@linuxfoundation.org> wrote:
> On Tue, Sep 14, 2021 at 10:10:36PM +0000, Eric Wong wrote:
> > Konstantin Ryabitsev <konstan...@linuxfoundation.org> wrote:
> > >   2021-09-14T20:59:12Z 20428 20428 die: BUG: 
> > > imaps://imap.migadu.com/lore/b4;UIDVALIDITY=1621977334 has no UIDVALIDITY 
> > > at /usr/local/share/perl/5.32.1/PublicInbox/LeiStore.pm line 313.
> > >    (from nowait set_sync_info)
> > 
> > Same bug, different place :x
> > --------8<------
> > Subject: [PATCH] uri_imap: fix ->uidvalidity and ->uid w/ `/' separator
> > 
> > Again, we were failing to account for '/' use in mailbox names :x
> 
> The error is gone, but the saved search still doesn't show up when I run
> "lei ls-search". Looking in .local/share/lei/saved-searches, I see that they
> still get created as lore/foldername-${checksum}, which is probably why
> ls-search doesn't find them?

Ah, it's because the "foldername" part was incorrectly parsed
and it should be .local/share/lei/saved-searches/foldername-$checksum
without the "lore/" parent.

Once patched with the below, you should be able to move the
folder up a level and remove the now-empty "lore" dir inside
saved-searches.

Anyways, I think this fixes it:
---------8<---------
Subject: [PATCH] lei_saved_search: fix prefix for IMAP folders w/ slash

We failed to account for IMAP mailboxes containing `/'
characters when creating saved search files for them.

Reported-by: Konstantin Ryabitsev <konstan...@linuxfoundation.org>
Link: 
https://public-inbox.org/meta/20210915123347.knr4qpaei73tjc5q@meerkat.local/
---
 lib/PublicInbox/LeiSavedSearch.pm | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/lib/PublicInbox/LeiSavedSearch.pm 
b/lib/PublicInbox/LeiSavedSearch.pm
index 8ceaaf01..96ff816e 100644
--- a/lib/PublicInbox/LeiSavedSearch.pm
+++ b/lib/PublicInbox/LeiSavedSearch.pm
@@ -39,21 +39,21 @@ sub cfg_dump ($$) {
 
 sub lss_dir_for ($$;$) {
        my ($lei, $dstref, $on_fs) = @_;
-       my @n;
+       my $pfx;
        if ($$dstref =~ m,\Aimaps?://,i) { # already canonicalized
                require PublicInbox::URIimap;
                my $uri = PublicInbox::URIimap->new($$dstref)->canonical;
                $$dstref = $$uri;
-               @n = ($uri->mailbox);
+               $pfx = $uri->mailbox;
        } else {
                # can't use Cwd::abs_path since dirname($$dstref) may not exist
                $$dstref = $lei->rel2abs($$dstref);
                $$dstref =~ tr!/!/!s;
-               @n = ($$dstref =~ m{([^/]+)/*\z}); # basename
+               $pfx = $$dstref;
        }
-       push @n, sha256_hex($$dstref);
+       ($pfx) = ($pfx =~ m{([^/]+)/*\z}); # basename
        my $lss_dir = $lei->share_path . '/saved-searches/';
-       my $d = $lss_dir . join('-', @n);
+       my $d = "$lss_dir$pfx-".sha256_hex($$dstref);
 
        # fall-back to looking up by st_ino + st_dev in case we're in
        # a symlinked or bind-mounted path
@@ -61,7 +61,7 @@ sub lss_dir_for ($$;$) {
                my @cur = stat(_);
                my $want = pack('dd', @cur[1,0]); # st_ino + st_dev
                my ($c, $o, @st);
-               for my $g ("$n[0]-*", '*') {
+               for my $g ("$pfx-*", '*') {
                        my @maybe = glob("$lss_dir$g/lei.saved-search");
                        for my $f (@maybe) {
                                $c = cfg_dump($lei, $f) // next;
--
unsubscribe: one-click, see List-Unsubscribe header
archive: https://public-inbox.org/meta/

Reply via email to