[asdf-devel] Guard against (push "/foo/bar" asdf:*central-registry*)

Robert Goldman rpgoldman at sift.info
Thu Jul 9 17:17:19 UTC 2009


Gary King wrote:
> How about this:
> 
>> (defun directory-pathname-p (pathname)
>>   (and (member (pathname-name pathname) (list nil :unspecified))
>>        (member (pathname-type pathname) (list nil :unspecified))))
>>
>> (defun sysdef-central-registry-search (system)
>>   (let ((name (coerce-name system))
>> 	(to-remove nil))
>>     (block nil
>>       (unwind-protect
>> 	   (dolist (dir *central-registry*)
>> 	     (let ((defaults (eval dir)))
>> 	       (cond ((directory-pathname-p defaults)
>> 		      (let ((file (and defaults
>> 				       (make-pathname
>> 					:defaults defaults :version :newest
>> 					:name name :type "asd" :case :local))))
>> 			(if (and file (probe-file file))
>> 			    (return file))))
>> 		     (t
>> 		      (warn "~@<While searching for system `~s`: `~s` evaluated to  
>> `~s` which is not a directory. Removing entry from *central- 
>> registry*~@:>" system dir defaults)
>> 		      (push dir to-remove)))))
>> 	;; cleanup
>> 	(dolist (dir to-remove)
>> 	  (setf *central-registry* (remove dir *central-registry*)))))))
>>

This looks great.  Minor suggestion:  change the "warn" to "cerror".
When loading a big system, or a big init file, CL implementations will
often spew a lot of messages that will bury a warning.  That means that
this warning might slip by un-noticed and then you'd get a confusing
error later on.  CERROR will be more obtrusive and, in this case, I
think more obtrusive is right.
> 
> 
> 
> On Jul 7, 2009, at 7:16 AM, Gary King wrote:
> 
>> Hi Tobias,
>>
>> I think this would be a good thing.
>>
>> On Jul 7, 2009, at 6:31 AM, Tobias C. Rittweiler wrote:
>>
>>> I think it's bitten pretty much all of us that we at least once  
>>> tried to
>>> push a non-directory-designating filename to *CENTRAL-REGISTRY*.
>>>
>>> It's a common pitfalls for newcomers.
>>>
>>> Couldn't ASDF signal a warning when it encounters such a thing while
>>> grovelling through the registry?
>>>
>>> -T.
>>>
>>>
>>> _______________________________________________
>>> asdf-devel mailing list
>>> asdf-devel at common-lisp.net
>>> http://common-lisp.net/cgi-bin/mailman/listinfo/asdf-devel
>> --
>> Gary Warren King, metabang.com
>> Cell: (413) 559 8738
>> Fax: (206) 338-4052
>> gwkkwg on Skype * garethsan on AIM * gwking on twitter
>>
>>
>>
>>
>>
> 
> --
> Gary Warren King, metabang.com
> Cell: (413) 559 8738
> Fax: (206) 338-4052
> gwkkwg on Skype * garethsan on AIM * gwking on twitter
> 
> 
> 
> 
> 
> 
> _______________________________________________
> asdf-devel mailing list
> asdf-devel at common-lisp.net
> http://common-lisp.net/cgi-bin/mailman/listinfo/asdf-devel





More information about the asdf-devel mailing list