Skip Menu |

This queue is for tickets about the Filesys-SmbClient CPAN distribution.

Report information
The Basics
Id: 77228
Status: open
Priority: 0/
Queue: Filesys-SmbClient

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

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



Subject: No such file or directory error when file or directory exists
I've been using Filesys::SmbClient fairly successfully for months. All of a sudden (on one machine out of dozens) it can't seem to find any files any more and throws "No such file or directory" for anything I try. However, using the smbclient executable shows that the file is there. Because the executable works Filesys::SmbClientParser also works. I haven't been able to get any useful (to me) diagnostic info (even with Debug set to 10), but here's an example of what I'm seeing (minus the connection info): On a machine that works: perl -l -MFilesys::SmbClientParser -MFilesys::SmbClient -e '($u, $p, $h, $s, $d, $debug) = @ARGV; $,=", "; print $smb = Filesys::SmbClient->new(username => $u, password => $p, debug => $debug); eval { $dirh = $smb->opendir("smb://$h/$s/$d") or die $!; print $smb->readdir($dirh); } or print $@; print $smb = Filesys::SmbClientParser->new(undef, user => $u, password => $p, host => $h, share => $s); $smb->Debug($debug); $smb->cd($d); print map { $_->{name} } $smb->dir;' Filesys::SmbClient=HASH(0x9522d74) ., .., 32280_01.jpg, 32280_02.jpg, 32280_03.jpg, 32280_04.jpg, 32280_05.jpg, 32280_06.jpg Filesys::SmbClientParser=HASH(0x9633050) ., .., 32280_01.jpg, 32280_02.jpg, 32280_03.jpg, 32280_04.jpg, 32280_05.jpg, 32280_06.jpg On the one that doesn't: Filesys::SmbClient=HASH(0x879bd74) No such file or directory at -e line 1. Filesys::SmbClientParser=HASH(0x88f48bc) ., .., 107871_01.jpg I attached a file with the full output from debug=10 and the module compiled with STDERR trace, trying to do 'opendir' on the main share directory.
Subject: smbclient-nofile.txt
set_fn added interface ip=10.1.1.4 bcast=10.1.1.255 nmask=255.255.255.0 lp_load: refreshing parameters Initialising global parameters params.c:pm_process() - Processing configuration file "/home/autolookout/.smb/smb.conf" pm_process() returned Yes lp_servicenumber: couldn't find homes set_server_role: role = ROLE_STANDALONE Attempting to register new charset UCS-2LE Registered charset UCS-2LE Attempting to register new charset UTF-16LE Registered charset UTF-16LE Attempting to register new charset UCS-2BE Registered charset UCS-2BE Attempting to register new charset UTF-16BE Registered charset UTF-16BE Attempting to register new charset UTF8 Registered charset UTF8 Attempting to register new charset UTF-8 Registered charset UTF-8 Attempting to register new charset ASCII Registered charset ASCII Attempting to register new charset 646 Registered charset 646 Attempting to register new charset ISO-8859-1 Registered charset ISO-8859-1 Attempting to register new charset UCS2-HEX Registered charset UCS2-HEX Substituting charset 'ISO-8859-1' for LOCALE Substituting charset 'ISO-8859-1' for LOCALE Substituting charset 'ISO-8859-1' for LOCALE Substituting charset 'ISO-8859-1' for LOCALE Substituting charset 'ISO-8859-1' for LOCALE Substituting charset 'ISO-8859-1' for LOCALE Substituting charset 'ISO-8859-1' for LOCALE Substituting charset 'ISO-8859-1' for LOCALE Substituting charset 'ISO-8859-1' for LOCALE Substituting charset 'ISO-8859-1' for LOCALE Substituting charset 'ISO-8859-1' for LOCALE Substituting charset 'ISO-8859-1' for LOCALE Substituting charset 'ISO-8859-1' for LOCALE Substituting charset 'ISO-8859-1' for LOCALE Substituting charset 'ISO-8859-1' for LOCALE Substituting charset 'ISO-8859-1' for LOCALE Substituting charset 'ISO-8859-1' for LOCALE Substituting charset 'ISO-8859-1' for LOCALE Substituting charset 'ISO-8859-1' for LOCALE Substituting charset 'ISO-8859-1' for LOCALE Using netbios name HARTFORDSPRINGFIELDAA. Using workgroup WORKGROUP. ! Filesys::SmbClient : init 157365664 context parsed path: fname='smb://10.1.1.2/inventory' server='10.1.1.2' share='inventory' path='' options='' smbc_check_options(): server='10.1.1.2' share='inventory' path='' options='' auth_fn workgroup: [WORKGROUP] smbc_server: server_n=[10.1.1.2] server=[10.1.1.2] -> server_n=[10.1.1.2] server=[10.1.1.2] Connecting to 10.1.1.2 at port 139 socket option SO_KEEPALIVE = 0 socket option SO_REUSEADDR = 0 socket option SO_BROADCAST = 0 socket option TCP_NODELAY = 1 socket option IPTOS_LOWDELAY = 0 socket option IPTOS_THROUGHPUT = 0 socket option SO_SNDBUF = 16384 socket option SO_RCVBUF = 87380 socket option SO_SNDLOWAT = 1 socket option SO_RCVLOWAT = 1 socket option SO_SNDTIMEO = 0 socket option SO_RCVTIMEO = 0 write_socket(3,72) write_socket(3,72) wrote 72 Sent session request got smb length of 1 size=1 smb_com=0x0 smb_rcls=0 smb_reh=0 smb_err=0 smb_flg=0 smb_flg2=0 smb_tid=0 smb_pid=0 smb_uid=0 smb_mid=0 smt_wct=0 smb_bcc=0 Connecting to 10.1.1.2 at port 139 socket option SO_KEEPALIVE = 0 socket option SO_REUSEADDR = 0 socket option SO_BROADCAST = 0 socket option TCP_NODELAY = 1 socket option IPTOS_LOWDELAY = 0 socket option IPTOS_THROUGHPUT = 0 socket option SO_SNDBUF = 16384 socket option SO_RCVBUF = 87380 socket option SO_SNDLOWAT = 1 socket option SO_RCVLOWAT = 1 socket option SO_SNDTIMEO = 0 socket option SO_RCVTIMEO = 0 write_socket(3,72) write_socket(3,72) wrote 72 Sent session request got smb length of 1 size=1 smb_com=0x0 smb_rcls=0 smb_reh=0 smb_err=0 smb_flg=0 smb_flg2=0 smb_tid=0 smb_pid=0 smb_uid=0 smb_mid=0 smt_wct=0 smb_bcc=0 name_status_find: looking up *#00 at 10.1.1.2 Opening cache file at /var/cache/samba/gencache.tdb tdb(unnamed): tdb_open_ex: could not open file /var/cache/samba/gencache.tdb: Permission denied Attempt to open gencache.tdb has failed. bind succeeded on port 0 Sending a packet of len 50 to (10.1.1.2) on port 137 read_udp_socket: lastip 10.1.1.2 lastport 137 read: 157 parse_nmb: packet id = 6508 Received a packet of len 157 from (10.1.1.2) port 137 nmb packet from 10.1.1.2(137) header: id=6508 opcode=Query(0) response=Yes header: flags: bcast=No rec_avail=No rec_des=No trunc=No auth=Yes header: rcode=0 qdcount=0 ancount=1 nscount=0 arcount=0 answers: nmb_name=*<00> rr_type=33 rr_class=1 ttl=0 answers 0 char .LOCAL hex 034C4F43414C20202020202020202020 answers 10 char ...HSAC-AAS hex 008400485341432D4141532020202020 answers 20 char ...HSAC-AAS hex 2020000400485341432D414153202020 answers 30 char ...!..A.... hex 2020202020040000219B9441B2000000 answers 40 char ................ hex 00000000000000000000000000000000 answers 50 char ................ hex 00000000000000000000000000000000 answers 60 char ..... hex 0000000000 LOCAL#00: flags = 0x84 HSAC-AAS#00: flags = 0x04 HSAC-AAS#20: flags = 0x04 Opening cache file at /var/cache/samba/gencache.tdb tdb(unnamed): tdb_open_ex: could not open file /var/cache/samba/gencache.tdb: Permission denied Attempt to open gencache.tdb has failed. name_status_find: name found, name LOCAL ip address is 10.1.1.2 Connecting to 10.1.1.2 at port 139 socket option SO_KEEPALIVE = 0 socket option SO_REUSEADDR = 0 socket option SO_BROADCAST = 0 socket option TCP_NODELAY = 1 socket option IPTOS_LOWDELAY = 0 socket option IPTOS_THROUGHPUT = 0 socket option SO_SNDBUF = 16384 socket option SO_RCVBUF = 87380 socket option SO_SNDLOWAT = 1 socket option SO_RCVLOWAT = 1 socket option SO_SNDTIMEO = 0 socket option SO_RCVTIMEO = 0 write_socket(3,72) write_socket(3,72) wrote 72 Sent session request got smb length of 1 size=1 smb_com=0x0 smb_rcls=0 smb_reh=0 smb_err=0 smb_flg=0 smb_flg2=0 smb_tid=0 smb_pid=0 smb_uid=0 smb_mid=0 smt_wct=0 smb_bcc=0 Connecting to 10.1.1.2 at port 139 socket option SO_KEEPALIVE = 0 socket option SO_REUSEADDR = 0 socket option SO_BROADCAST = 0 socket option TCP_NODELAY = 1 socket option IPTOS_LOWDELAY = 0 socket option IPTOS_THROUGHPUT = 0 socket option SO_SNDBUF = 16384 socket option SO_RCVBUF = 87380 socket option SO_SNDLOWAT = 1 socket option SO_RCVLOWAT = 1 socket option SO_SNDTIMEO = 0 socket option SO_RCVTIMEO = 0 write_socket(3,72) write_socket(3,72) wrote 72 Sent session request got smb length of 1 size=1 smb_com=0x0 smb_rcls=0 smb_reh=0 smb_err=0 smb_flg=0 smb_flg2=0 smb_tid=0 smb_pid=0 smb_uid=0 smb_mid=0 smt_wct=0 smb_bcc=0 ! Filesys::SmbClient : _opendir: 0 No such file or directory at -e line 1.
I also tried comparing `strace` output from one machine that works and one that doesn't. The best I could determine was that it seemed like (for the perl mod, not the executable) the server wasn't returning the "welcome, I'm an SMB server" socket response. According to a tech at the location they had some sort of network outage where DNS was only partially working, or something strange like that. Weird as it sounds, I tried changing from using the IP address to using the netbios name and it started to work again. I have no idea if there's some sort of broken cache somewhere interfering, but it still seems odd that `smbclient` could do it, but the perl module could not.