Tar
Table of Contents
[in package TAR]
This project provides a high level interface for interacting with tar archives. It consists of several systems that provide different levels of functionality.
NOTE
: In order to load tar-extract
, you need a version of osicat with
commits from this PR.
Quickstart
If you want to extract a tar archive, without caring about preserving all the metadata, run the following:
(asdf:load-system :tar-simple-extract)
(tar:with-open-archive (a "/path/to/file.tar")
(tar-simple-extract:simple-extract-archive a :directory "/path/to/extraction/point/"))
If you want to extract a tar archive, attempting to preserve symbolic links and as much metadata as possible, evaluate the following:
(asdf:load-system :tar-extract)
(tar:with-open-archive (a "/path/to/file.tar")
(tar-extract:extract-archive a :directory "/path/to/extraction/point/"))
tar
The tar
system is a thin layer on top of
the tar-file
system. While tar-file
is focused on reading and writing physical entries,
tar
places an emphasis on reading and writing logical entries.
The practical effect of this is that when using tar
, any single object stored
in a tar archive (regular file, symlink, etc.) is always represented as a
single entry (tar:file-entry
, tar:symbolic-link-entry
, etc.). This is in
contrast to tar-file
where a regular file with a long name could be either
unrepresentable, a single tar-file:file-entry
with a ustar header, a
tar-file:pax-extended-attributes-entry
followed by a tar-file:file-entry
,
or a tar-file:gnu-long-name-entry
followed by a tar-file:file-entry
. tar
takes care of generating and interpreting the correct sequence of physical
entries, depending on the type of the archive being used.
While this system is useful for reading and writing tar archives, its primary purpose is for the inspection of archives and creating archives whose content does not come directly from the file system. For file system integration, see the remaining systems.
tar-simple-extract
The tar-simple-extract
system provides functionality to extract a tar archive
to your filesystem. Unfortunately, faithfully extracting tar files onto the
filesystem is a complex task and is impossible to perform using only the
functionality mandated by the Common Lisp specification.
Therefore, this system does not try to faithfully reproduce the contents of the
tar file. This means that it should work on any CL implementation that tar
and tar-file
does, but the cost is there is information loss.
This system does not support extracting the following entry types:
Symbolic links. They can be skipped or dereferenced.
Hard links. They can be skipped or dereferenced.
Character devices. They can be skipped.
Block devices. They can be skipped.
FIFO
. They can be skipped.
Additionally, metadata such as file owner, permissions, and modification time are not set.
It is recommended that this extraction method is used only to extract an archive to an empty folder. If that is done with default settings, the extraction process should be fairly safe and predictable. Otherwise, you run the risk of existing symlinks being followed and overwriting arbitrary files on your machine.
tar-extract
The tar-extract
system attempts to provide full extraction functionality. As
such, it is a much more complex beast and likely does not work on all
implementation/OS combinations. Patches are always welcome to make it more
portable.
This system does not support extracting the following entry types on Windows:
Symbolic links. They can be skipped or dereferenced.
Hard links. They can be skipped or dereferenced.
Character devices. They can be skipped.
Block devices. They can be skipped.
FIFO
. They can be skipped.
While it is possible to create symbolic links on Windows, it requires special user permissions and many Windows applications are not designed with symlinks in mind. This makes it both very unlikely that an arbitrary user can create symlinks and very likely that the creation of symlinks would pose a risk to other applications running on the same machine. Hard link support is also possible, but I've rarely seen it and need to do more research before attempting to support it.
While there is much less information loss when extracting an archive using this system, that comes at the cost of increased security concerns when given an untrusted archive as input. For example, a typical attack vector is to write a symlink that points to an arbitrary file on your system and then using that symlink to modify the target.
The goal of this system is to provide default extraction options so that it is safe to extract an untrusted archive into an empty directory and have no way for the extraction process to modify any file that exists outside of that directory. Bug reports and patches are always welcome if you find this goal is not met.
The safety goal is paramount, and as such, the performance of this system is likely not the best. A primary reason is that we want to be robust to the different file systems that are out there (e.g., case insensitive or unicode normalizing), so we (currently) do not rely on caches to determine if a path is safe to write to. The result is that there are many syscalls that happen during extraction. There are probably ways this can be improved and patches are always welcome.
1 Tar
This section describes the high level tar archive support.
1.1 Tar Archives
[class] ARCHIVE
The base class of all archives.
[class] GNU-ARCHIVE ARCHIVE
An archive that uses
GNU
specific extensions.
[class] PAX-ARCHIVE USTAR-ARCHIVE
An archive as specified by POSIX. Uses multiple physical entries to represent a single logical entry when values do not fit into the standard
USTAR-ARCHIVE
header.
[class] USTAR-ARCHIVE ARCHIVE
A ustar archive that adds more fields to the header when compared to
V7-ARCHIVE
s.
[class] V7-ARCHIVE ARCHIVE
A very early archive format.
[function] OPEN-ARCHIVE STREAM-OR-PATH &KEY (TYPE
:AUTO
) (DIRECTION:INPUT
) (IF-EXISTSNIL
IF-EXISTS-SUPPLIED-P
) (IF-DOES-NOT-EXISTNIL
IF-DOES-NOT-EXIST-SUPPLIED-P
) (BLOCKING-FACTOR 20) (HEADER-ENCODINGTAR-FILE:*DEFAULT-HEADER-ENCODING*
)Create a tar archive object backed by
STREAM-OR-PATH
. If a stream, it should not be read from or written to any more.DIRECTION
is either:INPUT
or:OUTPUT
.BLOCKING-FACTOR
is an integer that specifies how many 512-byte blocks should be read from or written toSTREAM
at any one time.TYPE
is eitherAUTO
or a class designator for a subclass ofARCHIVE
. If:AUTO
, the appropriate class will be determined by looking at the first tar header.HEADER-ENCODING
is an encoding specifier recognized by Babel.
[generic-function] CLOSE-ARCHIVE ARCHIVE
Close the
ARCHIVE
, performing any finalization as necessary. If a pathname was passed toOPEN-ARCHIVE
, then the underlying stream is closed, otherwise it remains open.
[macro] WITH-OPEN-ARCHIVE (ARCHIVE-VAR STREAM-OR-PATH &REST ARGS &KEY TYPE DIRECTION IF-EXISTS IF-DOES-NOT-EXIST BLOCKING-FACTOR HEADER-ENCODING) &BODY BODY
Evaluate
BODY
withARCHIVE-VAR
bound to an instance ofARCHIVE
. SeeOPEN-ARCHIVE
for more discussion of the arguments. IfSTREAM-OR-PATH
is a path, the underlying stream is closed upon exiting the macro. If it is a stream, it remains open.
1.2 Tar Entries
This section describes the various entry types and how to read/write them from/to an archive.
[generic-function] READ-ENTRY ARCHIVE
Read an
ENTRY
fromARCHIVE
.
[generic-function] WRITE-ENTRY ARCHIVE ENTRY
Write
ENTRY
toARCHIVE
.
[macro] DO-ENTRIES (ENTRY ARCHIVE &OPTIONAL RESULT) &BODY BODY
Iterate over the entries in
ARCHIVE
. For each entry,ENTRY
is bound to anENTRY
representing the entry.RESULT
is returned.
[type] MODE-LIST
A list consisting of a subset of: (
:SET-USER-ID
:SET-GROUP-ID
:STICKY
:USER-READ
:USER-WRITE
:USER-EXEC
:GROUP-READ
:GROUP-WRITE
:GROUP-EXEC
:OTHER-READ
:OTHER-WRITE
:OTHER-EXEC
)
[class] ENTRY
The base class of all entry types. Each
ENTRY
must contain aNAME
,MODE
,UID
,GID
, andMTIME
. Other common properties areUNAME
,GNAME
,ATIME
, andCTIME
.
[class] DIRECTORY-ENTRY ENTRY
An entry representing a directory.
[class] FILE-ENTRY ENTRY HAS-DATA-MIXIN
An entry representing a regular file.
[class] SYMBOLIC-LINK-ENTRY LINK-ENTRY
An entry representing a symbolic link.
[class] HARD-LINK-ENTRY LINK-ENTRY
An entry representing a hard link.
[class] FIFO-ENTRY ENTRY
An entry representing a
FIFO
.
[class] BLOCK-DEVICE-ENTRY DEVICE-ENTRY
An entry representing a block device.
[class] CHARACTER-DEVICE-ENTRY DEVICE-ENTRY
An entry representing a character device.
[generic-function] NAME ENTRY
The name of
ENTRY
. Returns aSTRING
.
[generic-function] SIZE ENTRY
The size of
ENTRY
. Returns a (INTEGER
0).
[generic-function] UNAME ENTRY
The uname of
ENTRY
. Returns aSTRING
.
[generic-function] GNAME ENTRY
The gname of
ENTRY
. Returns aSTRING
.
[generic-function] MTIME ENTRY
The mtime of
ENTRY
. Returns aTIMESTAMP
.
[generic-function] ATIME ENTRY
The atime of
ENTRY
. Returns aTIMESTAMP
.
[generic-function] CTIME ENTRY
The ctime of
ENTRY
. Returns aTIMESTAMP
.
[generic-function] UID ENTRY
The uid of
ENTRY
. Returns a (INTEGER
0).
[generic-function] GID ENTRY
The gid of
ENTRY
. Returns a (INTEGER
0).
[generic-function] LINKNAME ENTRY
The linkname of
ENTRY
. Returns aSTRING
.
[generic-function] DEVMAJOR ENTRY
The devmajor of
ENTRY
. Returns a (INTEGER
0).
[generic-function] DEVMINOR ENTRY
The devminor of
ENTRY
. Returns a (INTEGER
0).
[generic-function] MAKE-ENTRY-STREAM ENTRY
Return a binary stream with the contents of
ENTRY
. Depending on the the type of stream underlying the archive (if it is seekable or not) and theBLOCKING-FACTOR
given toOPEN-ARCHIVE
, this may be callable either once or multiple times per entry, may or may not be callable after the next call toREAD-ENTRY
, and the the returned stream may or may not be readable after the next call toREAD-ENTRY
.For maximum compatibility, you should call this only once per
ENTRY
and completely read from the stream before callingREAD-ENTRY
again.
1.3 Tar Conditions
This section describes the various conditions and restarts in the tar system.
[condition] TAR-CONDITION
The base condition.
[condition] TAR-ERROR TAR-CONDITION ERROR
The base error condition.
[condition] UNSUPPORTED-PROPERTY TAR-ERROR
Signaled when a property is set or accessed that the underlying tar file cannot represent.
[condition] REQUIRED-PROPERTY-MISSING TAR-ERROR
Signaled when trying to
WRITE-ENTRY
with a required property that is missing.
- [reader] REQUIRED-PROPERTY-MISSING-NAME REQUIRED-PROPERTY-MISSING (:NAME)
[condition] UNSUPPORTED-PROPERTY-VALUE TAR-ERROR
Signaled when trying to
WRITE-ENTRY
with a property that is unsupported by the underlying archive type.
- [reader] UNSUPPORTED-PROPERTY-VALUE-NAME UNSUPPORTED-PROPERTY-VALUE (:NAME)
- [reader] UNSUPPORTED-PROPERTY-VALUE-VALUE UNSUPPORTED-PROPERTY-VALUE (:VALUE)
[condition] PROPERTY-VALUE-TOO-LONG UNSUPPORTED-PROPERTY-VALUE
Signaled when trying to
WRITE-ENTRY
with a property that is too long for the underlying archive type.
[function] IGNORE-UNSUPPORTED-PROPERTY &OPTIONAL VALUE CONDITION
A restart to ignore an
UNSUPPORTED-PROPERTY
CONDITION
. Either returnsVALUE
from the accessor or silently ignores the attempt to set the value.
[function] TRUNCATE-VALUE &OPTIONAL CONDITION
Truncate the value and write it to the archive.
[macro] WITH-IGNORED-UNSUPPORTED-PROPERTIES (&OPTIONAL VALUE) &BODY BODY
Execute
BODY
in a context whereUNSUPPORTED-PROPERTY
errors are ignored andVALUE
is returned from any attempt to access them.
[macro] WITH-TRUNCATED-UNSUPPORTED-VALUES NIL &BODY BODY
Evaluate
BODY
in a context where truncatable values are automatically truncated.
2 Simple Extraction
[in package TAR-SIMPLE-EXTRACT]
This section describes the support for simple extraction to the filesystem.
[function] SIMPLE-EXTRACT-ARCHIVE ARCHIVE &KEY (DIRECTORY
*DEFAULT-PATHNAME-DEFAULTS*
) (ABSOLUTE-PATHNAMES:ERROR
) (DEVICE-PATHNAMES:ERROR
) (DOT-DOT:ERROR
) (STRIP-COMPONENTS 0) (IF-EXISTS:ERROR
) (IF-NEWER-EXISTS:ERROR
) (SYMBOLIC-LINKS:DEREFERENCE
) (HARD-LINKS:DEREFERENCE
) (CHARACTER-DEVICES:SKIP
) (BLOCK-DEVICES:SKIP
) (FIFOS:SKIP
) (FILTER (CONSTANTLY
T))Extract all entries in
ARCHIVE
toDIRECTORY
.DIRECTORY
defaults to*DEFAULT-PATHNAME-DEFAULTS*
and must be a directory pathname.The following options configure how the final pathname of each entry is computed:
ABSOLUTE-PATHANMES controls what happens when an entry is discovered that has an absolute pathname. It defaults to
:ERROR
. The possible values are::ALLOW
: Allow the pathname as is.:SKIP
: Silently skip the entry.:RELATIVIZE
: Strip the leading / and treat it as a relative pathname.:ERROR
: Signal anENTRY-NAME-IS-ABSOLUTE-ERROR
, with the restartsCONTINUE
,SKIP-ENTRY
, andRELATIVIZE-ENTRY-NAME
active.
DEVICE-PATHNAMES
controls what happens when an entry is discovered that has a non-NIL device. It defaults to:ERROR
. The possible values are::ALLOW
: Allow the pathname as is.:SKIP
: Silently skip the entry.:RELATIVIZE
: Strip the device.:ERROR
: Signal anENTRY-NAME-CONTAINS-DEVICE-ERROR
, with the restartsCONTINUE
,SKIP-ENTRY
, andRELATIVIZE-ENTRY-NAME
active.
DOT-DOT
controls what happens when an entry is discovered that has a name containing .. in a directory component. It defaults to:ERROR
. The possible values are::BACK
: Allow the pathname as is, treating .. as:BACK
.:SKIP
: Silently skip the entry.:ERROR
: Signal anENTRY-NAME-CONTAINS-..-ERROR
, with the restartsTREAT-..-AS-BACK
andSKIP-ENTRY
active.
STRIP-COMPONENTS
is an integer specifying how many directory and file components to strip. Defaults to 0.The following options configure what happens to files that already exist on the filesystem.
IF-NEWER-EXISTS
controls what happens to files that already exist withinDIRECTORY
if extractingARCHIVE
would overwrite them and the existing file has a more recent mtime. It defaults to:ERROR
. The possible values are:NIL
,:KEEP
: existing files are skipped:SUPERSEDE
,:RENAME
,:RENAME-AND-DELETE
,:NEW-VERSION
,:ERROR
: Same behavior asOPEN
.
IF-EXISTS
controls what happens to files that already exist withinDIRECTORY
. It defaults to:ERROR
. The possible values are:NIL
,:KEEP
: existing files are skipped:SUPERSEDE
,:RENAME
,:RENAME-AND-DELETE
,:NEW-VERSION
,:ERROR
: Same behavior asOPEN
.
The following options configure how certain types of entries are extracted.
SYMBOLIC-LINKS
controls how symbolic links are extracted fromARCHIVE
. It defaults to:DEREFERENCE
. The possible values are::DEREFERENCE
: any symlink entries are instead written as normal files with the contents of the file they point to.:SKIP
: Skip the symlink.:ERROR
: Signal aEXTRACT-SYMBOLIC-LINK-ENTRY-ERROR
with the restartsDEREFERENCE-LINK
andSKIP-ENTRY
active.
HARD-LINKS
controls how hard links are extracted fromARCHIVE
. It defaults to:DEREFERENCE
. The possible values are::DEREFERENCE
: any hard link entries are instead written as normal files with the contents of the file they point to.:SKIP
: Skip the hard link.:ERROR
: Signal aEXTRACT-HARD-LINK-ENTRY-ERROR
with the restartsDEREFERENCE-LINK
andSKIP-ENTRY
active.
CHARACTER-DEVICES
controls how character devices are extracted fromARCHIVE
. It defaults to:SKIP
. The possible values are::SKIP
: Skip the entry.:ERROR
: Signal aEXTRACT-CHARACTER-DEVICE-ENTRY-ERROR
with the restartSKIP-ENTRY
active.
BLOCK-DEVICES
controls how block devices are extracted fromARCHIVE
. It defaults to:SKIP
. The possible values are::SKIP
: Skip the entry.:ERROR
: Signal aEXTRACT-BLOCK-DEVICE-ENTRY-ERROR
with the restartSKIP-ENTRY
active.
FIFOS
controls howFIFOs
are extracted fromARCHIVE
. It defaults to:SKIP
. The possible values are::SKIP
: Skip the entry.:ERROR
: Signal aEXTRACT-FIFO-ENTRY-ERROR
with the restartSKIP-ENTRY
active.
The following option controls what entries are extracted.
FILTER
defaults to (CONSTANTLY
T). Must be a function designator that takes two arguments (the entry and the pathname were it will be extracted) and returns non-NIL if the entry should be extracted.If symbolic and hard links are dereferenced, there may be broken or circular links. If that is detected, a
BROKEN-OR-CIRCULAR-LINKS-ERROR
is signalled with theCONTINUE
restart active.
2.1 Simple Extraction Conditions
This section describes the conditions that can occur during
SIMPLE-EXTRACT-ARCHIVE
.
[condition] EXTRACTION-ERROR ERROR
Base class of all errors signaled during archive extraction.
[condition] EXTRACTION-ENTRY-ERROR EXTRACTION-ERROR
An extraction error that is specific to an
ENTRY
.
- [reader] EXTRACTION-ENTRY-ERROR-ENTRY EXTRACTION-ENTRY-ERROR (:ENTRY = '
*CURRENT-ENTRY*
)
[condition] ENTRY-NAME-CONTAINS-DEVICE-ERROR EXTRACTION-ENTRY-ERROR
An entry contains a device in its pathname.
[condition] ENTRY-NAME-CONTAINS-..-ERROR EXTRACTION-ENTRY-ERROR
An entry contains .. in its pathname.
[condition] ENTRY-NAME-IS-ABSOLUTE-ERROR EXTRACTION-ENTRY-ERROR
An entry pathname is absolute.
[condition] EXTRACT-CHARACTER-DEVICE-ENTRY-ERROR EXTRACTION-ENTRY-ERROR
A character device that cannot be extracted.
[condition] EXTRACT-BLOCK-DEVICE-ENTRY-ERROR EXTRACTION-ENTRY-ERROR
A block device that cannot be extracted.
[condition] EXTRACT-FIFO-ENTRY-ERROR EXTRACTION-ENTRY-ERROR
A
FIFO
that cannot be extracted.
[condition] EXTRACT-SYMBOLIC-LINK-ENTRY-ERROR EXTRACTION-ENTRY-ERROR
A symbolic link that cannot be extracted.
[condition] EXTRACT-HARD-LINK-ENTRY-ERROR EXTRACTION-ENTRY-ERROR
A hard link that cannot be extracted.
[condition] BROKEN-OR-CIRCULAR-LINKS-ERROR EXTRACTION-ERROR
A series of symbolic or hard links is broken or circular.
[function] DEREFERENCE-LINK &OPTIONAL C
Handle condition C by dereferencing the link.
[function] SKIP-ENTRY &OPTIONAL C
Handle condition C by skipping the entry.
[function] RELATIVIZE-ENTRY-NAME &OPTIONAL C
Handle condition C by relativizing the pathname.
[function] TREAT-..-AS-BACK &OPTIONAL C
Handle condition C by treating .. as
:BACK
.
3 Extraction
[in package TAR-EXTRACT]
This section describes the support for non-portable extraction to the filesystem.
[function] EXTRACT-ARCHIVE ARCHIVE &KEY (DIRECTORY
*DEFAULT-PATHNAME-DEFAULTS*
) (ABSOLUTE-PATHNAMES:ERROR
) (DEVICE-PATHNAMES:ERROR
) (DOT-DOT:ERROR
) (STRIP-COMPONENTS 0) (IF-EXISTS:ERROR
) (IF-NEWER-EXISTS:ERROR
) (IF-SYMBOLIC-LINK-EXISTS:ERROR
) (IF-DIRECTORY-SYMBOLIC-LINK-EXISTS:ERROR
) KEEP-DIRECTORY-METADATA TOUCH (NO-SAME-OWNER (ROOTP
)) NUMERIC-UID MASK (SYMBOLIC-LINKS T) (HARD-LINKS T) (CHARACTER-DEVICES (IF (ROOTP
) T:ERROR
)) (BLOCK-DEVICES (IF (ROOTP
) T:ERROR
)) (FIFOS T) (FILTER (CONSTANTLY
T))Extract all entries in
ARCHIVE
toDIRECTORY
.DIRECTORY
defaults to*DEFAULT-PATHNAME-DEFAULTS*
and must be a directory pathname.The following options configure how the final pathname of each entry is computed:
ABSOLUTE-PATHANMES controls what happens when an entry is discovered that has an absolute pathname. It defaults to
:ERROR
. The possible values are::ALLOW
: Allow the pathname as is.:SKIP
: Silently skip the entry.:RELATIVIZE
: Strip the leading / and treat it as a relative pathname.:ERROR
: Signal anENTRY-NAME-IS-ABSOLUTE-ERROR
, with the restartsCONTINUE
,SKIP-ENTRY
, andRELATIVIZE-ENTRY-NAME
active.
DEVICE-PATHNAMES
controls what happens when an entry is discovered that has a non-NIL device. It defaults to:ERROR
. The possible values are::ALLOW
: Allow the pathname as is.:SKIP
: Silently skip the entry.:RELATIVIZE
: Strip the device.:ERROR
: Signal anENTRY-NAME-CONTAINS-DEVICE-ERROR
, with the restartsCONTINUE
,SKIP-ENTRY
, andRELATIVIZE-ENTRY-NAME
active.
DOT-DOT
controls what happens when an entry is discovered that has a name containing .. in a directory component. It defaults to:ERROR
. The possible values are::BACK
: Allow the pathname as is, treating .. as:BACK
.:SKIP
: Silently skip the entry.:ERROR
: Signal anENTRY-NAME-CONTAINS-..-ERROR
, with the restartsTREAT-..-AS-BACK
andSKIP-ENTRY
active.
STRIP-COMPONENTS
is an integer specifying how many directory and file components to strip. Defaults to 0.The following options configure what happens to files that already exist on the filesystem.
IF-DIRECTORY-SYMBOLIC-LINK-EXISTS
controls what happens to existing directories that are symlinks. This includes any symlink on the destination path of the entry. Defaults to:ERROR
. The possible values are::ERROR
: Signal aEXTRACTION-THROUGH-SYMBOLIC-LINK-ERROR
with the restartsFOLLOW-SYMBOLIC-LINK
,REPLACE-SYMBOLIC-LINK
, andSKIP-ENTRY
active.NIL
,:SKIP
: Skip the entry.:SUPERSEDE
: replace the symlink with a new, empty directory.:FOLLOW
: keep the existing symlink.
IF-SYMBOLIC-LINK-EXISTS
controls what happesn to existing files that are symlinks. Defaults to:ERROR
. The possible values are::ERROR
: Signal aEXTRACTION-THROUGH-SYMBOLIC-LINK-ERROR
with the restartsFOLLOW-SYMBOLIC-LINK
,REPLACE-SYMBOLIC-LINK
, andSKIP-ENTRY
active.NIL
,:SKIP
: Skip the entry.:FOLLOW
: Follow the symlink and write the contents of the entry, respectingIF-NEWER-EXISTS
andIF-EXISTS
.:SUPERSEDE
: Replace the symlink.
IF-NEWER-EXISTS
controls what happens to files that already exist withinDIRECTORY
if extractingARCHIVE
would overwrite them and the existing file has a more recent mtime. It defaults to:ERROR
. The possible values are::ERROR
: ADESTINATION-EXISTS-ERROR
is signaled, with the restartsSUPERSEDE-FILE
,REMOVE-FILE
, andSKIP-ENTRY
activeNIL
,:SKIP
,:KEEP
: existing files are skipped:SUPERSEDE
: Overwrite the file:REPLACE
: Delete file and replace it, atomically if possible.
IF-EXISTS
controls what happens to files that already exist withinDIRECTORY
. It defaults to:ERROR
. The possible values are::ERROR
: ADESTINATION-EXISTS-ERROR
is signaled, with the restartsSUPERSEDE-FILE
,REMOVE-FILE
, andSKIP-ENTRY
activeNIL
,:SKIP
,:KEEP
: existing files are skipped:SUPERSEDE
: Overwrite the file:REPLACE
: Delete file and replace it, atomically if possible.
The following options configure how metadata is extracted.
If
KEEP-DIRECTORY-METADATA
is non-NIL, then metadata for existing directories is kept.If
TOUCH
is non-NIL, file mtimes will not be set on extraction.If
NO-SAME-OWNER
is non-NIL, then the owner and group of extracted entries will not be set. Defaults to T for non-root users and Windows. Must be T on Windows.If
NUMERIC-UID
is non-NIL,UID
s andGID
s are preferred overUNAME
s andGNAME
s.MASK
is a list of permissions to remove from all entries.The following options configure how certain types of entries are extracted.
SYMBOLIC-LINKS
controls how symbolic links are extracted fromARCHIVE
. It defaults to T on non-Windows platforms and:DEREFERENCE
on Windows. The possible values are:T : Extract the symlink as normal.
:DEREFERENCE
: any symlink entries are instead written as normal files with the contents of the file they point to.:SKIP
: Skip the symlink.:ERROR
: Signal aEXTRACT-SYMBOLIC-LINK-ENTRY-ERROR
with the restartsEXTRACT-LINK
,DEREFERENCE-LINK
andSKIP-ENTRY
active.
HARD-LINKS
controls how hard links are extracted fromARCHIVE
. It defaults to T on non-WINDOWS platforms and:DEREFERENCE
on Windows. The possible values are:T : Extract the hard link as normal.
:DEREFERENCE
: any hard link entries are instead written as normal files with the contents of the file they point to.:SKIP
: Skip the hard link.:ERROR
: Signal aEXTRACT-HARD-LINK-ENTRY-ERROR
with the restartsEXTRACT-LINK
,DEREFERENCE-LINK
andSKIP-ENTRY
active.
CHARACTER-DEVICES
controls how character devices are extracted fromARCHIVE
. It defaults to:ERROR
on Windows or non-Windows and the current user is not root, T otherwise. The possible values are:T : Extract the character device.
:SKIP
: Skip the entry.:ERROR
: Signal aEXTRACT-CHARACTER-DEVICE-ENTRY-ERROR
with the restartsEXTRACT-DEVICE
andSKIP-ENTRY
active.
BLOCK-DEVICES
controls how block devices are extracted fromARCHIVE
. It defaults to:ERROR
on Windows or non-Windows and the current user is not root, T otherwise. The possible values are:T : Extract the block device.
:SKIP
: Skip the entry.:ERROR
: Signal aEXTRACT-BLOCK-DEVICE-ENTRY-ERROR
with the restartsEXTRACT-DEVICE
andSKIP-ENTRY
active.
FIFOS
controls howFIFOs
are extracted fromARCHIVE
. It defaults to T on non-Windows platforms and:ERROR
on Windows. The possible values are:T : Extract the
FIFO
.:SKIP
: Skip the entry.:ERROR
: Signal aEXTRACT-FIFO-ENTRY-ERROR
with the restartsEXTRACT-FIFO
andSKIP-ENTRY
active.
The following option controls what entries are extracted.
FILTER
defaults to (CONSTANTLY
T). Must be a function designator that takes two arguments (the entry and the pathname were it will be extracted) and returns non-NIL if the entry should be extracted.If symbolic and hard links are dereferenced, there may be broken or circular links. If that is detected, a
BROKEN-OR-CIRCULAR-LINKS-ERROR
is signalled with theCONTINUE
restart active.
3.1 Extraction Conditions
This section describes the conditions that can occur during
EXTRACT-ARCHIVE
.
[condition] EXTRACTION-ERROR ERROR
Base class of all errors signaled during archive extraction.
[condition] EXTRACTION-ENTRY-ERROR EXTRACTION-ERROR
An extraction error that is specific to an
ENTRY
.
- [reader] EXTRACTION-ENTRY-ERROR-ENTRY EXTRACTION-ENTRY-ERROR (:ENTRY = '
*CURRENT-ENTRY*
)
[condition] ENTRY-NAME-CONTAINS-DEVICE-ERROR EXTRACTION-ENTRY-ERROR
An entry contains a device in its pathname.
[condition] ENTRY-NAME-CONTAINS-..-ERROR EXTRACTION-ENTRY-ERROR
An entry contains .. in its pathname.
[condition] ENTRY-NAME-IS-ABSOLUTE-ERROR EXTRACTION-ENTRY-ERROR
An entry pathname is absolute.
[condition] EXTRACT-CHARACTER-DEVICE-ENTRY-ERROR EXTRACTION-ENTRY-ERROR
A character device that cannot be extracted.
[condition] EXTRACT-BLOCK-DEVICE-ENTRY-ERROR EXTRACTION-ENTRY-ERROR
A block device that cannot be extracted.
[condition] EXTRACT-FIFO-ENTRY-ERROR EXTRACTION-ENTRY-ERROR
A
FIFO
that cannot be extracted.
[condition] EXTRACT-SYMBOLIC-LINK-ENTRY-ERROR EXTRACTION-ENTRY-ERROR
A symbolic link that cannot be extracted.
[condition] EXTRACT-HARD-LINK-ENTRY-ERROR EXTRACTION-ENTRY-ERROR
A hard link that cannot be extracted.
[condition] BROKEN-OR-CIRCULAR-LINKS-ERROR EXTRACTION-ERROR
A series of symbolic or hard links is broken or circular.
[condition] DESTINATION-EXISTS-ERROR EXTRACTION-ENTRY-ERROR FILE-ERROR
Signaled when the destination of an entry exists.
[condition] EXTRACTION-THROUGH-SYMBOLIC-LINK-ERROR EXTRACTION-ENTRY-ERROR
Signaled when attempting to extract through a symbolic link.
[condition] FILE-EXISTS-IN-PLACE-OF-DIRECTORY-ERROR EXTRACTION-ENTRY-ERROR
Signaled when attempting to create a directory when a file already exists.
[function] DEREFERENCE-LINK &OPTIONAL C
Handle condition C by dereferencing the link.
[function] SKIP-ENTRY &OPTIONAL C
Handle condition C by skipping the entry.
[function] RELATIVIZE-ENTRY-NAME &OPTIONAL C
Handle condition C by relativizing the pathname.
[function] TREAT-..-AS-BACK &OPTIONAL C
Handle condition C by treating .. as
:BACK
.
[function] REMOVE-FILE &OPTIONAL C
Handle C by deleting the file.
[function] FOLLOW-SYMBOLIC-LINK &OPTIONAL C
Handle C by following the symbolic link.
[function] REPLACE-SYMBOLIC-LINK &OPTIONAL C
Handle C by replacing the symbolic link
[function] SUPERSEDE-FILE &OPTIONAL C
Handle C by truncating the file and overwriting it.
[function] EXTRACT-LINK &OPTIONAL C
Handle C by extracting the link.
[function] EXTRACT-DEVICE &OPTIONAL C
Handle C by extracting the device.
[function] EXTRACT-FIFO &OPTIONAL C
Handle C by extracting the fifo.