|
2009-08-13
| ||
| 04:23 | • Closed ticket [858937ffff]: problems with file paths containing tilde character<... artifact: 29ea6cdaea user: dgp | |
|
2004-03-08
| ||
| 02:07 | • Ticket [858937ffff]: 4 changes artifact: 8733133c4b user: vasiljevic | |
| 01:49 | • Ticket [858937ffff]: 5 changes artifact: 95b41de36c user: vincentdarley | |
|
2004-03-05
| ||
| 19:22 | • Open ticket [858937ffff]. artifact: 9afca86877 user: vasiljevic | |
|
2003-12-13
| ||
| 00:26 | • Closed ticket [858937ffff]. artifact: d7127e1cab user: vincentdarley | |
|
2003-12-12
| ||
| 23:27 | • Ticket [858937ffff]: 4 changes artifact: 1d963d9846 user: vincentdarley | |
| 14:44 | • New ticket [858937ffff]. artifact: 9b7cee1311 user: cjmcdonald | |
problems with file paths containing tilde character
Closed / Fixed858937ffffffffffffffffffffffffffffffffffCreated 23 years agoUpdated 17 years ago
Descriptionplain2003-12-12 14:44:27
There are some problems with the processing of file paths containing a ~ tilde character. Tcl 8.4.5 - Unix (Solaris) and Windows (NT4). ------------------------------------------- 1) "file normalize" crashes if an invalid user name is specified: $ tclsh % file normalize ~baduser/readme.txt Segmentation fault (core dumped) ------------------------------------------- 2) For file names which actually start with a tilde the "glob -tails" processing is inconsistent with "file tail": If I have a file /home/mcdonald/temp/~test.dat, then "file tail" produces "./~test.dat", which subsequently can be used correctly with "file join" in order to reconstruct a full file path: $ tclsh % set fname [file tail /home/mcdonald/temp/~test.dat] ./~test.dat % set fspec [file join /home/mcdonald/temp $fname] /home/mcdonald/temp/~test.dat But "glob -tails" returns a file list including "~test.dat", which is assumed to be an absolute file specification by "file join": $ tclsh % set dir /home/mcdonald/temp /home/mcdonald/temp % set fnames [glob -tails -directory $dir *.dat] ~test.dat xyzzy.dat % set fspec [file join $dir [lindex $fnames 0]] ~test.dat So the output from "glob -tails" cannot subsequently be used reliably to reconstruct full file paths with "file join". I think that for files starting with a tilde character "glob -tails" should return ./~test.dat, the same as "file join". ------------------------------------------- 3) The filename.n manpage states in the "Tilde Substitution" section that "The Macintosh and Windows platforms do not support tilde substitution when a user name follows the tilde." That has not been the case on Windows for several releases e.g. ~mcdonald/readme.txt works on Windows.
vincentdarleyplain2003-12-12 23:27:16
Logged In: YES user_id=32170 It's best if you can report bugs separately, if you can. But... (1) Bad bug -- I can reproduce it and will set about fixing it. (2) There have been discussions on this before. Also note the long-standing behaviour of good-old 'glob *' which also doesn't do anything special with '~'. The conclusions last time this was discussed were that this is not a bug, and it is easy for the user to deal with anyway. (3) That's a good point and we should update that man page, and also probably update 'glob's manpage to indicate that (2) is not a bug. Thanks!
vincentdarleyplain2003-12-13 00:26:20
Logged In: YES user_id=32170 Thanks -- fixed all these issues (although number (2) perhaps not in the way you would desire).
vasiljevicplain2004-03-05 19:22:23
Logged In: YES user_id=95086 I have opened this one again. I strongly think that the original poster is right, i.e. [glob -tails] should produce paths which can be safely processed by [file] commands in respect to tilde-filenames. I would really appreciate to hear about why's and even more about why not's. Zoran
vincentdarleyplain2004-03-08 01:49:27
Logged In: YES user_id=32170 I think the best solution is for interested parties to file a TIP to make the "glob" behaviour change, and see if you can convince the TCT. I actually have no strong feelings either way, but since I'm not on the TCT, I'm not the one you have to convince anyway.
vasiljevicplain2004-03-08 02:07:08
Logged In: YES user_id=95086 Vince, this sounds as a reasonable idea. The response on the c.l.t has shown that people would rather see [file] command *not* treating the tilde-files, not the [glob] itself. I do not personaly care wether it is this way or another. The main point is to make the entire beast *safe*. As it is now, it is very easy to get trapped and produce lots of damage. Lets see if something pops out on the c.l.t. and if we can get some consensus what to do (if at all). I will leave this bug-report on "remind" state for some time. After we get some sort of a direction, the TIP will be on the way.
dgpplain2009-08-13 04:23:14
allow_comments - 1 The remaining open issue in this report is duplicated in 2511011. Continue tracking it there.
Log in (anonymous is fine) to add a comment.