Subject: | SmbClientParser cannot cd into directories whose names consist of two characters |
Date: | Tue, 23 Jan 2007 15:45:03 -0700 |
To: | <bug-Filesys-SmbClientParser [...] rt.cpan.org> |
From: | "Peeler, Wade M." <Wade.Peeler [...] ngc.com> |
Distribution: Filesys::SmbClientParser-2.7
Perl version: 5.8.8
OS (uname -a output): Suse Linux ******** 2.6.16.21-0.8-smp #1 SMP Mon
Jul 3 18:25:39 UTC 2006 x86_64 x86_64 x86_64 GNU/Linux
When attempting to cd to any directory with a 2-character filename, it
actually does a cd up one directory, just as if it had done a 'cd ..'
It appears that the module has a regex matching /../ when it should
match /\.\./
Code to reproduce:
use strict;
use Filesys::SmbClientParser;
my $host = "my_computer";
my $smb;
my $element;
my @directory;
my $dir1 = "abc";
my $dir2 = "ab";
print "$host\n";
$smb = new Filesys::SmbClientParser();
$smb->Host($host);
$smb->User("my_user");
$smb->Password("my_password");
$smb->Share("my_share");
print "1st pwd: " . $smb->pwd . "\n";
@directory = $smb->dir;
print "1st directory listing:\n";
foreach $element (@directory)
{
print $element->{name} . "\n";
}
print "cding to $dir1\n";
$smb->cd($dir1);
print "2nd pwd: " . $smb->pwd . "\n";
@directory = $smb->dir;
print "2nd directory listing:\n";
foreach $element (@directory)
{
print $element->{name} . "\n";
}
print "cding to $dir2\n";
$smb->cd($dir2);
print "3rd pwd: " . $smb->pwd . "\n";
@directory = $smb->dir;
print "3rd directory listing:\n";
foreach $element (@directory)
{
print $element->{name} . "\n";
}
exit(0);
Output:
my_computer
Domain=[NTDOMAIN] OS=[Windows 5.0] Server=[Windows 2000 LAN Manager]
1st pwd: \my_share\
Domain=[NTDOMAIN] OS=[Windows 5.0] Server=[Windows 2000 LAN Manager]
1st directory listing:
.
..
abc
cding to abc
Domain=[NTDOMAIN] OS=[Windows 5.0] Server=[Windows 2000 LAN Manager]
Domain=[NTDOMAIN] OS=[Windows 5.0] Server=[Windows 2000 LAN Manager]
2nd pwd: \my_share\abc\
Domain=[NTDOMAIN] OS=[Windows 5.0] Server=[Windows 2000 LAN Manager]
2nd directory listing:
.
..
ab
cding to ab
Domain=[NTDOMAIN] OS=[Windows 5.0] Server=[Windows 2000 LAN Manager]
Domain=[NTDOMAIN] OS=[Windows 5.0] Server=[Windows 2000 LAN Manager]
3rd pwd: \my_share\
Domain=[NTDOMAIN] OS=[Windows 5.0] Server=[Windows 2000 LAN Manager]
3rd directory listing:
.
..
abc