Overview
| Artifact ID: | 3186ba3490976639b7e6809e65cdf707a8290a60 |
|---|---|
| Ticket: | 678662ffffffffffffffffffffffffffffffffff
Tcl needs 'file normalize -full' and similar C api. |
| User & Date: | jcw on 2003-02-01 13:44:10 |
Changes
- assignee changed to: "vincentdarley"
- cmimetype changed to: "text/plain"
- comment changed to:
Below a transcript which I can not figure out. All based on the latest CVS, Feb 1. FYI, I added a debug puts to tclkit's boot.tcl, showing the mount command it sets up on startup: try $ mkdir foo try $ cd foo/ foo $ ln -s ../tclkit bar foo $ cd .. try $ foo/bar vfs::filesystem mount /home/shared/basekit/tclkit/try/foo/bar ::vfs::mk4::handler exe application-specific initialization failed: unknown encoding "iso8859-1" % vfs::filesystem info /home/shared/basekit/tclkit/tclkit % info nameofexe /home/shared/basekit/tclkit/try/foo/bar % pwd /home/shared/basekit/tclkit/try % The weird part is the output of "vfs::filesystem info". That path was how tclkit was originally built, but I've moved it inside "try/", so it does not exist. Note that the symlink is relative, it has a ".." in it. This is a tricky case. There seems to be something hosed, I'm checking into it. In the same case as above - watch this: try $ ./tclkit vfs::filesystem mount /home/shared/basekit/tclkit/try/tclkit ::vfs::mk4::handler exe % file readlink foo/bar ../tclkit % file size foo/bar 3011296 % open foo/bar file4 % open [file readlink foo/bar] couldn't open "../tclkit": no such file or directory Everything appears to be ok, this shows that open and open/readlink are not identical (logical, though perhaps not expected). Explanation: the ".." in the symlink would need to be resolved against the dir in which the symlink resides. Now compare with running the same tclkit executable through a symlink: try $ foo/bar vfs::filesystem mount /home/shared/basekit/tclkit/try/foo/bar ::vfs::mk4::handler exe application-specific initialization failed: unknown encoding "iso8859-1" % file readlink foo/bar ../tclkit % file size foo/bar 3011296 % open foo/bar file4 % seek file4 0 end % tell file4 3011296 % open [file readlink foo/bar] mk1 % read mk1 % file stat foo/bar sb % array get sb mtime 1044103928 atime 1044103927 gid 100 nlink 1 mode 33261 type file ctime 1044103953 uid 500 ino 273302 size 3011296 dev 778 % seek mk1 0 end error during seek on "mk1": Success % tell mk1 -1 % This second case shows that the original path still looks like a file (the tclkit executable), but opening the dereferenced symlink ends up being inside VFS. I don't understand what it is, the "file" seems to be bogus (rightly so maybe, since the thing *should* be a mountpoint now, i.e. a dir). Looks like a couple of things are not right. I'm not sure exactly *what* the correct results for all these cases should be, but wanted to pass this on. It all came about when I noticed that symlinked starkits did not mount properly. I started adding some code, but it's getting hairy. Would it be better if "file readlink" returned a path which was fully resolved? The way it is now, it looks like translating a symlink to the real file will require some nasty path trickery. What I can think of so far to deal with relative symlinks on Unix is: set f [file join [file dirname $f] [file readlink $f]] Yikes...
- foundin changed to: "None"
- priority changed to: "5 Medium"
- resolution changed to: "None"
- status changed to: "Open"
- submitter changed to: "jcw"
- subsystem changed to: "37. File System"
- title changed to: "symlinks and mountpoints - confused?"
- type changed to: "RFE"