Tk Library Source Code

View Ticket
Login
Ticket UUID: 2499603
Title: fileutil::jail returns wrong results in repeated execution
Type: Bug Version: None
Submitter: apnadkarni Created on: 2009-01-11 17:00:24
Subsystem: fileutil Assigned To: andreas_kupries
Priority: 5 Medium Severity:
Status: Closed Last Modified: 2009-09-25 05:29:33
Resolution: Fixed Closed By: andreas_kupries
    Closed on: 2009-09-24 22:29:33
Description:
See console output below:

(woof) 48 % package require fileutil
1.13.5
(woof) 49 % ::fileutil::jail /temp /a
/temp/a
(woof) 50 % ::fileutil::jail /temp /a
/a
(woof) 51 % ::fileutil::jail /temp /b
/temp/b
(woof) 52 % ::fileutil::jail /temp /b
/b

I see this as pretty serious given the intent of jail is to provide some level of security.

Platform is Tcl 8.6b1 on XP

/Ashok
User Comments: andreas_kupries added on 2009-09-25 05:29:33:

allow_comments - 1

andreas_kupries added on 2009-09-25 05:29:31:
IIRC this was something bad in the core, and has been fixed there. Closing.

apnadkarni added on 2009-02-06 14:35:42:
I've added a bug for this to the Tcl SF bugtracker - 2571597

(woof) 1 % file pathtype /a
volumerelative
(woof) 2 % file normalize /a
C:/a
(woof) 3 % file pathtype /a
relative

/Ashok

apnadkarni added on 2009-02-06 13:56:36:
I just verified that Tcl 8.4.19 does not exhibit this bug using the same fileutil version (1.13.5) that was being used with Tcl 8.6b1. So it does appear something has changed in the core.

/Ashok

apnadkarni added on 2009-02-06 09:15:15:
Looks like you might be right.  filutil 1.13.4 on Tcl 8.4.19 does not exhibit this behaviour. fileutil 1.13.5 on Tcl 8.6b1 does. Both on XP SP2. I'll load the same tcllib on the 8.4 installation and try it there. That should confirm it.

/Ashok

andreas_kupries added on 2009-02-06 06:49:08:
Can you please test this against older versions of the Tcl core (8.5, 8.4) and/or on other platforms ?

I am asking because when I tried to reproduce the problem, using Tcl 8.4.15 and 8.5.3, both on Linux, I do not have any trouble. I used fileutil 1.13.6 (CVS Head). The only difference to 1.13.5 is the fix to make stripPath case-insensitive on Windows.

I have a feeling that this is exposing a bug in the handling of paths by the Tcl core.

My session logs

andreask@gila:~/workbench/u/tcllib/modules/fileutil> tclsh
% source fileutil.tcl
% package provide fileutil
1.13.6
% info patchlevel
8.4.15
% fileutil::jail /temp /a
/temp/a
% fileutil::jail /temp /a
/temp/a
% fileutil::jail /temp /a
/temp/a
% fileutil::jail /temp /a
/temp/a
%

andreask@gila:~/workbench/u/tcllib/modules/fileutil> ~/Abuild/bin/tclsh8.5
% source fileutil.tcl
% package provide fileutil
1.13.6
% info patchlevel
8.5.3
%  fileutil::jail /temp /a
/temp/a
%  fileutil::jail /temp /a
/temp/a
%  fileutil::jail /temp /a
/temp/a
%