Skip to content
Tcl Source Code View Ticket
Login

View Ticket

2009-11-18
09:20 • Closed ticket [2886914fff]: unexpected absolute path with vfs plus 6 other c... artifact: 995e1aa306 user: sf-robot
2009-11-04
01:26 • Pending ticket [2886914fff]. artifact: 0fb0363c63 user: dgp
01:26 • Ticket [2886914fff]: 4 changes artifact: e7eddd945a user: dgp
01:25 • Ticket [2886914fff]: 4 changes artifact: 0943ec7e79 user: dgp
00:38 • Ticket [2886914fff]: 4 changes artifact: f286baf5f7 user: dgp
2009-10-31
12:49 • Open ticket [2886914fff]. artifact: 6f271ca8a7 user: blacksqr
12:49 • Ticket [2886914fff]: 4 changes artifact: 3301871a9a user: blacksqr
2009-10-28
22:39 • Ticket [2886914fff]: 1 change artifact: f60ec7a23a user: dgp
22:38 • Pending ticket [2886914fff]. artifact: dc810da57c user: dgp
22:38 • Ticket [2886914fff]: 4 changes artifact: dbd9fb4da4 user: dgp
12:47 • Open ticket [2886914fff]. artifact: c0ab806402 user: blacksqr
12:47 • Ticket [2886914fff]: 4 changes artifact: 028dcf4131 user: blacksqr
00:23 • Ticket [2886914fff]: 4 changes artifact: 119b98df60 user: dgp
2009-10-27
21:53 • Pending ticket [2886914fff]. artifact: 0d4544ae10 user: dgp
21:53 • Ticket [2886914fff]: 4 changes artifact: 8d73714cca user: dgp
13:02 • Add attachment templatevfs.tcl to ticket [2886914fff] artifact: 7f7cc6b24b user: blacksqr
13:02 • Ticket [2886914fff] "file join" improperly injects space status st... artifact: 58579eb13f user: blacksqr
06:02 • New ticket [2886914fff]. artifact: 0502b0b3a1 user: blacksqr

unexpected absolute path with vfs

Closed2886914fffffffffffffffffffffffffffffffffCreated 17 years agoUpdated 17 years ago
Descriptionplain2009-10-27 06:02:17
When using "file join" on a string that happens to include a virtual volume name as a substring, the string is improperly split at the substring boundary, and the command acts as though there were a space at the substring boundary.

For convenience I have attached a file (templatevfs.tcl) to make it easy to create a virtual volume by mounting a virtual filesystem, but the issue should not be construed as limited to this vfs.

Example:

% cd
% file mkdir testvfs
% source templatevfs.tcl
% vfs::template::mount -volume testvfs testvfs
testvfs
%file volumes ; # note testvfs is now a virtual volume
testvfs /
% file join testvfstest ; # expect response: testvfstest
testvfs/test

Note in the last statement "testvfstest" is an arbitrary string which just happens to start with "testvfs".  The command "file join testvfstest" should simply echo the argument string.  But the command acts as if there were a space between "testvfs" and "test".

Also note:

% file join foo testvfstest
testvfs/test

Discarding "foo" would be expected if there were a space between "testvfs" and "test", since the command discards arguments that come before a volume name.  But the response should be "foo/testvfstest".  This illustrates that "testvfs" is being treated as a volume name rather than as a substring. 

Tested on Ubuntu Hardy.
blacksqrplain2009-10-27 13:02:20
File Added - 348324: templatevfs.tcl
dgpplain2009-10-27 21:53:18
At the point of failure, what does
[file pathtype testvfstest] return?
dgp Pending ticket [2886914fff]. [History diff]2009-10-27 21:53:19
dgpplain2009-10-28 00:23:03
The values returned by [file system testvfstest]
and [file normalize testvfstest] might be useful
as well.
blacksqrplain2009-10-28 12:47:49
After executing the steps above:

% file join testvfstest
testvfs/test
% file pathtype testvfstest
absolute
% file system testvfstest
native
% file normalize testvfstest
<home>/testvfs/test
blacksqr Open ticket [2886914fff]. [History diff]2009-10-28 12:47:51
dgpplain2009-10-28 22:38:37
Thanks for the replies.

Since "testvfstest" is seen as
an absolute path, [file join] is behaving
properly as documented.

The bug, if there is one, is the combination
of results you just posted.  Whether the
flaw is in Tcl, tclvfs, the vfs::template driver,
or your code, I cannot say without diving
deeper.  Can you, or someone in any
of those projects say with more clarity,
which of the command outcomes you
posted are incorrect, and why?

Thanks.
dgp Pending ticket [2886914fff]. [History diff]2009-10-28 22:38:38
dgp Ticket [2886914fff]: 1 change [History diff]2009-10-28 22:39:12
blacksqrplain2009-10-31 12:49:32
It is incorrect for [file pathtype] to return a value of "absolute" in the given example.  Since there is no path separator in the string "testvfstest", the only time [file pathtype testvfstest] should return "absolute" would be if there were a mounted volume named "testvfstest", but there isn't.  

It is also incorrect for [file join testvfstest] to return "testvfs/test", even if it were correct that testvfstest was an absolute path.  If [file join] is passed an absolute path as the sole argument, the argument should be returned unchanged.  If [file join] is passed an arbitrary string that doesn't correspond to an existing file, the string should also be returned unchanged.  Whichever is the case, [file join] should simply pass the argument back unchanged.

There is no file or volume named "testvfstest".  The handler code written by me is not called when either the [file pathtype] command or the [file join] command is executed.  Thus the problem is either with Tcl or the Tclvfs extension.
blacksqr Open ticket [2886914fff]. [History diff]2009-10-31 12:49:35
dgpplain2009-11-04 00:38:10
Reproduced on all the branches 8-4, 8-5, and HEAD,
as well as in the 8.4.0 release.
dgpplain2009-11-04 01:25:25
This looks like part operator error, and part a bug
in either tclvfs or the driver.

The mount command created a new
volume "testvfs" which means *every*
path that begins with that substring is
now an absolute pathname in the filesystem
controlling that volume.  This is why
[file pathype testvfstest] is reporting "absolute".

If what you really wanted was to only have
pathnames beginning with "testvfs/" to be
in the volume, then I think the command
should  have been:

vfs::template::mount -volume testvfs testvfs/

See if you are happier with the results of that
change.  At a minimum that is a workaround.

A bug which seems to be contributing to
problems is that if all paths beginning with the
prefix substring "testvfs" are now to belong to
that volume, then they should be claimed by
the filesystem that has control over that volume,
which means

[file system testvfstest] => native

is an incorrect result.  This seems likely
to me to be a failure of the filesystem driver
to claim a path that belongs to it.  Precisely
where that bug is, I do not yet know.
dgpplain2009-11-04 01:26:49
If you have a different understanding about
how these things are supposed to properly
work, please point me to the docs that support
your view.
dgp Pending ticket [2886914fff]. [History diff]2009-11-04 01:26:51
sf-robotplain2009-11-18 09:20:21
allow_comments - 1

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).
Log in (anonymous is fine) to add a comment.

Attachments: