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/create
on Windows 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/"))
If you want to create a tar archive, attempting to preserve symbolic links and as much metadata as possible, evaluate the following:
(asdf:load-system "tar/create")
(let ((*default-pathname-defaults* #p"/path/to/parent/"))
(tar:with-open-archive (a "/path/to/file.tar" :direction :output)
(tar-create:create-archive a '("directory/") :recursep t)))
Systems
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.
tar/create
The tar/create
system produces a tar file from your file system that
faithfully reproduces all the metadata. It is a fairly complex beast and might
not work on all implementation/OS
combinations. Patches are always welcome to
make it more portable.
See the docstring for tar-create:create-archive
to understand its options.
FAQ
Can I create/extract compressed tar files?
Yes! It supports transparent gzip comporession. On input streams, the first few
bytes are examined for magic bytes. On output streams, the pathname is used as
a hint. You can override this behavior using the :compression
argument to
with-open-archive
or open-archive
.
Tar¶
This section describes the high level tar archive support.
Tar Archives¶
-
[class]
The base class of all archives.
-
[class]
An archive that uses
GNU
specific extensions.
-
[class]
An archive as specified by
POSIX
. Uses multiple physical entries to represent a single logical entry when values do not fit into the standardustar-archive
header.
-
[class]
A ustar archive that adds more fields to the header when compared to
v7-archive
s.
-
[class]
A very early archive format.
-
[function]
stream-or-path &key (type :auto) (direction :input)
(if-exists nil if-exists-supplied-p) (if-does-not-exist nil
if-does-not-exist-supplied-p) (blocking-factor 20) (compression :auto)
(header-encoding tar-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.COMPRESSION
determines what compression scheme is used, if any. It can be either:AUTO
(the default),NIL
(no compression), or:GZIP
. If:AUTO
, the compression type is determined using thePATHNAME
of the stream (for:OUTPUT
) or by peeking at the stream for magic numbers (for:INPUT
).
-
[generic-function]
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]
(archive-var stream-or-path &rest args &key type
direction if-exists if-does-not-exist blocking-factor header-encoding
compression) &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.
Tar Entries¶
This section describes the various entry types and how to read/write them from/to an archive.
-
[generic-function]
archive
Read an
entry
fromARCHIVE
.
-
[generic-function]
archive entry
Write
ENTRY
toARCHIVE
.
-
[macro]
(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]
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]
The base class of all entry types. Each
entry
must contain aname
,mode
,uid
,gid
, andmtime
. Other common properties areuname
,gname
,atime
, andctime
.
-
[class]
An entry representing a directory.
-
[class]
An entry representing a regular file.
-
[class]
An entry representing a symbolic link.
-
[class]
An entry representing a hard link.
-
[class]
An entry representing a
FIFO
.
-
[class]
An entry representing a block device.
-
[class]
An entry representing a character device.
-
[generic-function]
entry
The name of
ENTRY
. Returns aSTRING
.
-
[generic-function]
entry
The size of
ENTRY
. Returns a (INTEGER
0).
-
[generic-function]
entry
The uname of
ENTRY
. Returns aSTRING
.
-
[generic-function]
entry
The gname of
ENTRY
. Returns aSTRING
.
-
[generic-function]
entry
The mode of
ENTRY
. Returns amode-list
.
-
[generic-function]
entry
The mtime of
ENTRY
. Returns aTIMESTAMP
.
-
[generic-function]
entry
The atime of
ENTRY
. Returns aTIMESTAMP
.
-
[generic-function]
entry
The ctime of
ENTRY
. Returns aTIMESTAMP
.
-
[generic-function]
entry
The uid of
ENTRY
. Returns a (INTEGER
0).
-
[generic-function]
entry
The gid of
ENTRY
. Returns a (INTEGER
0).
-
[generic-function]
entry
The linkname of
ENTRY
. Returns aSTRING
.
-
[generic-function]
entry
The devmajor of
ENTRY
. Returns a (INTEGER
0).
-
[generic-function]
entry
The devminor of
ENTRY
. Returns a (INTEGER
0).
-
[generic-function]
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.
Tar Conditions¶
This section describes the various conditions and restarts in the tar system.
-
[condition]
The base condition.
-
[condition]
The base error condition.
-
[condition]
Signaled when a property is set or accessed that the underlying tar file cannot represent.
-
[condition]
Signaled when trying to
write-entry
with a required property that is missing.
- [reader] (:name)
-
[condition]
Signaled when trying to
write-entry
with a property that is unsupported by the underlying archive type.
- [reader] (:name)
- [reader] (:value)
-
[condition]
Signaled when trying to
write-entry
with a property that is too long for the underlying archive type.
-
[function]
&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]
&optional condition
Truncate the value and write it to the archive.
-
[macro]
(&optional value) &body body
Execute
BODY
in a context whereunsupported-property
errors are ignored andVALUE
is returned from any attempt to access them.
-
[macro]
(&key (properties t)) &body body
Evaluate
BODY
in a context where truncatable values are automatically truncated.
Simple Extraction ¶
This section describes the support for simple extraction to the filesystem.
-
[function]
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 howFIFO
s 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.
Simple Extraction Conditions ¶
This section describes the conditions that can occur during
simple-extract-archive
.
-
[condition]
Base class of all errors signaled during archive extraction.
-
[condition]
An extraction error that is specific to an
ENTRY
.
- [reader] (:entry = '\*current-entry\*)
-
[condition]
An entry contains a device in its pathname.
-
[condition]
An entry contains .. in its pathname.
-
[condition]
An entry pathname is absolute.
-
[condition]
A character device that cannot be extracted.
-
[condition]
A block device that cannot be extracted.
-
[condition]
A
FIFO
that cannot be extracted.
-
[condition]
A symbolic link that cannot be extracted.
-
[condition]
A hard link that cannot be extracted.
-
[condition]
A series of symbolic or hard links is broken or circular.
-
[function]
&optional c
Handle condition C by dereferencing the link.
-
[function]
&optional c
Handle condition C by skipping the entry.
-
[function]
&optional c
Handle condition C by relativizing the pathname.
-
[function]
&optional c
Handle condition C by treating .. as
:BACK
.
Extraction¶
This section describes the support for non-portable extraction to the filesystem.
-
[function]
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 howFIFO
s 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.
Extraction Conditions ¶
This section describes the conditions that can occur during
extract-archive
.
-
[condition]
Base class of all errors signaled during archive extraction.
-
[condition]
An extraction error that is specific to an
ENTRY
.
- [reader] (:entry = '\*current-entry\*)
-
[condition]
An entry contains a device in its pathname.
-
[condition]
An entry contains .. in its pathname.
-
[condition]
An entry pathname is absolute.
-
[condition]
A character device that cannot be extracted.
-
[condition]
A block device that cannot be extracted.
-
[condition]
A
FIFO
that cannot be extracted.
-
[condition]
A symbolic link that cannot be extracted.
-
[condition]
A hard link that cannot be extracted.
-
[condition]
A series of symbolic or hard links is broken or circular.
-
[condition]
Signaled when the destination of an entry exists.
-
[condition]
Signaled when attempting to extract through a symbolic link.
-
[condition]
Signaled when attempting to create a directory when a file already exists.
-
[function]
&optional c
Handle condition C by dereferencing the link.
-
[function]
&optional c
Handle condition C by skipping the entry.
-
[function]
&optional c
Handle condition C by relativizing the pathname.
-
[function]
&optional c
Handle condition C by treating .. as
:BACK
.
-
[function]
&optional c
Handle C by deleting the file.
-
[function]
&optional c
Handle C by following the symbolic link.
-
[function]
&optional c
Handle C by replacing the symbolic link
-
[function]
&optional c
Handle C by truncating the file and overwriting it.
-
[function]
&optional c
Handle C by extracting the link.
-
[function]
&optional c
Handle C by extracting the device.
-
[function]
&optional c
Handle C by extracting the fifo.
Create¶
This section describes the support for non-portable creation of archives from the filesystem.
-
[function]
archive file-list &key prefix recursep
dereference-hardlinks-p (filter (constantly t))
Add all files in
FILE-LIST
toARCHIVE
.FILE-LIST
may be a string, pathname, or a list of strings or pathnames. All relative pathname designators are relative to*DEFAULT-PATHNAME-DEFAULTS*
. If an item inFILE-LIST
designates an absolute pathname, the corresponding entry in the tar file will be absolute as well.PREFIX
must be a string which is prepended to every entry name in the archive.If
RECURSEP
is true, then any entries inFILE-LIST
naming directories (and not symlinks to directories) will be recursed into.If
DEREFERENCE-HARDLINKS-P
is true, then hardlinks will be followed and saved as regular file entries instead of hardlink entries.The following option controls what entries are created.
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.