Skip Menu |

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

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

People
Owner: DJKERNEN__NO_SOLICITING__ [...] cpan.org
Requestors: mike [...] cathey.us
sjfralic [...] ecs.syr.edu
Cc:
AdminCc:

Bug Information
Severity: Important
Broken in: 2.2.7
Fixed in: (no value)



Subject: Migrate Bug
I'm using Perl 5.6.1 on Solaris 8. I'm migrating messages from a UW server to a Groupwise server. Often times the migrate function doesn't work properly. It starts going, then hangs up. I ran with debugging and found something a little weird. Just before it goes crazy, the APPEND line looks a bit messed up: Sending: 91 APPEND sent-mail () "11-Oct-2002 15:23:08 -0400" {48431} Then I get a ton of: migrate: response from target server: 91 BAD APPEND <END> The message that produces the bad APPEND line's FETCH INTERNALDATE looks fine though: Read: * 45 FETCH (INTERNALDATE "11-Oct-2002 15:23:08 -0400") I can send you the full debugging output if you'd like, let me know.
It sounds like a parsing error, but I've not had this one reported before. Yes, please send me the debugging info and I'll take a look at it. -- Thanks, Dave K.
This was an easy one to track down. I could tell what was going on as soon as I looked at the debugging output. (Thanks for sending it by the way!) It looks like you would see this problem for any message that was unread. Actually it happens when no flags are set on a message (except perhaps for \Recent which I deliberately ignore), but that can only happen on unread messages because reading them sets a flag. I've fixed this in the next release, but I'm not sure when I'll be submitting that release to CPAN. (So far your fix is the only new thing in it.) In the meantime, you can apply the enclosed patch. If you still have your installation directory around from when you installed Mail::IMAPClient, you can apply the patch as follows: cd $install_dir patch -i imapclient-patch-ticket-2108.diff IMAPClient.pm make make test # optional make install If you don't have the install directory around (and you might not if you used -MCPAN) then you can just find the IMAPClient.pm file in your @INC and update that by cd'ing to the directory where it resides and running the patch command as above (but not the make's). Please let me know how you make out so I can close this ticket. -- Thanks, Dave K.
744a745 > $flags = "" if $flags eq "()" ;
From: rodger [...] its.uct.ac.za
Helo, Show quoted text
> any message that was unread. Actually it happens when no flags are set > on a message (except > perhaps for \Recent which I deliberately ignore), but that can only
In addition to adding: $flags = "" if $flags eq "()" ; I needed to change: my $pstring = "$ptrans APPEND " . $self->Massage($folder) . " $flags $intDate {" . $size . "}" ; to: my $pstring = "$ptrans APPEND " . $self->Massage($folder) . ($flags ne ""?" $flags":""). ($intDate ne ""?" $intDate":""). " {" . $size . "}" ; at 797 before this would work. For some reason the extra space included when $flag was empty in the APPEND command was throwing a BAD tag response back. [Imap server is Cyrus 2.0.16] Cheerio Rodger
Subject: Mail::IMAPClient->migrate() problem
From: Mike Cathey <mike [...] cathey.us>
To: bug-Mail-IMAPClient [...] rt.cpan.org
Date: 29 Apr 2003 17:22:05 -0400
David, I've been banging my head against the wall trying to get migrate to work. Am I doing something wrong? Here's all the relevant info I can think of: ____SNIP____ $ perl -v This is perl, v5.6.1 built for sparc-linu Copyright 1987-2001, Larry Wall Perl may be copied only under the terms of either the Artistic License or the GNU General Public License, which may be found in the Perl 5 source kit. Complete documentation for Perl, including FAQ lists, should be found on this system using `man perl' or `perldoc perl'. If you have access to the Internet, point your browser at http://www.perl.com/, the Perl Home Page. pointer@smilingman:~$ uname -a Linux smilingman 2.4.21-pre7 #2 SMP Tue Apr 15 18:57:28 EDT 2003 sparc64 unknown ____SNIP____ I have a perl script (below) called "change_username.pl" that is _supposed to login to the cyrus server as 'cyrus' and select 2 mailboxes (src/dst) and do a migrate between them. This probalbly isn't a problem with your code, but I figured you might be able to help me out. :) ____SNIP____ change_username.pl #!/usr/bin/perl use Mail::IMAPClient; my $login = "cyrus"; my $pass = "xxxxxxxxx"; my $imaphost = "localhost"; my $folderold = "user/pointer1"; my $foldernew = "user/spamisbad"; eval { $imapold = Mail::IMAPClient->new( Server => $imaphost, User => $login, Password=> $pass, Debug => 1, ) or die "Can't connect to $imaphost: $@!"; my $Authenticated = $imapold->Authenticated(); print "imapold authenticated = " . $Authenticated . "\n"; # print join(", ",$imapold->folders),".\n"; }; $imapold->connect or die "Could not connect: $@\n"; if ($@) { print "Error: $@\n"; } eval { $imapold->select($folderold); }; if ($@) { print "Error: $@\n"; } eval { $imapnew = Mail::IMAPClient->new( Server => $imaphost, User => $login, Password=> $pass, Debug => 1, ) or die "Can't connect to $imaphost: $@!"; my $Authenticated = $imapnew->Authenticated(); print "imapnew authenticated = " . $Authenticated . "\n"; # print join(", ",$imapnew->folders),".\n"; }; if ($@) { print "Error: $@\n"; } eval { $imapnew->select($foldernew); }; if ($@) { print "Error: $@\n"; } print "The destination mailbox is "; if ($imapnew->isConnected) { print "connected.\n"; } else { print "not connected\n"; } # $imapold->migrate($imapnew, "ALL", $foldernew ) $imapold->migrate($imapnew, "ALL", "user/spamisbad" ) or die "Could not migrate: $@\n"; # logout and close the conn $imapold->logout or die "Could not logout: $@\n"; $imapnew->logout or die "Could not logout: $@\n"; ____SNIP____ Here's the output from running this script: ____SNIP____ Using Mail::IMAPClient version 2.1.4 and perl version 5.6.1 (5.006001) Read: * OK smilingman Cyrus IMAP4 v2.1.12-Debian-2.1.12-0woody.11.0 server ready^M Connect: Received this from readline: 0/OUTPUT/* OK smilingman Cyrus IMAP4 v2.1.12-Debian-2.1.12-0woody.11.0 server ready^M Sending: 1 Login "XXXXXXX" "XXXXXXX"^M Sent 27 bytes Read: 1 OK User logged in^M Read: * OK smilingman Cyrus IMAP4 v2.1.12-Debian-2.1.12-0woody.11.0 server ready^M Connect: Received this from readline: 2/OUTPUT/* OK smilingman Cyrus IMAP4 v2.1.12-Debian-2.1.12-0woody.11.0 server ready^M Sending: 2 Login "XXXXXXX" "XXXXXXX"^M Sent 27 bytes Read: 2 OK User logged in^M Sending: 3 SELECT "user/pointer1"^M Sent 26 bytes Read: * FLAGS (\Answered \Flagged \Draft \Deleted \Seen)^M * OK [PERMANENTFLAGS (\Answered \Flagged \Draft \Deleted \Seen \*)] ^M * 6 EXISTS^M * 0 RECENT^M * OK [UNSEEN 1] ^M * OK [UIDVALIDITY 1051570238] ^M * OK [UIDNEXT 7] ^M 3 OK [READ-WRITE] Completed^M Using Mail::IMAPClient version 2.1.4 and perl version 5.6.1 (5.006001) Read: * OK smilingman Cyrus IMAP4 v2.1.12-Debian-2.1.12-0woody.11.0 server ready^M Connect: Received this from readline: 0/OUTPUT/* OK smilingman Cyrus IMAP4 v2.1.12-Debian-2.1.12-0woody.11.0 server ready^M Sending: 1 Login "XXXXXXX" "XXXXXXX"^M Sent 27 bytes Read: 1 OK User logged in^M Sending: 2 SELECT "user/spamisbad"^M Sent 27 bytes Read: * FLAGS (\Answered \Flagged \Draft \Deleted \Seen)^M * OK [PERMANENTFLAGS (\Answered \Flagged \Draft \Deleted \Seen \*)] ^M * 0 EXISTS^M * 0 RECENT^M * OK [UIDVALIDITY 1051289796] ^M * OK [UIDNEXT 1] ^M 2 OK [READ-WRITE] Completed^M Sending: 3 isConnected^M Sent 15 bytes Read: 3 BAD Unrecognized command^M Sending: 4 isConnected^M Sent 15 bytes Read: 4 BAD Unrecognized command^M Could not migrate: Invalid or unconnected Mail::IMAPClient object used as target for migrate. imapold authenticated = 2 imapnew authenticated = 2 The destination mailbox is not connected ____SNIP____ It shows the second instance of MAIL::IMAPClient logging in and selecting the mailbox, but then it says it's not connected. Am I doing something wrong here? Any help would be greatly appreciated. Thanks, Mike -- Mike Cathey <mike@cathey.us>
Download signature.asc
application/pgp-signature 189b

Message body not shown because it is not plain text.

Subject: Re: [cpan #2455] AutoReply: Mail::IMAPClient->migrate() problem
From: Mike Cathey <mike [...] cathey.us>
To: bug-Mail-IMAPClient [...] rt.cpan.org
Date: 30 Apr 2003 10:36:48 -0400
RT-Send-Cc:
On Tue, 2003-04-29 at 17:22, Mail-IMAPClient wrote: Show quoted text
> ------------------------------------------------------------------------- > Here's the output from running this script: > > ____SNIP____ > Using Mail::IMAPClient version 2.1.4 and perl version 5.6.1 (5.006001)
*smacks self* I updated to the latest version on cpan: ____SNIP____ Using Mail::IMAPClient version 2.2.7 and perl version 5.6.1 (5.006001) ____SNIP____ It's working, however, it's not setting the seen state (other states?) on the messages it copies to the destination folder. I'll munge around and try to fix that... Another object method that does a recursive migrate could be very useful. Cheers, Mike -- Mike Cathey <mike@cathey.us>
Download signature.asc
application/pgp-signature 189b

Message body not shown because it is not plain text.

Subject: Re: [cpan #2455] AutoReply: Mail::IMAPClient->migrate() problem
From: Mike Cathey <mike [...] cathey.us>
To: bug-Mail-IMAPClient [...] rt.cpan.org
Date: 30 Apr 2003 10:59:11 -0400
RT-Send-Cc:
Figured out the seen state issue. It was on my end. Cheers, Mike -- Mike Cathey <mike@cathey.us>
Download signature.asc
application/pgp-signature 189b

Message body not shown because it is not plain text.

Subject: Re: [cpan #2455] AutoReply: Mail::IMAPClient->migrate() problem
From: Mike Cathey <mike [...] cathey.us>
To: bug-Mail-IMAPClient [...] rt.cpan.org
CC: noc [...] catt.com
Date: 30 Apr 2003 13:16:11 -0400
RT-Send-Cc:
Actually, there is a bug. If the message didn't need to be split up, it wasn't passing the flags to the $peer->append_string call. Here's a diff: ____SNIP____ diff -u /usr/local/share/perl/5.6.1/Mail/IMAPClient.pm IMAPClient.pm --- /usr/local/share/perl/5.6.1/Mail/IMAPClient.pm Wed Apr 30 13:12:47 2003 +++ IMAPClient.pm Wed Apr 30 10:39:52 2003 @@ -751,7 +751,7 @@ # transaction: if ( $size <= $bufferSize ) { my $new_mid = $peer->append_string($peer->Massage($folder), - $self->message_string($mid) , $flags, + $self->message_string($mid) ,undef, $intDate) ; $self->_debug("Copied message $mid in folder $folder to " . $peer->User . ____SNIP____ Cheers, Mike -- Mike Cathey <mike@cathey.us>
Download signature.asc
application/pgp-signature 189b

Message body not shown because it is not plain text.

Sorry for the delay; your report came in while I was on vacation. There is no method named isConnected; however there is a method named IsConnected. See the pod for more info. Cheers, Dave K.
From: pointer [...] catt.com
[DJKERNEN - Thu May 29 13:30:53 2003]: Show quoted text
> Sorry for the delay; your report came in while I was on vacation. > > There is no method named isConnected; however there is a method named > IsConnected. See the pod for more info. > > Cheers, > Dave K.
There is a bug, please see the diff in my email on: Wed Apr 30 13:16:26 2003 When moving large messages, migrate uses a separate section of code from small messages, one of the 2 (I forget which now) wasn't setting the flags on the destination server--it was passing undef. Cheers, Mike