Tk Library Source Code

View Ticket
Login
Ticket UUID: 862491
Title: fileutil::find ... no catch around 'cd'
Type: Bug Version: None
Submitter: carlls Created on: 2003-12-18 20:01:23
Subsystem: fileutil Assigned To: andreas_kupries
Priority: 7 High Severity:
Status: Closed Last Modified: 2005-02-02 13:49:55
Resolution: Fixed Closed By: andreas_kupries
    Closed on: 2005-02-02 06:49:55
Description:
Cd sequences are not checked to see if the succeed. 
I.e. failed due to permissions. 
If failure occurs the code terminates. I would rather 
it “skip” the problem children in a find. This problem has 
been reproduced in both WIN32 & HP-UX
User Comments: andreas_kupries added on 2005-02-02 13:49:55:
Logged In: YES 
user_id=75003

Change using [catch] committed to head.

andreas_kupries added on 2005-02-02 13:48:31:
Logged In: YES 
user_id=75003

See also http://sourceforge.net/support/tracker.php?aid=1111153
for a duplicate entry.

I have decided to add catch around the cd's, and ignore the
problematic directories for now. This will close this and
the other bug.

I will however also file an RFE asking for an API change
which allows us to set an error handler to be called for the
directories we error out on.

andreas_kupries added on 2004-01-07 05:39:39:
Logged In: YES 
user_id=75003

More brainstorming:

akudavidw, your take on bug 862491 ?
    * <davidw> looks
<davidw>hrm...
<davidw>well... unix just prints out failures
steveo has left the chat!
akuOn stderr I guess. Not something a library routine 
should do IMHO.
<davidw>it seems like it would be difficult to return 
a list of failures, which is the first thing that comes to mind
<davidw>right
akulist of failures ... also an good idea. I'll note that 
down in the report.
kbkPerhaps do what the http package does and return 
a token that can be used to retrieve the list of failures?
<davidw>maybe an option? -nocomplain or something
jenglishDo not ever add a "-nocomplain" option to any part 
of Tcl ever again.  Thank you 
<davidw>kbk: mmmm yeah, that starts getting 
complex when the standard use case is just to fetch a list of 
files though
<davidw>jenglish: why's that?
akuNote: changing the result to list of found files + list 
of failures is an API change. Requires major version number for 
fileutil
<davidw>I'm thinking of the glob one
dkfPerhaps we should add a -nocomplain option to 
[error]
akuEeew
<davidw>more brainstorming: API change: hand it a 
proc to deal with 'errors'
<davidw>dkf: ha ha
jenglish[unset -nocomplain], [glob -nocomplain], etc. are 
signs that the original API was flawed.
<davidw>jenglish: oh, well there's an argument for 
that
jenglishIf the exceptional case (variable you wanted to 
unset isn't there to begin with, no files match glob pattern) is 
common enough that it warrants adding a "-nocomplain" 
option, then it warrants fixing the command to not return an 
error in the first place.
akuHm, error handler. We already have a filter handler. 
So it could fit. API change: Use options, instead of just 
optional arguments.
kbkjenglish: Yes, they are indeed an indication that the 
API was flawed. We worry, though, about what stuff might be 
depending on the flaws.
kfCeilings
    * kbk : "This house has no flaw!" "What do you walk on?" 
jenglishHavoc Pennington calls this sort of thing a "please 
unbreak my program" switch.  (Also: "crackrock")

andreas_kupries added on 2004-01-07 05:20:35:
Logged In: YES 
user_id=75003

Instead of just skipping anotehr possibility is to return a list of 
failed directories, beyond the normal return value of found 
files.