Skip to content
Tcl Source Code View Ticket
Login

View Ticket

2009-08-14
09:07 • Ticket [2837204fff] glob on realtive patterns and dirs is thread "unsafe&qu... artifact: c4047a6df5 user: das
2009-08-13
22:39 • New ticket [2837204fff]. artifact: 933e99bfe8 user: dgp

glob on realtive patterns and dirs is thread "unsafe"

Open2837204fffffffffffffffffffffffffffffffffCreated 17 years agoUpdated 17 years ago
Descriptionplain2009-08-13 22:39:32
[glob] gets implemented recursively and depending
on the switches and patterns can result in a whole
tree of calls to Tcl_FSMatchInDirectory().  If the
directories are named by relative paths, then they
are taken relative to the cwd - which is a process wide
value that can be changed at arbitrary times by
other threads in the process.  This means that
some portions of the [glob] search might take
place with different [pwd] values than other portions,
and the assembled list of [glob] results does not
actually represent any properly functioning,
consistent filesystem search.

In concept, the fix would be to determine [pwd]
once at the beginning of the glob operation and
then take care to pass it down the whole tree
of operations for consistent results rooted on
/some/ consistent value of [pwd].

Low priority, I think, but wanted to record the
issue while I noticed it.
dasplain2009-08-14 09:07:18
Not directly related, but FWIW I remember a similar issue with [file normalize] and threading on early versions of Darwin where the realpath() implementation was changing the cwd internally... (messing up all relative path processing in all other threads).
Log in (anonymous is fine) to add a comment.