Skip Menu |

This queue is for tickets about the DBD-SQLite CPAN distribution.

Report information
The Basics
Id: 45166
Status: resolved
Priority: 0/
Queue: DBD-SQLite

People
Owner: Nobody in particular
Requestors: jdhedden [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: Critical
Broken in:
  • 1.23
  • 1.25
Fixed in: (no value)



Subject: [PATCH] Skip Unicode path tests under Cygwin
Cygwin does not support Unicode chars in paths. Attached is the test output showing this. Therefore, some tests in t/33_non_latin_path.t need to be skipped. The attached patch does this. (However, there may be a more elegant way of doing this. I leave it to your discretion to improve on this.)
Subject: DBD-SQLite.patch
--- DBD-SQLite-1.23/t/33_non_latin_path.t.orig 2009-04-20 16:55:55.419584000 -0400 +++ DBD-SQLite-1.23/t/33_non_latin_path.t 2009-04-20 17:01:19.551635600 -0400 @@ -13,7 +13,7 @@ use Test::More; BEGIN { if ( $] >= 5.008005 ) { - plan( tests => 25 ); + plan( tests => (($^O eq 'cygwin') ? 13 : 25) ); } else { plan( skip_all => 'Unicode is not supported before 5.8.5' ); } @@ -30,6 +30,9 @@ my $dir = File::Temp::tempdir( CLEANUP => 1 ); foreach my $subdir ( 'longascii', 'adatbázis', 'name with spaces', '¿¿¿ ¿¿¿¿¿¿') { + if ($^O eq 'cygwin') { + next if (($subdir eq 'adatbázis') || ($subdir eq '¿¿¿ ¿¿¿¿¿¿')); + } utf8::upgrade($subdir); ok( mkdir(catdir($dir, $subdir)), @@ -88,4 +91,4 @@ return join '', grep { defined } Win32::GetShortPathName($dir), $file, $suffix; } return $path; -} \ No newline at end of file +}
Subject: test_out.txt
1..25 ok 1 - longascii created ok 2 - The object isa DBI::db ok 3 - Could connect to database in longascii ok 4 - The object isa DBI::db ok 5 - Could connect to database in longascii ok 6 - Could connect to database in /tmp/XUCGVa2zDc/longascii.db ok 7 - adatbázis created not ok 8 - Could connect to database in adatbázis # Failed test 'Could connect to database in adatbázis' # at t/33_non_latin_path.t.orig line 48. # got: 'DBI connect('dbname=/tmp/XUCGVa2zDc/adatbázis/db.db','',...) failed: unable to open database file at t/33_non_latin_path.t.orig line 42 # ' # expected: '' # DBI connect('dbname=/tmp/XUCGVa2zDc/adatbázis/db.db','',...) failed: unable to open database file at t/33_non_latin_path.t.orig line 42 not ok 9 - Could connect to database in adatbázis # Failed test 'Could connect to database in adatbázis' # at t/33_non_latin_path.t.orig line 62. # got: 'DBI connect('dbname=/tmp/XUCGVa2zDc/adatbázis/db.db','',...) failed: unable to open database file at t/33_non_latin_path.t.orig line 55 # ' # expected: '' # DBI connect('dbname=/tmp/XUCGVa2zDc/adatbázis/db.db','',...) failed: unable to open database file at t/33_non_latin_path.t.orig line 55 ok 10 - Could connect to database in /tmp/XUCGVa2zDc/adatbázis.db ok 11 - name with spaces created ok 12 - The object isa DBI::db ok 13 - Could connect to database in name with spaces ok 14 - The object isa DBI::db ok 15 - Could connect to database in name with spaces ok 16 - Could connect to database in /tmp/XUCGVa2zDc/name with spaces.db ok 17 - ¿¿¿ ¿¿¿¿¿¿ created not ok 18 - Could connect to database in ¿¿¿ ¿¿¿¿¿¿ # Failed test 'Could connect to database in ¿¿¿ ¿¿¿¿¿¿' # at t/33_non_latin_path.t.orig line 48. # got: 'DBI connect('dbname=/tmp/XUCGVa2zDc/¿¿¿ ¿¿¿¿¿¿/db.db','',...) failed: unable to open database file at t/33_non_latin_path.t.orig line 42 # ' # expected: '' # DBI connect('dbname=/tmp/XUCGVa2zDc/¿¿¿ ¿¿¿¿¿¿/db.db','',...) failed: unable to open database file at t/33_non_latin_path.t.orig line 42 not ok 19 - Could connect to database in ¿¿¿ ¿¿¿¿¿¿ # Failed test 'Could connect to database in ¿¿¿ ¿¿¿¿¿¿' # at t/33_non_latin_path.t.orig line 62. # got: 'DBI connect('dbname=/tmp/XUCGVa2zDc/¿¿¿ ¿¿¿¿¿¿/db.db','',...) failed: unable to open database file at t/33_non_latin_path.t.orig line 55 # ' # expected: '' # DBI connect('dbname=/tmp/XUCGVa2zDc/¿¿¿ ¿¿¿¿¿¿/db.db','',...) failed: unable to open database file at t/33_non_latin_path.t.orig line 55 ok 20 - Could connect to database in /tmp/XUCGVa2zDc/¿¿¿ ¿¿¿¿¿¿.db ok 21 - no warnings # Looks like you planned 25 tests but ran 21. # Looks like you failed 4 tests of 21 run.
This can (hopefully) be fixed with a help of Win32 module etc. Please check the latest trunk, and add more tests if you please. On Mon Apr 20 17:07:46 2009, JDHEDDEN wrote: Show quoted text
> Cygwin does not support Unicode chars in paths. Attached is the test > output showing this. > > Therefore, some tests in t/33_non_latin_path.t need to be skipped.
The Show quoted text
> attached patch does this. (However, there may be a more elegant way
of Show quoted text
> doing this. I leave it to your discretion to improve on this.)
Closing as 1.24_01 is out On Tue Apr 21 02:10:05 2009, ISHIGAKI wrote: Show quoted text
> This can (hopefully) be fixed with a help of Win32 module etc. Please > check the latest trunk, and add more tests if you please. > > On Mon Apr 20 17:07:46 2009, JDHEDDEN wrote:
> > Cygwin does not support Unicode chars in paths. Attached is the
test Show quoted text
> > output showing this. > > > > Therefore, some tests in t/33_non_latin_path.t need to be skipped.
> The
> > attached patch does this. (However, there may be a more elegant
way Show quoted text
> of
> > doing this. I leave it to your discretion to improve on this.)
>
The implemented fix does not work under Cygwin. It causes DBs to only be opened in the current directory. The changes made to 'connect' should be reverted, and the patch I supplied to bypass the unicode tests under Cygwin should be utilized. I have attached a revised patch that does both. On Wed Apr 22 00:18:36 2009, ISHIGAKI wrote: Show quoted text
> Closing as 1.24_01 is out > > On Tue Apr 21 02:10:05 2009, ISHIGAKI wrote:
> > This can (hopefully) be fixed with a help of Win32 module etc. Please > > check the latest trunk, and add more tests if you please. > > > > On Mon Apr 20 17:07:46 2009, JDHEDDEN wrote:
> > > Cygwin does not support Unicode chars in paths. Attached is the
> test
> > > output showing this. > > > > > > Therefore, some tests in t/33_non_latin_path.t need to be skipped.
> > The
> > > attached patch does this. (However, there may be a more elegant
> way
> > of
> > > doing this. I leave it to your discretion to improve on this.)
> >
> >
diff -urN DBD-SQLite-1.25/lib/DBD/SQLite.pm DBD-SQLite-patched/lib/DBD/SQLite.pm --- DBD-SQLite-1.25/lib/DBD/SQLite.pm 2009-04-23 06:12:05.000000000 -0400 +++ DBD-SQLite-patched/lib/DBD/SQLite.pm 2009-04-30 14:02:20.095443000 -0400 @@ -65,7 +65,7 @@ # To avoid unicode and long file name problems on Windows, # convert to the shortname if the file (or parent directory) exists. - if ( $^O =~ /MSWin32|cygwin/ and $real ne ':memory:' ) { + if ( $^O =~ /MSWin32/ and $real ne ':memory:' ) { require Win32; require File::Basename; my ($file, $dir, $suffix) = File::Basename::fileparse($real); @@ -81,15 +81,6 @@ # SQLite can't do mkpath anyway. # So let it go through as it and fail. } - if ( $^O eq 'cygwin' ) { - if ( $] >= 5.010 ) { - $real = Cygwin::win_to_posix_path($real, 'absolute'); - } - else { - require Filesys::CygwinPaths; - $real = Filesys::CygwinPaths::fullposixpath($real); - } - } } # Hand off to the actual login function diff -urN DBD-SQLite-1.25/t/33_non_latin_path.t DBD-SQLite-patched/t/33_non_latin_path.t --- DBD-SQLite-1.25/t/33_non_latin_path.t 2009-04-23 06:12:06.000000000 -0400 +++ DBD-SQLite-patched/t/33_non_latin_path.t 2009-04-30 14:06:01.208940500 -0400 @@ -13,7 +13,7 @@ use Test::More; BEGIN { if ( $] >= 5.008005 ) { - plan( tests => 25 ); + plan( tests => (($^O eq 'cygwin') ? 13 : 25) ); } else { plan( skip_all => 'Unicode is not supported before 5.8.5' ); } @@ -30,6 +30,9 @@ my $dir = File::Temp::tempdir( CLEANUP => 1 ); foreach my $subdir ( 'longascii', 'adatbázis', 'name with spaces', '¿¿¿ ¿¿¿¿¿¿') { + if ($^O eq 'cygwin') { + next if (($subdir eq 'adatbázis') || ($subdir eq '¿¿¿ ¿¿¿¿¿¿')); + } utf8::upgrade($subdir); ok( mkdir(catdir($dir, $subdir)), @@ -75,7 +78,7 @@ sub _path { # copied from DBD::SQLite::connect my $path = shift; - if ($^O =~ /MSWin32|cygwin/) { + if ($^O =~ /MSWin32/) { require Win32; require File::Basename; @@ -98,4 +101,4 @@ } } return $path; -} \ No newline at end of file +}
Show quoted text
> I have attached a revised patch that does both.
Revised patch attached. Test file and Makefile.PL updated to remove CygwinPaths stuff.
diff -urN DBD-SQLite-1.25/Makefile.PL DBD-SQLite-patched/Makefile.PL --- DBD-SQLite-1.25/Makefile.PL 2009-04-23 06:12:04.000000000 -0400 +++ DBD-SQLite-patched/Makefile.PL 2009-04-30 14:15:51.600263000 -0400 @@ -212,9 +212,6 @@ ( WINLIKE ? ( 'Win32' => '0.30', ) : () ), - ( ($^O eq 'cygwin' && $] < 5.010) ? ( - 'Filesys::CygwinPaths' => '0', - ) : () ), }, OPTIONAL( '6.48', MIN_PERL_VERSION => '5.006', diff -urN DBD-SQLite-1.25/lib/DBD/SQLite.pm DBD-SQLite-patched/lib/DBD/SQLite.pm --- DBD-SQLite-1.25/lib/DBD/SQLite.pm 2009-04-23 06:12:05.000000000 -0400 +++ DBD-SQLite-patched/lib/DBD/SQLite.pm 2009-04-30 14:02:20.095443000 -0400 @@ -65,7 +65,7 @@ # To avoid unicode and long file name problems on Windows, # convert to the shortname if the file (or parent directory) exists. - if ( $^O =~ /MSWin32|cygwin/ and $real ne ':memory:' ) { + if ( $^O =~ /MSWin32/ and $real ne ':memory:' ) { require Win32; require File::Basename; my ($file, $dir, $suffix) = File::Basename::fileparse($real); @@ -81,15 +81,6 @@ # SQLite can't do mkpath anyway. # So let it go through as it and fail. } - if ( $^O eq 'cygwin' ) { - if ( $] >= 5.010 ) { - $real = Cygwin::win_to_posix_path($real, 'absolute'); - } - else { - require Filesys::CygwinPaths; - $real = Filesys::CygwinPaths::fullposixpath($real); - } - } } # Hand off to the actual login function diff -urN DBD-SQLite-1.25/t/33_non_latin_path.t DBD-SQLite-patched/t/33_non_latin_path.t --- DBD-SQLite-1.25/t/33_non_latin_path.t 2009-04-23 06:12:06.000000000 -0400 +++ DBD-SQLite-patched/t/33_non_latin_path.t 2009-04-30 14:12:26.942523000 -0400 @@ -13,7 +13,7 @@ use Test::More; BEGIN { if ( $] >= 5.008005 ) { - plan( tests => 25 ); + plan( tests => (($^O eq 'cygwin') ? 13 : 25) ); } else { plan( skip_all => 'Unicode is not supported before 5.8.5' ); } @@ -30,6 +30,9 @@ my $dir = File::Temp::tempdir( CLEANUP => 1 ); foreach my $subdir ( 'longascii', 'adatbázis', 'name with spaces', '¿¿¿ ¿¿¿¿¿¿') { + if ($^O eq 'cygwin') { + next if (($subdir eq 'adatbázis') || ($subdir eq '¿¿¿ ¿¿¿¿¿¿')); + } utf8::upgrade($subdir); ok( mkdir(catdir($dir, $subdir)), @@ -75,7 +78,7 @@ sub _path { # copied from DBD::SQLite::connect my $path = shift; - if ($^O =~ /MSWin32|cygwin/) { + if ($^O =~ /MSWin32/) { require Win32; require File::Basename; @@ -87,15 +90,6 @@ } elsif ( -d $dir ) { $path = join '', grep { defined } Win32::GetShortPathName($dir), $file, $suffix; } - if ($^O eq 'cygwin') { - if ($] >= 5.010) { - $path = Cygwin::win_to_posix_path($path, 'absolute'); - } - else { - require Filesys::CygwinPaths; - $path = Filesys::CygwinPaths::fullposixpath($path); - } - } } return $path; -} \ No newline at end of file +}
Current implementation seems working for me. Will you send a (test) script that describes your problem, with your perl/cygwin versions? On 木曜日 4月 30 14:19:45 2009, JDHEDDEN wrote: Show quoted text
> > I have attached a revised patch that does both.
> > Revised patch attached. Test file and Makefile.PL updated to remove > CygwinPaths stuff.
Ah, ok, I got it. On Thu Apr 30 20:33:51 2009, ISHIGAKI wrote: Show quoted text
> Current implementation seems working for me. Will you send a (test) > script that describes your problem, with your perl/cygwin versions? > > On Thu Apr 30 14:19:45 2009, JDHEDDEN wrote:
> > > I have attached a revised patch that does both.
> > > > Revised patch attached. Test file and Makefile.PL updated to remove > > CygwinPaths stuff.
>
fixed in 1.26_01. sorry for the trouble.