Skip Menu |

This queue is for tickets about the Mail-IMAPClient CPAN distribution.

Report information
The Basics
Id: 91912
Status: resolved
Priority: 0/
Queue: Mail-IMAPClient

People
Owner: PLOBBES [...] cpan.org
Requestors: david.karnowski [...] wisc.edu
gilles.lamiral [...] laposte.net
justinvallon [...] gmail.com
Cc:
AdminCc:

Bug Information
Severity: Normal
Broken in: 3.29
Fixed in: 3.36



Subject: selectable bug: \b\\Noselect\b never matches, always returns true
Date: Mon, 06 Jan 2014 23:37:32 -0500
To: bug-Mail-IMAPClient [...] rt.cpan.org
From: Justin Vallon <justinvallon [...] gmail.com>
When I call $server->selectable('INBOX.Archives.2014'), debug shows: Sending: 2 LIST "" INBOX.Archives.2014 Sent 31 bytes Read: * LIST (\Noselect \HasChildren) "." "INBOX.Archives.2014" 2 OK LIST completed But, it returns 1. IMAPClient.pm version 3.35: sub selectable { my ( $self, $f ) = @_; my $info = $self->list( "", $f ) or return undef; return not( grep /\b\\Noselect\b/i, @$info ); } The \b is not matching. Here is where \b matches in the LIST output line: * {b}LIST{b} (\{b}Noselect{b} \{b}HasChildren{b}) "." "{b}INBOX{b}.{b}Archives{b}.{b}2014{b}" Maybe change \b to [paren space]: $ git diff diff --git a/lib/Mail/IMAPClient.pm b/lib/Mail/IMAPClient.pm index 6e77c85..632e1a7 100644 --- a/lib/Mail/IMAPClient.pm +++ b/lib/Mail/IMAPClient.pm @@ -2880,7 +2880,7 @@ sub is_parent { sub selectable { my ( $self, $f ) = @_; my $info = $self->list( "", $f ) or return undef; - return not( grep /\b\\Noselect\b/i, @$info ); + return not( grep /[\s(]\\Noselect[)\s]/i, @$info ); } # append( $self, $folder, $text [, $optmsg] ) With this change, selectable returns 0 for INBOX.Archives.2014. -- -Justin JustinVallon@gmail.com
Download smime.p7s
application/pkcs7-signature 4.1k

Message body not shown because it is not plain text.

Subject: Re: [imapsync] Dovecot mbox format - Mailbox isn't selectable. Mail::IMAPClient sub selectable()
Date: Sat, 1 Aug 2015 19:29:37 +0200
To: David Karnowski <david.karnowski [...] wisc.edu>, imapsync [...] linux-france.org, bug-Mail-IMAPClient [...] rt.cpan.org
From: Gilles LAMIRAL <gilles.lamiral [...] laposte.net>
Hi David and Phil, I guess it is that string LIST (\Noselect \HasChildren) "/" Archive does not match grep /\b\\Noselect\b/i in sub selectable(), because of the first \b It looks like a Mail::IMAPClient bug in sub selectable() Removing the first \b should fix this issue. Like this: - grep /\b\\Noselect\b/i + grep /\Noselect\b/i I'm not sure of that because I don't know what returns $self->list( "", $f ) but if it is the case then the last \b is also buggy so the final fix should be - grep /\b\\Noselect\b/i + grep /\Noselect/i Maybe there is also this solution - grep /\b\\Noselect\b/i + grep /(\b|\()\Noselect(\b|\))/i taking care of (). I prefer the first and simpler one. Thanks in advance Phil, Keep the good work! Le 01/08/2015 04:36, Gilles LAMIRAL a écrit : Show quoted text
> Hi David, >
>> The folders show up in LSUB, but in LIST they show the following: >> * LIST (\Noselect \HasChildren) "/" Archive >> * LIST (\Noselect \HasChildren) "/" Archive/Sent >> >> We are using --errorsmax so that we can detect and get around Microsoft Office365 IMAP throttling (by switching to a different privileged account). So ignoring these errors is somewhat complicated. >> >> Is there a good way to skip folders with a certain flag (e.g. "\Noselect")
> > > imapsync already does this. > So I wonder what happens in your case. > > > $checkselectable and do { > my @h1_folders_wanted_selectable ; > foreach my $folder ( @h1_folders_wanted ) { > $debug and print "Checking $folder is selectable on host1\n" ; > if ( not $imap1->selectable( $folder ) ) { > print "Warning: ignoring folder $folder because it is not selectable\n" ; > }else{ > push( @h1_folders_wanted_selectable, $folder ) ; > } > } > @h1_folders_wanted = @h1_folders_wanted_selectable ; > } ; > > From Mail::IMAPClient > sub selectable { > my ( $self, $f ) = @_; > my $info = $self->list( "", $f ) or return undef; > return not( grep /\b\\Noselect\b/i, @$info ); > } > >
-- Au revoir, 09 51 84 42 42 Gilles Lamiral. France, Baulon (35580) 06 20 79 76 06
Sorry for the incredibly long delay. I've applied a fix for this in 3.36_03 (beta / pre-release code). And this will be in the official 3.36 release once that is ready to go.
Merging this with ticket #91912 which was the original report of this problem. This issue will be fixed with the next release which should be soon-ish after a few other open tickets get resolved. In the mean time, the fix is available via git on sourceforge and/or github.
Subject: Re: [rt.cpan.org #106187] Re: [imapsync] Dovecot mbox format - Mailbox isn't selectable. Mail::IMAPClient sub selectable()
Date: Mon, 3 Aug 2015 18:53:24 +0200
To: bug-Mail-IMAPClient [...] rt.cpan.org
From: Gilles LAMIRAL <gilles.lamiral [...] laposte.net>
Thanks Phil! Don't forget to go on holidays! Le 03/08/2015 06:35, Phil Pearl (Lobbes) via RT a écrit : Show quoted text
> <URL: https://rt.cpan.org/Ticket/Display.html?id=106187 > > > Merging this with ticket #91912 which was the original report of this problem. This issue will be fixed with the next release which should be soon-ish after a few other open tickets get resolved. In the mean time, the fix is available via git on sourceforge and/or github. >
-- Au revoir, 09 51 84 42 42 Gilles Lamiral. France, Baulon (35580) 06 20 79 76 06
Subject: Re: [imapsync] Dovecot mbox format - Mailbox isn't selectable. Mail::IMAPClient sub selectable()
Date: Mon, 03 Aug 2015 14:10:54 -0500
To: Gilles LAMIRAL <gilles.lamiral [...] laposte.net>, "imapsync [...] linux-france.org" <imapsync [...] linux-france.org>, "bug-Mail-IMAPClient [...] rt.cpan.org" <bug-Mail-IMAPClient [...] rt.cpan.org>
From: David Karnowski <david.karnowski [...] wisc.edu>
Patching IMAPClient does the trick. - return not( grep /\b\\Noselect\b/i, @$info ); + return not( grep /[\s(]\\Noselect[)\s]/i, @$info ); Thanks, Gilles and Phil! --Dave On 8/1/2015 12:29 PM, Gilles LAMIRAL wrote: Show quoted text
> Hi David and Phil, > > I guess it is that string > > LIST (\Noselect \HasChildren) "/" Archive > > does not match > > grep /\b\\Noselect\b/i > > in sub selectable(), because of the first \b > > It looks like a Mail::IMAPClient bug in sub selectable() > Removing the first \b should fix this issue. Like this: > > - grep /\b\\Noselect\b/i > + grep /\Noselect\b/i > > I'm not sure of that because I don't know what returns > $self->list( "", $f ) > but if it is the case then the last \b is also buggy > so the final fix should be > > - grep /\b\\Noselect\b/i > + grep /\Noselect/i > > Maybe there is also this solution > > - grep /\b\\Noselect\b/i > + grep /(\b|\()\Noselect(\b|\))/i > > taking care of (). I prefer the first and simpler one. > > Thanks in advance Phil, > Keep the good work! > > Le 01/08/2015 04:36, Gilles LAMIRAL a écrit :
>> Hi David, >>
>>> The folders show up in LSUB, but in LIST they show the following: >>> * LIST (\Noselect \HasChildren) "/" Archive >>> * LIST (\Noselect \HasChildren) "/" Archive/Sent >>> >>> We are using --errorsmax so that we can detect and get around Microsoft Office365 IMAP throttling (by switching to a different privileged account). So ignoring these errors is somewhat complicated. >>> >>> Is there a good way to skip folders with a certain flag (e.g. "\Noselect")
>> >> >> imapsync already does this. >> So I wonder what happens in your case. >> >> >> $checkselectable and do { >> my @h1_folders_wanted_selectable ; >> foreach my $folder ( @h1_folders_wanted ) { >> $debug and print "Checking $folder is selectable on host1\n" ; >> if ( not $imap1->selectable( $folder ) ) { >> print "Warning: ignoring folder $folder because it is not selectable\n" ; >> }else{ >> push( @h1_folders_wanted_selectable, $folder ) ; >> } >> } >> @h1_folders_wanted = @h1_folders_wanted_selectable ; >> } ; >> >> From Mail::IMAPClient >> sub selectable { >> my ( $self, $f ) = @_; >> my $info = $self->list( "", $f ) or return undef; >> return not( grep /\b\\Noselect\b/i, @$info ); >> } >> >>
>