Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

re: test failures on Windows #261

Closed
charsbar opened this issue Feb 17, 2018 · 2 comments
Closed

re: test failures on Windows #261

charsbar opened this issue Feb 17, 2018 · 2 comments

Comments

@charsbar
Copy link

https://twitter.com/azumakuniyuki/status/963988522053939200
https://twitter.com/azumakuniyuki/status/963987561046683648

There are two reasons of this breakage for Windows.

  1. Windows doesn't have a reliable inode (see also perlport for the stat portability)

The following kind of hack made the failing tests pass, but I'm not sure this is the best way to go. As you've said in the above tweets, just making the tests skip would be enough.

diff --git a/lib/Sisimai/Mail/Maildir.pm b/lib/Sisimai/Mail/Maildir.pm
--- a/lib/Sisimai/Mail/Maildir.pm
+++ b/lib/Sisimai/Mail/Maildir.pm
@@ -66,6 +66,7 @@ sub read {
# Get inode number of the file
$self->{'path'} = $emailindir;
$emailinode = [stat $emailindir]->[1];

  •        $emailinode = $emailindir if $^O eq 'MSWin32';
           next if exists $self->{'inodes'}->{ $emailinode };
    
           $filehandle = IO::File->new($emailindir, 'r');
    
  1. Some of the tests fail because of the Windows line ending difference (LF/CRLF)

This patch should fix the issue, but the same as above can be applied here, and it might be better to add this binmode to lib/Sisimai/Mail/STDIN.pm as well (as of this writing tests pass without patching it).

diff --git a/lib/Sisimai/Mail/Mbox.pm b/lib/Sisimai/Mail/Mbox.pm
index f10db4b..c49816c 100644
--- a/lib/Sisimai/Mail/Mbox.pm
+++ b/lib/Sisimai/Mail/Mbox.pm
@@ -34,6 +34,7 @@ sub new {
$param->{'size'} = -s $argv1;
$param->{'file'} = File::Basename::basename $argv1;
$param->{'handle'} = ref $argv1 ? $argv1 : IO::File->new($argv1, 'r');

  • binmode $param->{'handle'};

    return bless($param, PACKAGE);
    }

@azumakuniyuki
Copy link
Member

@charsbar Thanks for the advice! I'll try to fix these codes :-)

@azumakuniyuki
Copy link
Member

try-to-support-windows branch which is applied your patch has successfully passed tests on Windows !
https://twitter.com/azumakuniyuki/status/964804204865847296

And then, we've released the merged master branch as v4.22.4p1.
Thank you again.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants