Menu

#2817 file normalize returns wrong path

obsolete: 8.4.6
closed-duplicate
5
2004-07-31
2004-07-26
Ulrich Ring
No

Run this example. It prints "/tmp/foo/bar" instead of
"/tmp/xxx/bar" .

#
-----------------------------------------------------------
cd /tmp ;# working directory
file delete -force foo xxx ;# make clean
file mkdir foo/bar ;# some directories
file link xxx foo ;# xxx -> foo

set target xxx/bar ;# store path of
subdirectory in variable
file isdirectory $target ;# check xxx/bar
file delete xxx ;# now delete symlink
file copy foo xxx ;# recreate as copy of bar

puts [file normalize $target]
#
----------------------------------------------------------

Comments:

(1) uncomment "file isdirectory ..." and it's OK
(2) change to "file isdirectory xxx/bar" and it's OK

I assume that the path /tmp/foo/bar is cached in the
variable "target" (in Tcl_Obj's internal representation).

Having "string length $target" _after_ "file
isdirectory $target"
changes variable to string type and things are OK.

-----
Ulrich Ring - ur@daveg.com

Discussion

  • Don Porter

    Don Porter - 2004-07-27
    • status: open --> pending
     
  • Don Porter

    Don Porter - 2004-07-27
    • labels: 105657 --> 37. File System
    • assigned_to: dkf --> vincentdarley
    • status: pending --> pending-duplicate
     
  • Don Porter

    Don Porter - 2004-07-27

    Logged In: YES
    user_id=80530

    Looks like a Duplicate of 953284

     
  • Ulrich Ring

    Ulrich Ring - 2004-07-27
    • status: pending-duplicate --> open-duplicate
     
  • Ulrich Ring

    Ulrich Ring - 2004-07-27

    Logged In: YES
    user_id=123371

    BTW:

    I'm not able to reproduce the bug with tcl8.5a1.

     
  • Don Porter

    Don Porter - 2004-07-31
    • status: open-duplicate --> closed-duplicate
     
MongoDB Logo MongoDB