Tcl Source Code

View Ticket
Login
Ticket UUID: 3048726
Title: Strange glob bad result
Type: Bug Version: obsolete: 8.5.8
Submitter: beric Created on: 2010-08-19 15:12:43
Subsystem: 37. File System Assigned To: nobody
Priority: 5 Medium Severity: Minor
Status: Pending Last Modified: 2016-08-20 17:07:32
Resolution: Out of Date Closed By: nobody
    Closed on: 2010-08-20 14:40:41
Description:
I encounter a strange problem with glob under windows XP, with a networked mounted drive.
Here is a copy of a tclsh console:

(pai_builder) 8 % glob -directory z:/pai/sorties/861/config_whitebox -tails *
interface.csv memorisation.csv appel.csv variable.csv version.csv
(pai_builder) 9 % glob -directory z:/pai/sorties/861/config_whitebox -tails *.csv
interface.csv memorisation.csv

The first glob with the pattern "*" returns 5 files.
While they all have the .csv extension, only 2 of them are returned by glob with the pattern "*.csv".
User Comments: beric added on 2010-08-23 16:24:43:
Yes, there is also the < instead of *.
I reported the problem to our IT support service to check the samba configuration.
I'll let you know of the progress...

ferrieux added on 2010-08-23 15:27:49:
Ha !!! But how can this bug survive for so long if the Windows crowd is also concerned ???
Maybe it is confined to one specific buggy version of Samba...

(Verification: do you also see the '<' in dir *.csv pcap ? You can just attach it if you prefer)

beric added on 2010-08-23 14:56:08:
"dir *.csv" gives the same result as glob.
Using procmon, it also calls QueryDirectory with *.csv filter.

ferrieux added on 2010-08-20 22:58:54:
Thanks. 
There's something strange: in the truncated SMB request FIND_FAST2, the  '*'characted (in *.CSV) is replaced by a '<':

   Search Pattern: \pai\sorties\860\config_whitebox\<.CSV

while in the successful one the star is a star:

   Search Pattern: \pai\sorties\860\config_whitebox\*

I'll have to dig a bit further to understand the semantics of this change. Perhaps '<' is another kind of wildcard in SMB...

One thing you could do is try [glob z:/pai/sorties/861/config_whitebox/*.csv] directly. If it works, I'm interested in the pcap too ;-)

Also, the pcap of a similar query from the DOS prompt (dir /s *.csv) could be helpful, especially if it works (which I suspect).

beric added on 2010-08-20 22:31:37:
You're right, here are the captures.

beric added on 2010-08-20 22:17:57:

File Added - 384066: glob_with_star.pcap

beric added on 2010-08-20 22:17:25:

File Added - 384065: glob_csv.pcap

ferrieux added on 2010-08-20 21:52:10:
Well, the server could be legally shortening the list because of something in the request parameters. While it might not be Tcl's fault, it seems there are repeated issues with [glob] on Windows with network shares. Just in case your case happens to be a facet of this general problem, the analysis could help identify the mechanism, and possibly produce a workaround. Please attach the pcap ;-)

beric added on 2010-08-20 21:40:41:


beric added on 2010-08-20 21:39:41:
Alex, thank you very much again!
While I use wireshark to debug my own protocols implemention (when "puts" can't do more!), I wish I had think to it to track down this problem.
So, the capture shows clearly that the samba server is the guilty, by not returning all the files.
It's only my problem now, happy that it's not a Tcl bug.

ferrieux added on 2010-08-20 16:52:20:
Thanks for the traces :)
Wow ! Indeed QueryDirectory seems to randomly miss files. But since the trace report doesn't give much details on  the parameters (handle values), we're in the dark...
Maybe the next step would be to capture the CMB/CIFS packets exchanged with Wireshark.
Can you attach the pcap ?

beric added on 2010-08-20 15:03:28:

File Added - 384025: traces.txt

beric added on 2010-08-20 15:02:23:
Donal, 
using [string match *.csv] on each file returned by [glob *] returns 1.

Alex, 
thanks to your "strace"answer on c.l.t  (frequent but good advice!) , I used "procmon".
Result attached in traces.txt.

As you can see, even QueryDirectory doesn't give the same result.

ferrieux added on 2010-08-19 22:45:22:
Reminds me of  http://groups.google.fr/group/comp.lang.tcl/tree/browse_frm/thread/dee9f450a03729f4/ed9e29369fcd9cdb?rnum=1&q=petasis&_done=%2Fgroup%2Fcomp.lang.tcl%2Fbrowse_frm%2Fthread%2Fdee9f450a03729f4%2F551ba8571083d884%3Flnk%3Dgst%26q%3Dpetasis%26safe%3Dimages%26#doc_ed9e29369fcd9cdb

dkf added on 2010-08-19 22:40:58:
Check whether you have any non-printing characters in those filenames?

Attachments: