Skip Menu |

Preferred bug tracker

Please visit the preferred bug tracker to report your issue.

This queue is for tickets about the Win32-LongPath CPAN distribution.

Report information
The Basics
Id: 93540
Status: resolved
Worked: 30 min
Priority: 0/
Queue: Win32-LongPath

People
Owner: RBOISVERT [...] cpan.org
Requestors: meir [...] guttman.co.il
Cc:
AdminCc:

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



Subject: Paths with pure
Date: Wed, 05 Mar 2014 13:41:59 +0200
To: bug-Win32-LongPath [...] rt.cpan.org
From: Meir Guttman <meir [...] guttman.co.il>
Dear rdboisvert, Being Hebrew speaking, my computer is replete with directory names and file names containing Hebrew (Unicode?) characters. I recently switched from ActivePerl 5.14.2 (64 bit) all the way to Strawberry Perl 5.18.2, also 64 bit. Suddenly, "chdir" to a path containing Hebrew characters resulted in $! = 'no such file or directory' error I would like to stress two things: 1) chdir to ASCII only path works fine 2) The package File::Find::Object is able to traverse a large directory tree containing numerous files and directories containing Hebrew characters. Researching the web suggested the use of win32::Unicode::Dir function of 'chdirW'. On installing it by 'cpanm' the testing part produced three errors: ============================================= # Failed test at t/04_print.t line 14. # STDOUT is: # I ♥ Perl # not: # I ♥ Perl # as expected # Failed test at t/04_print.t line 15. # STDOUT is: # [ I ♥ Perl] # not: # [ I ♥ Perl] # as expected # Failed test at t/04_print.t line 16. # STDOUT is: # I ♥ Perl # # not: # I ♥ Perl # # as expected # Looks like you failed 3 tests of 13. t/04_print.t ............. Dubious, test returned 3 (wstat 768, 0x300) Failed 3/13 subtests ============================================= I forced its installation nevertheless. When calling it, the results where that 'chdirW' acted as a no-op: neither changing to the target directory, nor producing any errors! This was the case both in path names with or without Hebrew characters. Reading your response to a bug report for win32::Unicode::Dir, I went ahead and installed your Win32::LongPath package, log attached. I am sorry to say though, that your function behaves as a no-op too, neither changing a dir, nor producing an error. Again, with pathnames of pure ASCII as well as with Hebrew characters. Here is my test-script: ============================================= # Directory-tree traversing test use strict; use warnings; use utf8; use File::Find::Object; use Win32; use File::Spec::Functions; # Do I really need it? use Win32::LongPath; use Cwd; binmode(STDOUT, ":utf8"); binmode(STDERR, ":utf8"); my $start_dir = Win32::GetLongPathName("D:/replace/with/your/test/path"); # Here is a Hebrew string for your test: "/מחרוזת בעברית" print $start_dir, "\n"; chdir($start_dir) or die "Can't cd to $start_dir: $!"; my $dir = getcwd; print "At $dir\n"; my $tree = File::Find::Object->new({}, "."); my $file_count = 0; my %file_names; open my $file_list, ">:encoding(utf8)", "files_list.txt"; while (my $file_name = $tree->next()) { if (-f $file_name and ($file_name =~ m|^.+\.xlsx$|)) { my $long_name = Win32::GetLongPathName($file_name); print $file_list "$long_name\n"; $file_count++; } } print $file_list "Encountered $file_count Excel files\n"; close $file_list; 1; ============================================= Am I missing something??? Regards, Meir Guttman
Download build.log.Win32_LongPath
application/octet-stream 4.3k

Message body not shown because it is not plain text.

I apologize for not responding sooner. I totally missed this request from 2 years ago! :{( By now hopefully you have realized that win32::Unicode::Dir has nothing to do with Win32::LongPath. As far as the rest of the code goes, it did work on my computer. Perhaps the path you are using makes a difference or you should have used "m|^.+\.xlsx$|i" instead of "m|^.+\.xlsx$|". I'm closing this issue but feel free to reopen a new one if there are other issues. Bob On Wed Mar 05 06:42:15 2014, meir@guttman.co.il wrote: Show quoted text
> Dear rdboisvert, > Being Hebrew speaking, my computer is replete with directory names and > file names containing Hebrew (Unicode?) characters. > I recently switched from ActivePerl 5.14.2 (64 bit) all the way to > Strawberry Perl 5.18.2, also 64 bit. > Suddenly, "chdir" to a path containing Hebrew characters resulted in > $! = 'no such file or directory' error > I would like to stress two things: > 1) chdir to ASCII only path works fine > 2) The package File::Find::Object is able to traverse a large > directory tree containing numerous files and directories containing > Hebrew characters. > Researching the web suggested the use of win32::Unicode::Dir function > of 'chdirW'. On installing it by 'cpanm' the testing part produced > three errors: > > ============================================= > # Failed test at t/04_print.t line 14. > # STDOUT is: > # I ♥ Perl > # not: > # I ♥ Perl > # as expected > > # Failed test at t/04_print.t line 15. > # STDOUT is: > # [ I ♥ Perl] > # not: > # [ I ♥ Perl] > # as expected > > # Failed test at t/04_print.t line 16. > # STDOUT is: > # I ♥ Perl > # > # not: > # I ♥ Perl > # > # as expected > # Looks like you failed 3 tests of 13. > t/04_print.t ............. > Dubious, test returned 3 (wstat 768, 0x300) > Failed 3/13 subtests > ============================================= > I forced its installation nevertheless. > > When calling it, the results where that 'chdirW' acted as a no-op: > neither changing to the target directory, nor producing any errors! > This was the case both in path names with or without Hebrew > characters. > Reading your response to a bug report for win32::Unicode::Dir, I went > ahead and installed your Win32::LongPath package, log attached. I am > sorry to say though, that your function behaves as a no-op too, > neither changing a dir, nor producing an error. Again, with pathnames > of pure ASCII as well as with Hebrew characters. > > Here is my test-script: > ============================================= > # Directory-tree traversing test > use strict; > use warnings; > use utf8; > > use File::Find::Object; > use Win32; > use File::Spec::Functions; # Do I really need it? > use Win32::LongPath; > use Cwd; > > binmode(STDOUT, ":utf8"); > binmode(STDERR, ":utf8"); > > my $start_dir = > Win32::GetLongPathName("D:/replace/with/your/test/path"); # Here is a > Hebrew string for your test: "/מחרוזת בעברית" > print $start_dir, "\n"; > chdir($start_dir) or die "Can't cd to $start_dir: $!"; > my $dir = getcwd; > print "At $dir\n"; > > my $tree = File::Find::Object->new({}, "."); > my $file_count = 0; > my %file_names; > > open my $file_list, ">:encoding(utf8)", "files_list.txt"; > while (my $file_name = $tree->next()) { > if (-f $file_name and ($file_name =~ m|^.+\.xlsx$|)) { > my $long_name = Win32::GetLongPathName($file_name); > print $file_list "$long_name\n"; > $file_count++; > } > } > print $file_list "Encountered $file_count Excel files\n"; > close $file_list; > > 1; > ============================================= > > Am I missing something??? > > Regards, > Meir Guttman