Artifacts Associated With Ticket 417111ffffffffff
Ticket change [75f0361953] (rid 105480) by hemanglavana on 2001-04-18 17:03:16:
- assignee initialized to: "nobody"
- cmimetype initialized to: "text/plain"
- comment initialized to:
On solaris2.6 platform, if a directory contains a softlink that refers to a non-existant file, then the above glob command results in error/abort: hlavana-u5:6> ls -l total 16 -rw-r--r-- 1 hlavana eng8 0 Apr 18 10:00 junk lrwxrwxrwx 1 hlavana eng8 4 Apr 18 09:06 link -> junk hlavana-u5:7> ~/sw/bin/tclsh8.3 % info patch 8.3.3 % glob -type r * link junk % file delete junk % glob -type r * stat failed on known file Abort hlavana-u5:8> Hemang.
- foundin initialized to: "obsolete: 8.3.3"
- priority initialized to: "5 Medium"
- resolution initialized to: "None"
- status initialized to: "Open"
- submitter initialized to: "hemanglavana"
- subsystem initialized to: "37. File System"
- title initialized to: "error in "glob -type r *""
- type initialized to: "Bug"
Ticket change [f693835675] (rid 130325) by dgp on 2001-04-19 01:18:12:
- subsystem changed to: "36. Pathname Management"
- title changed to: "error in "glob -type r *""
Ticket change [1aa35632eb] (rid 123013) by hobbs on 2001-08-07 07:25:19:
- assignee changed to: "vincentdarley"
- icomment:
Logged In: YES user_id=72656 Verified on Linux. The stat should be caught somehow internally.
- login: "hobbs"
- mimetype: "text/plain"
- title changed to: "error in "glob -type r *""
- username: "hobbs"
Add attachment "panic.diff" [07fd699c9b] (rid 89492) by vincentdarley on 2001-08-09 00:33:13.
Ticket change [a86e62bc4a] (rid 98991) by vincentdarley on 2001-08-09 00:33:13:
- icomment:
File Added - 9378: panic.diff Logged In: YES user_id=32170 This behaviour is clearly determined here in tclUnixFile.c: if (TclpStat(fname, &buf) != 0) { panic("stat failed on known file"); } Perhaps a better solution to this would be that in the attached patch (which I should point out I have no way of testing at all). - login: "vincentdarley"
- mimetype: "text/plain"
- title changed to: "error in "glob -type r *""
- username: "vincentdarley"
- icomment:
Ticket change [ab8f3d7bc3] (rid 101137) by dkf on 2001-08-10 15:18:54:
- icomment:
Logged In: YES user_id=79902 The patch looks OK to me, though it is still possible for the panic() to be invoked in an unfortunate way if a file gets deleted between the readdir() and the TclpLstat(), which could happen (for example) if the OS decided to switch to another process when the stat() was performed. All this leads me to ask whether panic() is really the right behaviour here, or whether it would be better to just fail that directory entry silently, pretending that it was never there in the first place. What is certain is that panic() is not an appropriate response to a bad link!
- login: "dkf"
- mimetype: "text/plain"
- title changed to: "error in "glob -type r *""
- username: "dkf"
- icomment:
Ticket change [1e79c92843] (rid 90985) by hemanglavana on 2001-08-13 20:44:54:
- icomment:
Logged In: YES user_id=81875 I have verified the patch on solaris platform. It does not abort anymore for the specific example I had submitted earlier. However, it does not return the name of link file. This means that I cannot use "glob -type r *" command to find and delete all files of tye link. Also, "file exists link" returns 0 even though the link name exists - I think it should return 1. lavana@zodiac: [5] ls -l total 8 -rw-r--r-- 1 lavana cbltesters 0 Aug 11 12:13 abc lrwxrwxrwx 1 lavana cbltesters 4 Aug 11 12:06 link -> junk lavana@zodiac: [6] tclsh8.4 % glob -type r * abc % glob * link abc % file exists link 0 % exit lavana@zodiac: [7]
- login: "hemanglavana"
- mimetype: "text/plain"
- title changed to: "error in "glob -type r *""
- username: "hemanglavana"
- icomment:
Ticket change [f9f7b0e8a5] (rid 91787) by dkf on 2001-08-13 21:33:08:
- icomment:
Logged In: YES user_id=79902 Of course you can't use [glob -type r *] to find all files of type link; it gives a list of readable files, and links without a target are not readable in any normal sense. If you want links, use [glob -type l *] (if I'm not greatly mistaken...) The real question here is what do we want the semantics of broken links to be? One possibility is that they are filenames without a file to go with them...
- login: "dkf"
- mimetype: "text/plain"
- priority changed to: "9 Immediate"
- title changed to: "error in "glob -type r *""
- username: "dkf"
- icomment:
Ticket change [5a99efb9bf] (rid 118171) by vincentdarley on 2001-08-16 00:44:24:
- icomment:
Logged In: YES user_id=32170 I have to say I don't know what the semantics of broken links should be in Tcl. The current behaviour (after this patch is applied) is ok, but we probably should examine Tcl's filesystem in general and see where it might be tripped up by files disappearing on it, and then take appropriate, consistent action everywhere. I'll put this patch into the core and mark this bug closed when I apply some other small filesystem changes which have cropped up.
- login: "vincentdarley"
- mimetype: "text/plain"
- title changed to: "error in "glob -type r *""
- username: "vincentdarley"
- icomment:
Ticket change [93a9aca61c] (rid 105855) by hobbs on 2001-08-16 00:57:50:
- icomment:
Logged In: YES user_id=72656 I don't think Tcl should ever panic on inconsistencies in the file system like this. Return an error maybe, but not panic - that bombs out of everything. This is a language, and it should be fault tolerant to the underlying system as much as possible. Panics should be reserved for internal inconsistencies and Really Bad problems like no memory left.
- login: "hobbs"
- mimetype: "text/plain"
- title changed to: "error in "glob -type r *""
- username: "hobbs"
- icomment:
Ticket change [c66d405ed3] (rid 121765) by vincentdarley on 2001-08-16 15:57:39:
- icomment:
Logged In: YES user_id=32170 Ok, I guess I agree with Jeff. So the choices are: (i) simply ignore the disappearance (ii) warn the user by signalling an error (but this will of course abort the entire 'glob' in progress) I guess I would vote for (i) in this particular case -- the user wants a list of files, but then one file has disappeared (or had some other OS problem) half way through so, it shouldn't be returned. This behaviour kind of assumes that if we tried the 'readdir' a second time, it wouldn't return this particular file.
- login: "vincentdarley"
- mimetype: "text/plain"
- title changed to: "error in "glob -type r *""
- username: "vincentdarley"
- icomment:
Ticket change [bf59788a12] (rid 102236) by dkf on 2001-08-16 16:57:44:
- icomment:
Logged In: YES user_id=79902 The key (I think) is that with [glob -type r *] the user is asking for all files that can be opened by [open ... r] without causing an error. Since that is not the case with a broken link, it should not be returned. This assumption is also true for -type x, but not necessarily for -type w (it depends on whether creation is permitted in that directory) but it wouldn't be harmful to exclude those too (it depends on the interpretation of 'writable', but arguably a file is not previously writable if you have to create it as part of opening it for writing. Which is lucky since it makes the implementation simpler. :^)
- login: "dkf"
- mimetype: "text/plain"
- title changed to: "error in "glob -type r *""
- username: "dkf"
- icomment:
Ticket change [0fde7eaf06] (rid 94868) by vincentdarley on 2001-08-24 01:25:50:
- status changed to: "Closed"
Ticket change [161bd83da0] (rid 124670) by vincentdarley on 2001-08-24 01:25:51:
- closedate changed to: "2001-08-23T18:25:51"
- closer changed to: "vincentdarley"
- icomment:
Logged In: YES user_id=32170 Fixed in cvs head
- login: "vincentdarley"
- mimetype: "text/plain"
- resolution changed to: "Fixed"
- title changed to: "error in "glob -type r *""
- username: "vincentdarley"