Tcl Source Code

View Ticket
Login
Ticket UUID: 634151
Title: [file mtime f time] don't work correctly
Type: Bug Version: obsolete: 8.4.1
Submitter: nobody Created on: 2002-11-05 23:10:41
Subsystem: 37. File System Assigned To: hobbs
Priority: 7 High Severity:
Status: Closed Last Modified: 2003-01-09 17:40:46
Resolution: Fixed Closed By: vincentdarley
    Closed on: 2003-01-09 10:40:46
Description:
when file name contain non ascii characters.

OS - Linux

% glob *
ótest       (ótest == \u00F3test)
% file mtime ótest
1036534240
% file mtime ótest [file mtime ótest]
could not set modification time for file "ótest": no
such file or directory
User Comments: vincentdarley added on 2003-01-09 17:40:46:
Logged In: YES 
user_id=32170

Tested fix on unix -- works fine, so committed.

vincentdarley added on 2003-01-08 17:53:12:

File Deleted - 37207: 



File Added - 39163: mtimeDiff.patch

Logged In: YES 
user_id=32170

Updated patch for latest tcl/tk head, and tested again.

vincentdarley added on 2002-12-10 01:43:39:

File Added - 37207: fileMtime.diff

Logged In: YES 
user_id=32170

Please find attached a patch to fix this problem.  It
includes a new test to test for the fix.

Please test on unix and apply to cvs if it works.

vincentdarley added on 2002-11-07 05:34:34:
Logged In: YES 
user_id=32170

Please see these lines in tclIOUtil.c:

/* 
 * utime wants a normalized, NOT native path.  I assume a native
 * version of 'utime' doesn't exist (at least under that
name) on NT/2000.
 * If a native function does exist somewhere, then we could use:
 * 
 *   return native_utime(Tcl_FSGetNativePath(pathPtr),tval);
 *   
 * This seems rather strange when compared with stat, lstat,
access, etc.
 * all of which want a native path.
 */
static int 
NativeUtime(pathPtr, tval)
    Tcl_Obj *pathPtr;
    struct utimbuf *tval;
{
#ifdef MAC_TCL
    long gmt_offset=TclpGetGMTOffset();
    struct utimbuf local_tval;
    local_tval.actime=tval->actime+gmt_offset;
    local_tval.modtime=tval->modtime+gmt_offset;
    return
utime(Tcl_GetString(Tcl_FSGetNormalizedPath(NULL,pathPtr)),
 &local_tval);
#else
    return
utime(Tcl_GetString(Tcl_FSGetNormalizedPath(NULL,pathPtr)),tval);
#endif
}

it appears as if on linux there is a native utime, and so
the code needs changing.  I'm assigning this to Jeff since
the basic code which didn't use native paths was, I think,
written by him.

I really don't know what platforms/OSes want native paths
here.  The same bug will be in all preceding Tcl versions
which support 'file mtime $f $time', I believe.

Attachments: