[ cclan-Bugs-1556543 ] Recursive file load loop if asdf file is in the future

"SourceForge.net" <[email protected]> Mon, 29 Sep 2008 20:54:45 +0000
Newsgroups gmane.lisp.cclan.bugs
Message-ID <[email protected]>
Bugs item #1556543, was opened at 2006-09-11 17:46
Message generated for change (Comment added) made by darabi
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=393636&aid=1556543&group_id=28536

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: asdf
Group: None
Status: Open
Resolution: None
Priority: 5
Private: No
Submitted By: Liam Healy (liam)
Assigned to: Daniel Barlow (dan_b)
Summary: Recursive file load loop if asdf file is in the future

Initial Comment:
If the .asd file has a timestamp in the future, due
e.g. to clock disparity between file server and
desktop, ASDF gets in an infinite recursion of file
loads on this file; see sample at
http://paste.lisp.org/display/25828.  Perhaps clock
skew could be detected and reported, as make does?

----------------------------------------------------------------------

Comment By: Kambiz Darabi (darabi)
Date: 2008-09-29 20:54

Message:
During the first call to find-system, the asd file is loaded which leads to
defsystem setting the car of the hash table entry in *defined-systems* to
the current time:

 (setf (car s) (get-universal-time)))

later, during the same call, find-system is called again which compares
the car of the *defined-systems* entry to the file-write-date:

 (< (car in-memory) (file-write-date on-disk))))

This test fails, if the file-write-date is in the future.

One way to fix this problem might be to keep the file-write-date of the
system for which find-system is being called in a var and use that
file-write-date instead of get-universal-time.

Here is the (probably horrible) patch just to illustrate the issue:

Index: asdf.lisp
===================================================================
RCS file: /cvsroot/cclan/asdf/asdf.lisp,v
retrieving revision 1.128
diff -r1.128 asdf.lisp
369a370,374
> (defvar *found-system* (list nil 0)
>   "A two element list which holds the coerce-name and file-write-date
> of the current system during a find-system call to prevent recursive
> calls to find-system")
>  
420c425,426
<              (let ((*package* package))
---
>              (let ((*package* package)
>                    (*found-system* (list name (file-write-date
on-disk))))
429c435,436
<           (delete-package package))))
---
>           (delete-package package)
>           (setf *found-system* (list nil 0)))))
436c443
< (defun register-system (name system)
---
> (defun asdf::register-system (name system)
438,439c445,452
<   (setf (gethash (coerce-name name) *defined-systems*)
<         (cons (get-universal-time) system)))
---
>   (let ((name (coerce-name  name)))
>     (setf (gethash name *defined-systems*)
>           (cons (on-disk-or-universal-time name) system))))
> 
> (defun on-disk-or-universal-time (name)
>   (if (equal (coerce-name name) (car *found-system*))
>       (second *found-system*)
>       (get-universal-time)))
1106c1119
<                   (setf (car s) (get-universal-time)))
---
>                   (setf (car s) (on-disk-or-universal-time ',name)))


----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=393636&aid=1556543&group_id=28536

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/