Skip to content
Tcl Source Code View Ticket
Login

View Ticket

file mtime fails with odd filename

Deleted2d526082e3edd4340cde0659dab59abe27c579fbCreated 11 years agoUpdated 11 years ago
Descriptionplain2016-04-19 10:54:55
Ended up with a messy filename after a 'wget':

2NE1-í%88¬ì%95 ë%8B%88ì%9B%90-Fire-Street-Version-ChaCha-32bpm.mp3

and [file mtime $ffn] creates an exception.

00000030  33 3a 34 31 20 32 4e 45  31 2d ed 25 38 38 ac ec  |3:41 2NE1-.%88..|
00000040  25 39 35 a0 eb 25 38 42  25 38 38 ec 25 39 42 25  |%95..%8B%88.%9B%|
00000050  39 30 2d 46 69 72 65 2d  53 74 72 65 65 74 2d 56  |90-Fire-Street-V|
00000060  65 72 73 69 6f 6e 2d 43  68 61 43 68 61 2d 33 32  |ersion-ChaCha-32|
00000070  62 70 6d 2e 6d 70 33 0a                           |bpm.mp3.|
No newline in the filename, that's from 'ls'.

03:44:13   masterfile:fn:hex:324e45312ded253838acec253935a0eb253842253838ec2539422539302d466972652d5374726565742d56657273696f6e2d4368614368612d333262706d2e6d7033
anonymous (claiming to be [email protected])plain2016-04-19 11:19:59
More information:

could not read "/home/bll/sources/ballroomdj/test.dir/music dir/2NE1-í%88¬ì%95 ë%8B%88ì%9B%90-Fire-Street-Version-ChaCha-32bpm.mp3": no such file or directory
    while executing
"file mtime $ffn"
    (procedure "masterfile::loadfromfile" line 173)
    invoked from within

I tried the below, but the filename created on disk is different and does
not match the problem filename.

#!/usr/bin/tclsh

set fn "2NE1-\xed%88\xac\xec%95 \xa0\xeb%8B%88\xec%9B%90-Fire-Street-Version-ChaCha-32bpm.mp3"
set fh [open $fn w]
close $fh
set flist [glob . *]
puts "flist:$flist"
foreach {f} $flist {
  if { $f eq "." || $f eq "t.tcl" || $f eq "t.tcl~" } {
    continue
  }
  puts "tm:[file mtime $f]"
}

This ticket might be invalid -- I think there's an encoding problem.
wget is supposed to use the system encoding, but from the above,
it looks like it may be
using something else.
anonymous Deleted ticket [2d526082e3]. [History diff]2016-04-19 11:30:04
Log in (anonymous is fine) to add a comment.