Skip to content
Tcl Source Code View Ticket
Login

View Ticket

[file mtime f time] don't work correctly

Closed / Fixed634151ffffffffffffffffffffffffffffffffffCreated 24 years agoUpdated 24 years ago
Descriptionplain2002-11-05 23:10:41
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
vincentdarleyplain2002-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.
vincentdarleyplain2002-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.
vincentdarleyplain2003-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 Closed ticket [634151ffff]. [History diff]2003-01-09 17:40:45
vincentdarleyplain2003-01-09 17:40:46
Logged In: YES 
user_id=32170

Tested fix on unix -- works fine, so committed.
Log in (anonymous is fine) to add a comment.

Attachments: