Strange glob bad result
Closed / Out of Date3048726fffffffffffffffffffffffffffffffffCreated 16 years agoUpdated 49 days ago
Descriptionplain2010-08-19 15:12:43
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".
dkfplain2010-08-19 22:40:58
Check whether you have any non-printing characters in those filenames?
ferrieuxplain2010-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
bericplain2010-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.
bericplain2010-08-20 15:03:28
File Added - 384025: traces.txt
ferrieuxplain2010-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 ?
bericplain2010-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.
beric Closed ticket [3048726fff].
[History diff]2010-08-20 21:40:41
ferrieuxplain2010-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 ;-)
bericplain2010-08-20 22:17:25
File Added - 384065: glob_csv.pcap
bericplain2010-08-20 22:17:57
File Added - 384066: glob_with_star.pcap
bericplain2010-08-20 22:31:37
You're right, here are the captures.
ferrieuxplain2010-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).
bericplain2010-08-23 14:56:08
"dir *.csv" gives the same result as glob. Using procmon, it also calls QueryDirectory with *.csv filter.
ferrieuxplain2010-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)
bericplain2010-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...
dkf Pending ticket [3048726fff].
[History diff]2016-08-20 17:07:32
serhiy.storchakawiki2026-10-15 11:29:06
Closing: no reply since 2016.
Log in (anonymous is fine) to add a comment.
Attachments:
- glob_with_star.pcap [download] added by beric on 2010-08-20 22:17:57. [details]
- glob_csv.pcap [download] added by beric on 2010-08-20 22:17:25. [details]
- traces.txt [download] added by beric on 2010-08-20 15:03:28. [details]