[asdf-devel] ASDF2: Please, no unwrapped calls to "truename".

Robert Goldman rpgoldman at sift.info
Mon Apr 5 13:05:26 UTC 2010


On 4/5/10 Apr 5 -6:38 AM, Jean-Claude Beaudoin wrote:
> 
> My very first attempt at using ASDF version 1.661 on my system
> ended-up in the debugger on a file-error signaled by
> function truename.
> 
> The offending call came from function asdf::component-parent-pathname
> that contains a call to truename unwrapped in any condition
> handler although truename is required to signal errors. This seems
> to be the only such instance in asdf.lisp, all the other truename
> calls being wrapped inside a ignore-errors.
> 
> I fixed the situation by modifying asdf::component-parent-pathname
> this way:
> 
> (defun component-parent-pathname (component)
>    (aif (component-parent component)
>         (component-pathname it)
>         (or (ignore-errors (truename *default-pathname-defaults*))
> 	   *default-pathname-defaults*)))

Can you explain why ignore-errors is correct here?  Seems like that OR
there is just hoping that something good will happen even if TRUENAME
raises an error.  Why is it better to quash an error and hope, instead
of bringing the error to the user's attention?

I'm willing to believe that there IS a reason, but will you please
explain what it is?  For example, what was the case you encountered, and
why would it have been better to return *default-pathname-defaults*
instead of raising an error?  What were the *default-pathname-defaults*
in this case?

My philosophy is more "signal errors strictly and as early as possible"
than "protect your users from errors in cases of bad data."


Thank you,

Robert




More information about the asdf-devel mailing list