Skip to content

Conversation

darabi
Copy link

@darabi darabi commented Nov 24, 2017

This is the default behaviour of GNU tar and useful in cases where the
archives of a dist are downloaded, but not yet unpacked.

Implementations other than Allegro and SBCL retain the current
behaviour: the modification time of the file is the time when the
archive was unpacked.

This is the default behaviour of GNU tar and useful in cases where the
archives of a dist are downloaded, but not yet unpacked.

Implementations other than Allegro and SBCL retain the current
behaviour: the modification time of the file is the time when the
archive was unpacked.
@darabi
Copy link
Author

darabi commented Nov 24, 2017

A case where this functionality is handy is a Docker image, where the QL dist archives are downloaded, but not unpacked:

https://github.com/m-creations/docker-sbcl/blob/dbefb88d478f84c846c88581f428e4c93770285b/Dockerfile#L69

@quicklisp
Copy link
Owner

Can you tell me more about why this matters? What happens if it is not done?

@darabi
Copy link
Author

darabi commented Nov 25, 2017

The rationale for that Docker image is to have a specific distribution of QL at hand, even in environments where no internet connectivity is available (or allowed out of security considerations).

The referenced Docker image downloads all archives of a specific QL dist by using ensure-local-archive-file at build time but doesn't unpack the archives to keep the image size as small as possible:

(mapcar #'ql-dist:ensure-local-archive-file (mapcar #'ql-dist:release (ql-dist:provided-systems (ql-dist:find-dist "quicklisp"))))

Due to the design of Docker, the storage of a running container is ephemeral. To quote the current documentation:

The data won’t persist when that container is no longer running, and it can be difficult to get the data out of the container if another process needs it.

This means that everytime the running image is stopped, the unpacked .lisp files and the compiled .fasl files are gone.

But it is possible to use a 'bind mount' to mount a directory of the Docker host into the running Docker instance. When using the image during development, it would be very convenient to mount ~/.cache/common-lisp into the container (docker run ... -v ~/.cache:/cache ...) to avoid recompiling a system, every time its files are unpacked from the archive.

Without this patch, the unpacked lisp files have a current mtime. This mtime is compared to the mtime of the fasl files in the ~/.cache/common/lisp directory, which is mounted from the Docker host and thus contains the fasl files of the last compilation. Because the mtime of the fasls is older than that of the lisp file, which was unpacked immediately before the comparison, the lisp file is recompiled.

With this patch, the unpacked lisp file has the same mtime it has in the tarball. Because the mtime of the fasls in ~/.cache is newer than the that of the corresponding lisp file, no compilation takes place.

Sorry for the lengthy explanation and I hope it is clear enough.

darabi added a commit to m-creations/docker-sbcl that referenced this pull request Nov 26, 2017
Apply the patch which was submitted as quicklisp/quicklisp-client#154
to have the lisp files be unpacked with the timestamp which they
have inside the tar archive.
darabi added a commit to m-creations/docker-sbcl that referenced this pull request Nov 26, 2017
Apply the patch which was submitted as quicklisp/quicklisp-client#154
to have the lisp files be unpacked with the timestamp which they
have inside the tar archive.
darabi added a commit to m-creations/docker-sbcl that referenced this pull request Nov 26, 2017
Apply the patch which was submitted as quicklisp/quicklisp-client#154
to have the lisp files be unpacked with the timestamp which they
have inside the tar archive.
darabi added a commit to m-creations/docker-sbcl that referenced this pull request Nov 26, 2017
Apply the patch which was submitted as quicklisp/quicklisp-client#154
to have the lisp files be unpacked with the timestamp which they
have inside the tar archive.
@quicklisp
Copy link
Owner

Thanks for the explanation. This makes sense. I'd need support for all Lisps that Quicklisp supports to accept this change.

@tfeb
Copy link

tfeb commented Nov 27, 2017

Can't you just do a bind mount of the places the sources get unpacked as well? Then you need to rebuild once, when the Docker image gets booted the first time on a given host, which you need to do anyway, and you'd avoid a complicated mass of implementation-specific code.

@quicklisp quicklisp closed this Jan 7, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants