Skip Menu |

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

Report information
The Basics
Id: 46388
Status: resolved
Priority: 0/
Queue: Mail-Box

People
Owner: Nobody in particular
Requestors: emike [...] bigfoot.com
Cc:
AdminCc:

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



Subject: bug using access=>'w'
Date: Tue, 26 May 2009 16:45:16 -0700
To: bug-Mail-Box [...] rt.cpan.org
From: Mike Ekberg <emike1955 [...] gmail.com>
Download test.dbx
application/octet-stream 136.1k

Message body not shown because it is not plain text.

#! /usr/bin/perl #dbx2mbox.pl <dbxfile> <mboxfile> # convert <dbxfile> to <mboxfile> $| = 1; use strict; use warnings; use diagnostics; use Mail::Transport::Dbx; use Mail::Box::Mbox; use Mail::Box::Dbx; chomp (my $dbxfile = shift); chomp (my $mboxfile = shift); system ("/bin/rm -f $mboxfile"); -e $dbxfile || die "cannot find dbxfile $dbxfile"; print "opening existing dbxfile $dbxfile\n"; my $from = Mail::Box::Dbx->new(folder => $dbxfile) or die "cannot read dbxfile $dbxfile using Mail::Box:Dbx->new:$!"; print "dbxfile $dbxfile is open\n"; print "creating mboxfile $mboxfile\n"; my $to = Mail::Box::Mbox->new(folder => $mboxfile, access => 'rw', create => 1) or die "cannot create new mbox file using Mail::Box::Mbox->new: $!"; print "mboxfile $mboxfile is created\n"; print "copying dbxfile($dbxfile) -> mboxfile($mboxfile)\n"; $from->copyTo($to) || die "from->copyTo($mboxfile) failed:$!"; exit;
Hi: I am reporting a likely bug in Mail:Box::MBox.The following example code from Mail::Box::Dbx fails in the following way:: Code: #! /usr/bin/perl #dbx2mbox.pl <dbxfile> <mboxfile> # convert <dbxfile> to <mboxfile> $| = 1; use strict; use warnings; use diagnostics; use Mail::Transport::Dbx; use Mail::Box::Mbox; use Mail::Box::Dbx; chomp (my $dbxfile = shift); chomp (my $mboxfile = shift); system ("/bin/rm -f $mboxfile"); -e $dbxfile || die "cannot find dbxfile $dbxfile"; print "opening existing dbxfile $dbxfile\n"; my $from = Mail::Box::Dbx->new(folder => $dbxfile) or die "cannot read dbxfile $dbxfile using Mail::Box:Dbx->new:$!"; print "dbxfile $dbxfile is open\n"; print "creating mboxfile $mboxfile\n"; my $to = Mail::Box::Mbox->new(folder => $mboxfile, access => 'w', create => 1) or die "cannot create new mbox file using Mail::Box::Mbox->new: $!"; print "mboxfile $mboxfile is created\n"; print "copying dbxfile($dbxfile) -> mboxfile($mboxfile)\n"; $from->copyTo($to) || die "from->copyTo($mboxfile) failed:$!"; exit; Run as: # do simple dbx test using dbxtest.pl or dbx2mbox.pl mkdir -p dbxTest /bin/rm -f dbxExamples/test.mbox dbx2mbox.pl dbxExamples/test.dbx dbxTest/test.mbox opening existing dbxfile dbxExamples/test.dbx dbxfile dbxExamples/test.dbx is open creating mboxfile dbxTest/test.mbox mboxfile dbxTest/test.mbox is created copying dbxfile(dbxExamples/test.dbx) -> mboxfile(dbxTest/test.mbox) Filehandle GEN4 opened only for output at /usr/lib/perl5/5.10/i686-cygwin/IO/Handle.pm line 421 (#1) (W io) You tried to read from a filehandle opened only for writing, If you intended it to be a read/write filehandle, you needed to open it with "+<" or "+>" or "+>>" instead of with "<" or nothing. If you intended only to read from the file, use "<". See perlfunc/open. Another possibility is that you attempted to open filedescriptor 0 (also known as STDIN) for output (maybe you closed STDIN earlier?). The above passes if I make this change: Was: my $to = Mail::Box::Mbox->new(folder => $mboxfile, access => 'w', create => 1) or die "cannot create new mbox file using Mail::Box::Mbox->new: $!"; New: my $to = Mail::Box::Mbox->new(folder => $mboxfile, access => 'rw', create => 1) or die "cannot create new mbox file using Mail::Box::Mbox->new: $!"; It is certainly possible this a problem w/ the example code that I pulled from Mail::Box::Dbx.... I'm using the following versions: Mail-Box-2.089-P2kMI9 Mail-Transport-Dbx-0.07-Sg64D2 This is all run on a fairly recent version of cygwin, perl 5/5.10. Best Regards, Mike Ekberg
Subject: Re: [rt.cpan.org #46388] bug using access=>'w'
Date: Mon, 1 Jun 2009 00:39:43 +0200
To: "emike [...] bigfoot.com via RT" <bug-Mail-Box [...] rt.cpan.org>
From: Mark Overmeer <mark [...] overmeer.net>
* emike@bigfoot.com via RT (bug-Mail-Box@rt.cpan.org) [090526 23:45]: Show quoted text
> Tue May 26 19:45:48 2009: Request 46388 was acted upon. > Transaction: Ticket created by emike@bigfoot.com > Queue: Mail-Box > Subject: bug using access=>'w' > Requestors: emike@bigfoot.com > Ticket <URL: http://rt.cpan.org/Ticket/Display.html?id=46388 >
I cannot reproduce this error under Linux. We may get a better idea what is happening if you can produce a trace. Add lines: use Carp; confess; to IO::Handle::getline, and hope to see from where in MailBox it is being called... -- Regards, MarkOv ------------------------------------------------------------------------ Mark Overmeer MSc MARKOV Solutions Mark@Overmeer.net solutions@overmeer.net http://Mark.Overmeer.net http://solutions.overmeer.net
CC: emike [...] bigfoot.com
Subject: Re: [rt.cpan.org #46388] bug using access=>'w'
Date: Mon, 01 Jun 2009 10:28:35 -0700
To: bug-Mail-Box [...] rt.cpan.org
From: Mike Ekberg <emike1955 [...] gmail.com>
Hi: Hope you can read the attached file. I added 'confess;' to the function getline in Handle.pm, ran 'make install', and then ran the test case w/ the 'w' option. (the Handle.pm already includes 'use Carp;') Mike Ekberg Mark Overmeer via RT wrote: Show quoted text
> <URL: http://rt.cpan.org/Ticket/Display.html?id=46388 > > > * emike@bigfoot.com via RT (bug-Mail-Box@rt.cpan.org) [090526 23:45]: >
>> Tue May 26 19:45:48 2009: Request 46388 was acted upon. >> Transaction: Ticket created by emike@bigfoot.com >> Queue: Mail-Box >> Subject: bug using access=>'w' >> Requestors: emike@bigfoot.com >> Ticket <URL: http://rt.cpan.org/Ticket/Display.html?id=46388 > >>
> > I cannot reproduce this error under Linux. We may get a better > idea what is happening if you can produce a trace. Add lines: > > use Carp; > confess; > > to IO::Handle::getline, and hope to see from where in MailBox it is > being called... >
opening existing dbxfile dbxExamples/test.dbx dbxfile dbxExamples/test.dbx is open creating mboxfile dbxTest/test.mbox mboxfile dbxTest/test.mbox is created copying dbxfile(dbxExamples/test.dbx) -> mboxfile(dbxTest/test.mbox) (in cleanup) at /usr/lib/perl5/5.10/i686-cygwin/IO/Handle.pm line 419 IO::Handle::getline('IO::File=GLOB(0x23063d8)') called at /usr/lib/perl5/site_perl/5.10/Mail/Box/Parser/Perl.pm line 279 Mail::Box::Parser::Perl::openFile('Mail::Box::Parser::Perl=HASH(0x23061b0)', 'HASH(0x1d84500)') called at /usr/lib/perl5/site_perl/5.10/Mail/Box/Parser.pm line 47 Mail::Box::Parser::start('Mail::Box::Parser::Perl=HASH(0x23061b0)', 'file', undef) called at /usr/lib/perl5/site_perl/5.10/Mail/Box/Parser.pm line 37 Mail::Box::Parser::init('Mail::Box::Parser::Perl=HASH(0x23061b0)', 'HASH(0x23061e0)') called at /usr/lib/perl5/site_perl/5.10/Mail/Box/Parser/Perl.pm line 22 Mail::Box::Parser::Perl::init('Mail::Box::Parser::Perl=HASH(0x23061b0)', 'HASH(0x23061e0)') called at /usr/lib/perl5/site_perl/5.10/Mail/Reporter.pm line 28 Mail::Reporter::new('Mail::Box::Parser::Perl', 'filename', 'dbxTest/test.mbox', 'mode', 'w', 'trusted', '', 'fix_header_errors', undef, ...) called at /usr/lib/perl5/site_perl/5.10/Mail/Box/Parser.pm line 19 Mail::Box::Parser::new('Mail::Box::Parser::Perl', 'filename', 'dbxTest/test.mbox', 'mode', 'w', 'trusted', '', 'fix_header_errors', undef, ...) called at /usr/lib/perl5/site_perl/5.10/Mail/Box/Parser.pm line 19 Mail::Box::Parser::new('Mail::Box::Parser', 'filename', 'dbxTest/test.mbox', 'mode', 'w', 'trusted', '', 'fix_header_errors', undef, ...) called at /usr/lib/perl5/site_perl/5.10/Mail/Box/File.pm line 229 Mail::Box::File::parser('Mail::Box::Mbox=HASH(0x1aab4b8)') called at /usr/lib/perl5/site_perl/5.10/Mail/Box/File.pm line 414 Mail::Box::File::_write_replace('Mail::Box::Mbox=HASH(0x1aab4b8)', 'HASH(0x21862c0)') called at /usr/lib/perl5/site_perl/5.10/Mail/Box/File.pm line 326 Mail::Box::File::writeMessages('Mail::Box::Mbox=HASH(0x1aab4b8)', 'HASH(0x21862c0)') called at /usr/lib/perl5/site_perl/5.10/Mail/Box/Mbox.pm line 92 Mail::Box::Mbox::writeMessages('Mail::Box::Mbox=HASH(0x1aab4b8)', 'HASH(0x21862c0)') called at /usr/lib/perl5/site_perl/5.10/Mail/Box.pm line 715 Mail::Box::write('Mail::Box::Mbox=HASH(0x1aab4b8)', 'force', 0, 'save_deleted', 0) called at /usr/lib/perl5/site_perl/5.10/Mail/Box.pm line 343 Mail::Box::close('Mail::Box::Mbox=HASH(0x1aab4b8)') called at /usr/lib/perl5/site_perl/5.10/Mail/Box/File.pm line 162 Mail::Box::File::close(undef) called at /usr/lib/perl5/site_perl/5.10/Mail/Box.pm line 840 Mail::Box::DESTROY('Mail::Box::Mbox=HASH(0x1aab4b8)') called at ./tmptest.pl line 36 eval {...} called at ./tmptest.pl line 36
Subject: Re: [rt.cpan.org #46388] bug using access=>'w'
Date: Tue, 2 Jun 2009 12:04:15 +0200
To: "emike [...] bigfoot.com via RT" <bug-Mail-Box [...] rt.cpan.org>
From: Mark Overmeer <mark [...] overmeer.net>
* emike@bigfoot.com via RT (bug-Mail-Box@rt.cpan.org) [090601 17:28]: Show quoted text
> Queue: Mail-Box > Ticket <URL: http://rt.cpan.org/Ticket/Display.html?id=46388 >
Show quoted text
> I added 'confess;' to the function getline in Handle.pm, ran 'make > install', and then ran the test case w/ the 'w' option. > (the Handle.pm already includes 'use Carp;')
Well... that confess triggered the wrong call to that method :( But, on the possitive side: I has retried to find the actual cause of the problem from your first trace, and this time managed to fix the cause. Fixed in release 2.090, which will appear on CPAN within the hour. -- Thanks for the report. MarkOv ------------------------------------------------------------------------ Mark Overmeer MSc MARKOV Solutions Mark@Overmeer.net solutions@overmeer.net http://Mark.Overmeer.net http://solutions.overmeer.net
fixed in 2.090
CC: emike [...] bigfoot.com
Subject: Re: [rt.cpan.org #46388] bug using access=>'w'
Date: Thu, 04 Jun 2009 13:36:12 -0700
To: bug-Mail-Box [...] rt.cpan.org
From: Mike Ekberg <emike1955 [...] gmail.com>
Thanks Mark. This version (2.090) seems to fix the 'w' problem. However, I have two other things to report. The first is there are many failing test cases that you wished some help on. I will send the output from the 'force install Mail::Box' cpan command. I will send this to you in a separate email. I am willing to do some work to help you fix some of these, many of which appear to be 'off-by-one' fails, if you want it. Reminder: My computer is a Sony Viao laptop running Vista w/ a fairly recent install of cygwin. I run this stuff from a bash cygwin window. I noticed several tests reported 'couldn't do [X] because [X] not supported on Windows' kind of results. I'm not sure these are accurate in a Cygwin environment, as Cygwin for example has some emulation of Unix file access, for instance. But maybe this is not a high volume audience. The second problem may not be yours, but I will send that in a separate message. It has to do w/ a DBX file I have called Offline.dbx. This is probably empty, so may be causing problems for this reason.BTW, this happened before the 2.090 fix, but I considered it relatively minor problem. mike Mark Overmeer via RT wrote: Show quoted text
> <URL: http://rt.cpan.org/Ticket/Display.html?id=46388 > > > * emike@bigfoot.com via RT (bug-Mail-Box@rt.cpan.org) [090601 17:28]: >
>> Queue: Mail-Box >> Ticket <URL: http://rt.cpan.org/Ticket/Display.html?id=46388 > >>
> >
>> I added 'confess;' to the function getline in Handle.pm, ran 'make >> install', and then ran the test case w/ the 'w' option. >> (the Handle.pm already includes 'use Carp;') >>
> > Well... that confess triggered the wrong call to that method :( > > But, on the possitive side: I has retried to find the actual cause > of the problem from your first trace, and this time managed to > fix the cause. Fixed in release 2.090, which will appear on CPAN > within the hour. > -- > Thanks for the report. > > MarkOv > > ------------------------------------------------------------------------ > Mark Overmeer MSc MARKOV Solutions > Mark@Overmeer.net solutions@overmeer.net > http://Mark.Overmeer.net http://solutions.overmeer.net > > > >
problems probably solved