Skip to content
Tcl Source Code View Ticket
Login

View Ticket

2006-05-28
09:21 • Closed ticket [943995ffff]: glob inconsistency with VFS plus 2 other changes artifact: a107d6c1e2 user: sf-robot
09:21 • Ticket [943995ffff]: 4 changes artifact: dec8f7d5e4 user: sf-robot
2006-05-14
06:21 • Ticket [943995ffff]: 7 changes artifact: 1b4fc55735 user: dgp
06:21 • Pending ticket [943995ffff]. artifact: b38bf8d153 user: dgp
2006-05-12
04:06 • Add attachment 943995.patch to ticket [943995ffff] artifact: b5d3a07dac user: dgp
04:06 • Ticket [943995ffff] glob inconsistency with VFS status still Open with 4 oth... artifact: 4fdf526b0c user: dgp
04:06 • Ticket [943995ffff]: 5 changes artifact: 92cb3a421a user: dgp
03:05 • Ticket [943995ffff]: 4 changes artifact: 4d667dfbe0 user: dgp
2006-03-31
23:18 • Ticket [943995ffff]: 1 change artifact: 781fb172f3 user: dgp
2006-03-10
12:22 • Ticket [943995ffff]: 6 changes artifact: ea455df83e user: dgp
2004-12-17
01:38 • Ticket [943995ffff]: 5 changes artifact: 639994ebe1 user: vincentdarley
2004-12-16
05:27 • Open ticket [943995ffff]. artifact: 313dc71cbe user: dgp
2004-05-07
20:09 • Closed ticket [943995ffff]. artifact: 1a9e593ca6 user: vincentdarley
05:39 • Ticket [943995ffff]: 4 changes artifact: 7a2146c30e user: dgp
02:18 • Ticket [943995ffff]: 4 changes artifact: 0892d295d5 user: vincentdarley
02:18 • Add attachment vfsGlobVol.patch to ticket [943995ffff] artifact: f0410c5831 user: vincentdarley
02:18 • Ticket [943995ffff] glob inconsistency with VFS status still Open with 4 oth... artifact: 500faf938c user: vincentdarley
2004-04-30
19:18 • Ticket [943995ffff]: 4 changes artifact: 337851231d user: vincentdarley
05:13 • Ticket [943995ffff]: 4 changes artifact: 4c4f07eeae user: vincentdarley
02:22 • Ticket [943995ffff]: 4 changes artifact: e5d4467fd3 user: dgp
01:59 • Ticket [943995ffff]: 4 changes artifact: 3f8b7740fd user: vincentdarley
2004-04-28
20:50 • New ticket [943995ffff]. artifact: 309bc4fc38 user: dgp

glob inconsistency with VFS

Closed / Fixed943995ffffffffffffffffffffffffffffffffffCreated 23 years agoUpdated 21 years ago
Descriptionplain2004-04-28 20:50:38
Using a package that provides a virtual
filesystem:

% file volumes       
trofs:// /
% file isdirectory trofs://1/modules
1
% glob -directory trofs://1/modules *
trofs://1/modules/base64-2.3.tm
trofs://1/modules/cmdline-1.2.2.tm
trofs://1/modules/msgcat-1.4.1.tm
trofs://1/modules/struct-2.0.tm
trofs://1/modules/http-2.4.4.tm
trofs://1/modules/log-1.1.tm
trofs://1/modules/htmlparse-1.0.tm
trofs://1/modules/textutil-0.6.tm
% glob trofs://1/modules/*
no files matched glob pattern "trofs://1/modules/*"

Something amiss in [glob] ?
vincentdarleyplain2004-04-30 01:59:51
Logged In: YES 
user_id=32170

Looks like a bug in glob, indeed.  Most likely following
this comment in tclFileName.c:

    /* 
     * Handling empty path prefixes with glob patterns like
'C:' or
     * 'c:////////' is a pain on Windows if we leave it too
late, since
     * these aren't really patterns at all!  We therefore
check the head
     * of the pattern now for such cases, if we don't have
an unquoted
     * prefix yet.
     * 
     * Similarly on Unix with '/' at the head of the pattern
-- it
     * just indicates the root volume, so we treat it as such.
     */

Probably the code after that should check whether the
pattern's head matches any of 'file volumes'?
dgpplain2004-04-30 02:22:03
Logged In: YES 
user_id=80530


Ah.  Does that mean if I choose
a volume prefix that doesn't
include // I can avoid the problem?
vincentdarleyplain2004-04-30 05:13:03
Logged In: YES 
user_id=32170

I'm not sure that'll help.  I think the code I pointed to needs to be 
fixed to ensure the volume name is shifted from the pattern to the 
path, since otherwise I think the code (DoGlob) that is called will 
do the wrong thing.
vincentdarleyplain2004-04-30 19:18:31
Logged In: YES 
user_id=32170

That doesn't help.  Here are some new tests for
fileSystem.test (one passes, two fail), which illustrate the
problem.

test filesystem-7.3.1 {glob in simplefs} \
  {testsimplefilesystem} {
    set dir [pwd]
    cd [tcltest::temporaryDirectory]
    file mkdir simpledir
    close [open [file join simpledir simplefile] w]
    testsimplefilesystem 1
    set res [glob -nocomplain simplefs:/simpledir/*]
    eval lappend res [glob -nocomplain simplefs:/simpledir]
    testsimplefilesystem 0
    file delete -force simpledir
    cd $dir
    set res
} {simplefs:/simpledir/simplefile simplefs:/simpledir}

test filesystem-7.3.2 {glob in simplefs} \
  {testsimplefilesystem} {
    set dir [pwd]
    cd [tcltest::temporaryDirectory]
    file mkdir simpledir
    close [open [file join simpledir simplefile] w]
    testsimplefilesystem 1
    set res [glob -nocomplain simplefs:/s*]
    testsimplefilesystem 0
    file delete -force simpledir
    cd $dir
    if {[llength $res] > 0} {
set res "ok"
    } else {
        set res "no files found with 'glob -nocomplain
simplefs:/s*'"
    }
} {ok}

test filesystem-7.3.3 {glob in simplefs} \
  {testsimplefilesystem} {
    set dir [pwd]
    cd [tcltest::temporaryDirectory]
    file mkdir simpledir
    close [open [file join simpledir simplefile] w]
    testsimplefilesystem 1
    set res [glob -nocomplain simplefs:/*]
    testsimplefilesystem 0
    file delete -force simpledir
    cd $dir
    if {[llength $res] > 0} {
set res "ok"
    } else {
set res "no files found with 'glob -nocomplain simplefs:/s*'"
    }
} {ok}

I'll be unable to look at this further for the next week, at
least.
vincentdarleyplain2004-05-07 02:18:05
Logged In: YES 
user_id=32170

Attached a patch to fix this bug.  Please test.

(It includes new tests in Tcl test suite, but I obviously
can't test your 'trofs').
vincentdarleyplain2004-05-07 02:18:06
File Added - 86315: vfsGlobVol.patch
dgpplain2004-05-07 05:39:57
Logged In: YES 
user_id=80530

Yes, that appears to correct the problem, thanks.
vincentdarleyplain2004-05-07 20:09:15
Logged In: YES 
user_id=32170

Fixed in cvs head.
dgpplain2004-12-16 05:27:57
Logged In: YES 
user_id=80530

Ack!  This fix never made it
back into 8.4 ?!
vincentdarleyplain2004-12-17 01:38:10
Logged In: YES 
user_id=32170

The problem is that the 8.5 and 8.4 codebases have diverged
sufficiently that each requires its own fix.  Unfortunately
my time precludes doing both at the moment if that is
complicated. I try to do both if the fix is similar, but
sometimes it isn't.  There are now a number of filesystem
fixes in 8.5 which are not in 8.4, and probably never will
be, unless someone decides simply to replace 8.4's
filesystem with 8.5's.
dgpplain2006-03-10 12:22:23
Logged In: YES 
user_id=80530


sure would like this to be
backported for 8.4.13.  I'll
at least take a look.
dgp Ticket [943995ffff]: 1 change [History diff]2006-03-31 23:18:24
dgpplain2006-05-12 03:05:55
Logged In: YES 
user_id=80530


Aha!

Looking this over again, and
the problem I have with 8.4.*
is in TclDoGlob().

That routine is designed to 
be recursive, and passes two
arguments, headPtr and tail
down the recursive stack,
each time holding a different
partition of the pathname pattern
we're globbing for.

The problem is that as the
stack of calls shifts more
of the path from tail to head,
it tries to do some normalization
along the way.  Turning //// runs
into / and that sort of thing.
Trouble with that is, when we
have a virtual filesystem system
in place, normalization isn't 
something you can do reliably
as a local operations, it requires
cooperation of all the Tcl_Filesystem
drivers to be sure that the changes
don't move a path out of one
Tcl_Filesystem and into another one.

In the reported example, the pattern

  trofs://1/modules/*  

gets transformed to

  trofs:/1/modules/*

and this takes it out of the
trofs filesystem and into
the native filesystem, where
the glob comes up empty.

The fix is to revise TclDoGlob
so that as it shifts things
from tail to head, the only
revisions it can make are those
dictated by the special chars
of glob patterns.  Working on
that patch now.
dgpplain2006-05-12 04:06:26
Logged In: YES 
user_id=80530


Here's a patch against
Tcl 8.4.13 that needs
testing on Windows before
acceptance.
dgpplain2006-05-12 04:06:27
File Added - 177634: 943995.patch
dgp Pending ticket [943995ffff]. [History diff]2006-05-14 06:21:50
dgpplain2006-05-14 06:21:51
Logged In: YES 
user_id=80530


committed for 8.4.14
please test
sf-robotplain2006-05-28 09:21:06
Logged In: YES 
user_id=1312539

This Tracker item was closed automatically by the system. It was
previously set to a Pending status, and the original submitter
did not respond within 14 days (the time period specified by
the administrator of this Tracker).
sf-robot Closed ticket [943995ffff]. [History diff]2006-05-28 09:21:07
Log in (anonymous is fine) to add a comment.

Attachments: