[local-time-devel] Locating the zoneinfo repository

Abhishek Reddy arbscht at gmail.com
Thu Oct 29 18:33:52 UTC 2009


Hi,

As I understand it, local-time attempts to locate the zoneinfo/ directory in
two places: relative to the ASDF package path, or at *load-pathname*.
However, this seems like a fragile, even buggy, strategy for some use cases:

  * When LOAD-ing local-time (not via ASDF) while ASDF is incidentally
loaded into the image, local-time will try to locate the ASDF package path
anyway, ignoring *load-pathname*.  The result may be NIL, yielding an error
in constructing the pathname.

  * When LOAD-ing local-time (not via ASDF) while there is no ASDF in the
image, *project-home-directory* will default to the directory of
*load-pathname*, which in the current source tree layout is src/ -- whereas
the repository is under src/../ -- eventually causing an error in TRUENAME.

  * In a saved image that includes local-time (via ASDF) and ASDF itself,
the value of *project-home-directory* may be set at the time of saving.[1]
If the image is deployed in a different environment, it may not find the
repository, eventually causing an error in TRUENAME.

  * In a saved image that includes local-time but excludes ASDF, the package
path cannot be found, and *load-pathname* may be NIL.[2]  This yields an
error in constructing the pathname, before the client has a chance to do
anything about it.


Is there a better way to use local-time in these cases, or is it worth
modifying the way local-time locates the zoneinfo repository?  For now, I
have resorted to making the following changes to local-time:

  * Allow *project-home-directory* to be NIL, if the ASDF and LOAD-time
paths cannot be used.  It is assumed that the library client will take
responsibility for updating the null parameter (and for distributing
zoneinfo/ as an external asset).

  * Define a parameter in the local-time.system package that is bound when
ASDF performs a load-op on local-time source files, and use its value in
local-time if available.

  * When *load-pathname* is to be used, select its parent directory.

The attached patch contains these changes (against a recent darcs rev.) as a
proof of concept.  It is only a working implementation, allowing saved
images to use local-time, and loading it without ASDF.  AFAIK, it does not
introduce breaking changes.  I would like to get general feedback/advice on
the direction before going further.

[1] for example in an executable generated by sb-ext:save-lisp-and-die in
SBCL.
[2] for example in a monolithic executable generated by asdf:make-build in
ECL.

Thanks


-- 
Abhishek Reddy
http://abhishek.geek.nz
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.common-lisp.net/pipermail/local-time-devel/attachments/20091030/5b574aca/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: local-time-project-home.patch
Type: text/x-diff
Size: 2450 bytes
Desc: not available
URL: <https://mailman.common-lisp.net/pipermail/local-time-devel/attachments/20091030/5b574aca/attachment.patch>


More information about the local-time-devel mailing list