Merge FreeBSD changes from usr.bin/tar to contrib/libarchive/tar:
r204111 (uqs): Fix common misspelling of hierarchy r207786 (kientzle): Various manpage updates, including many long-option synonyms that were previously undocumented. r208028 (uqs): mdoc: move remaining sections into consistent order This pertains mostly to FILES, HISTORY, EXIT STATUS and AUTHORS sections. r209152 (kientzle): If the compressed data is larger than the uncompressed, report the compression ratio as 0% instead of displaying nonsense triggered by numeric overflow. This is common when dealing with uncompressed files when the I/O blocking causes there to be small transient differences in the accounting. r210720 (joel): Fix typos. r223541 (kientzle): If there is a read error reading Y/N confirmation from the keyboard, exit immediately with an error. If there is an error opening or reading a file to put into the archive, set the return value for a deferred error exit. r223573 (kientzle): The --newer-than test should descend into old directories to look for new files. r226636 (kientzle): Typo from previous commit. Urgh. r224153 (mm, partial): Update bsdtar.1 manpage MFC after: 2 weeks
This commit is contained in:
parent
e9dd49674a
commit
c5d360f82a
@ -50,8 +50,8 @@
|
|||||||
.Sh DESCRIPTION
|
.Sh DESCRIPTION
|
||||||
.Nm
|
.Nm
|
||||||
creates and manipulates streaming archive files.
|
creates and manipulates streaming archive files.
|
||||||
This implementation can extract from tar, pax, cpio, zip, jar, ar,
|
This implementation can extract from tar, pax, cpio, zip, jar, ar, xar,
|
||||||
and ISO 9660 cdrom images and can create tar, pax, cpio, ar,
|
rpm and ISO 9660 cdrom images and can create tar, pax, cpio, ar, zip,
|
||||||
and shar archives.
|
and shar archives.
|
||||||
.Pp
|
.Pp
|
||||||
The first synopsis form shows a
|
The first synopsis form shows a
|
||||||
@ -67,6 +67,8 @@ is a mode indicator from the following list:
|
|||||||
.Bl -tag -compact -width indent
|
.Bl -tag -compact -width indent
|
||||||
.It Fl c
|
.It Fl c
|
||||||
Create a new archive containing the specified items.
|
Create a new archive containing the specified items.
|
||||||
|
The long option form is
|
||||||
|
.Fl Fl create .
|
||||||
.It Fl r
|
.It Fl r
|
||||||
Like
|
Like
|
||||||
.Fl c ,
|
.Fl c ,
|
||||||
@ -75,8 +77,12 @@ Note that this only works on uncompressed archives stored in regular files.
|
|||||||
The
|
The
|
||||||
.Fl f
|
.Fl f
|
||||||
option is required.
|
option is required.
|
||||||
|
The long option form is
|
||||||
|
.Fl Fl append .
|
||||||
.It Fl t
|
.It Fl t
|
||||||
List archive contents to stdout.
|
List archive contents to stdout.
|
||||||
|
The long option form is
|
||||||
|
.Fl Fl list .
|
||||||
.It Fl u
|
.It Fl u
|
||||||
Like
|
Like
|
||||||
.Fl r ,
|
.Fl r ,
|
||||||
@ -86,11 +92,15 @@ Note that this only works on uncompressed archives stored in regular files.
|
|||||||
The
|
The
|
||||||
.Fl f
|
.Fl f
|
||||||
option is required.
|
option is required.
|
||||||
|
The long form is
|
||||||
|
.Fl Fl update .
|
||||||
.It Fl x
|
.It Fl x
|
||||||
Extract to disk from the archive.
|
Extract to disk from the archive.
|
||||||
If a file with the same name appears more than once in the archive,
|
If a file with the same name appears more than once in the archive,
|
||||||
each copy will be extracted, with later copies overwriting (replacing)
|
each copy will be extracted, with later copies overwriting (replacing)
|
||||||
earlier copies.
|
earlier copies.
|
||||||
|
The long option form is
|
||||||
|
.Fl Fl extract .
|
||||||
.El
|
.El
|
||||||
.Pp
|
.Pp
|
||||||
In
|
In
|
||||||
@ -127,14 +137,18 @@ In contrast,
|
|||||||
.Dl Nm Fl c Fl f Pa - Pa newfile Pa original.tar
|
.Dl Nm Fl c Fl f Pa - Pa newfile Pa original.tar
|
||||||
creates a new archive with only two entries.
|
creates a new archive with only two entries.
|
||||||
Similarly,
|
Similarly,
|
||||||
.Dl Nm Fl czf Pa - Fl -format Cm pax Cm @ Ns Pa -
|
.Dl Nm Fl czf Pa - Fl Fl format Cm pax Cm @ Ns Pa -
|
||||||
reads an archive from standard input (whose format will be determined
|
reads an archive from standard input (whose format will be determined
|
||||||
automatically) and converts it into a gzip-compressed
|
automatically) and converts it into a gzip-compressed
|
||||||
pax-format archive on stdout.
|
pax-format archive on stdout.
|
||||||
In this way,
|
In this way,
|
||||||
.Nm
|
.Nm
|
||||||
can be used to convert archives from one format to another.
|
can be used to convert archives from one format to another.
|
||||||
.It Fl b Ar blocksize
|
.It Fl B , Fl Fl read-full-blocks
|
||||||
|
Ignored for compatibility with other
|
||||||
|
.Xr tar 1
|
||||||
|
implementations.
|
||||||
|
.It Fl b Ar blocksize , Fl Fl block-size Ar blocksize
|
||||||
Specify the block size, in 512-byte records, for tape drive I/O.
|
Specify the block size, in 512-byte records, for tape drive I/O.
|
||||||
As a rule, this argument is only needed when reading from or writing
|
As a rule, this argument is only needed when reading from or writing
|
||||||
to tape drives, and usually not even then as the default block size of
|
to tape drives, and usually not even then as the default block size of
|
||||||
@ -144,21 +158,22 @@ In c and r mode, this changes the directory before adding
|
|||||||
the following files.
|
the following files.
|
||||||
In x mode, change directories after opening the archive
|
In x mode, change directories after opening the archive
|
||||||
but before extracting entries from the archive.
|
but before extracting entries from the archive.
|
||||||
.It Fl -check-links
|
.It Fl Fl chroot
|
||||||
(c and r modes only)
|
|
||||||
Issue a warning message unless all links to each file are archived.
|
|
||||||
.It Fl -chroot
|
|
||||||
(x mode only)
|
(x mode only)
|
||||||
.Fn chroot
|
.Fn chroot
|
||||||
to the current directory after processing any
|
to the current directory after processing any
|
||||||
.Fl C
|
.Fl C
|
||||||
options and before extracting any files.
|
options and before extracting any files.
|
||||||
.It Fl -exclude Ar pattern
|
.It Fl Fl disable-copyfile
|
||||||
|
Mac OS X specific.
|
||||||
|
Disable the use of
|
||||||
|
.Xr copyfile 3 .
|
||||||
|
.It Fl Fl exclude Ar pattern
|
||||||
Do not process files or directories that match the
|
Do not process files or directories that match the
|
||||||
specified pattern.
|
specified pattern.
|
||||||
Note that exclusions take precedence over patterns or filenames
|
Note that exclusions take precedence over patterns or filenames
|
||||||
specified on the command line.
|
specified on the command line.
|
||||||
.It Fl -format Ar format
|
.It Fl Fl format Ar format
|
||||||
(c, r, u mode only)
|
(c, r, u mode only)
|
||||||
Use the specified format for the created archive.
|
Use the specified format for the created archive.
|
||||||
Supported formats include
|
Supported formats include
|
||||||
@ -172,16 +187,18 @@ Other formats may also be supported; see
|
|||||||
for more information about currently-supported formats.
|
for more information about currently-supported formats.
|
||||||
In r and u modes, when extending an existing archive, the format specified
|
In r and u modes, when extending an existing archive, the format specified
|
||||||
here must be compatible with the format of the existing archive on disk.
|
here must be compatible with the format of the existing archive on disk.
|
||||||
.It Fl f Ar file
|
.It Fl f Ar file , Fl Fl file Ar file
|
||||||
Read the archive from or write the archive to the specified file.
|
Read the archive from or write the archive to the specified file.
|
||||||
The filename can be
|
The filename can be
|
||||||
.Pa -
|
.Pa -
|
||||||
for standard input or standard output.
|
for standard input or standard output.
|
||||||
If not specified, the default tape device will be used.
|
The default varies by system;
|
||||||
(On
|
on
|
||||||
.Fx ,
|
.Fx ,
|
||||||
the default tape device is
|
the default is
|
||||||
.Pa /dev/sa0 . )
|
.Pa /dev/sa0 ;
|
||||||
|
on Linux, the default is
|
||||||
|
.Pa /dev/st0 .
|
||||||
.It Fl Fl gid Ar id
|
.It Fl Fl gid Ar id
|
||||||
Use the provided group id number.
|
Use the provided group id number.
|
||||||
On extract, this overrides the group id in the archive;
|
On extract, this overrides the group id in the archive;
|
||||||
@ -214,25 +231,36 @@ Synonym for
|
|||||||
.It Fl I
|
.It Fl I
|
||||||
Synonym for
|
Synonym for
|
||||||
.Fl T .
|
.Fl T .
|
||||||
.It Fl -include Ar pattern
|
.It Fl Fl help
|
||||||
|
Show usage.
|
||||||
|
.It Fl Fl include Ar pattern
|
||||||
Process only files or directories that match the specified pattern.
|
Process only files or directories that match the specified pattern.
|
||||||
Note that exclusions specified with
|
Note that exclusions specified with
|
||||||
.Fl -exclude
|
.Fl Fl exclude
|
||||||
take precedence over inclusions.
|
take precedence over inclusions.
|
||||||
If no inclusions are explicitly specified, all entries are processed by
|
If no inclusions are explicitly specified, all entries are processed by
|
||||||
default.
|
default.
|
||||||
The
|
The
|
||||||
.Fl -include
|
.Fl Fl include
|
||||||
option is especially useful when filtering archives.
|
option is especially useful when filtering archives.
|
||||||
For example, the command
|
For example, the command
|
||||||
.Dl Nm Fl c Fl f Pa new.tar Fl -include='*foo*' Cm @ Ns Pa old.tgz
|
.Dl Nm Fl c Fl f Pa new.tar Fl Fl include='*foo*' Cm @ Ns Pa old.tgz
|
||||||
creates a new archive
|
creates a new archive
|
||||||
.Pa new.tar
|
.Pa new.tar
|
||||||
containing only the entries from
|
containing only the entries from
|
||||||
.Pa old.tgz
|
.Pa old.tgz
|
||||||
containing the string
|
containing the string
|
||||||
.Sq foo .
|
.Sq foo .
|
||||||
.It Fl j
|
.It Fl J , Fl Fl xz
|
||||||
|
(c mode only)
|
||||||
|
Compress the resulting archive with
|
||||||
|
.Xr xz 1 .
|
||||||
|
In extract or list modes, this option is ignored.
|
||||||
|
Note that, unlike other
|
||||||
|
.Nm tar
|
||||||
|
implementations, this implementation recognizes XZ compression
|
||||||
|
automatically when reading archives.
|
||||||
|
.It Fl j , Fl Fl bzip , Fl Fl bzip2 , Fl Fl bunzip2
|
||||||
(c mode only)
|
(c mode only)
|
||||||
Compress the resulting archive with
|
Compress the resulting archive with
|
||||||
.Xr bzip2 1 .
|
.Xr bzip2 1 .
|
||||||
@ -241,68 +269,71 @@ Note that, unlike other
|
|||||||
.Nm tar
|
.Nm tar
|
||||||
implementations, this implementation recognizes bzip2 compression
|
implementations, this implementation recognizes bzip2 compression
|
||||||
automatically when reading archives.
|
automatically when reading archives.
|
||||||
.It Fl k
|
.It Fl k , Fl Fl keep-old-files
|
||||||
(x mode only)
|
(x mode only)
|
||||||
Do not overwrite existing files.
|
Do not overwrite existing files.
|
||||||
In particular, if a file appears more than once in an archive,
|
In particular, if a file appears more than once in an archive,
|
||||||
later copies will not overwrite earlier copies.
|
later copies will not overwrite earlier copies.
|
||||||
.It Fl -keep-newer-files
|
.It Fl Fl keep-newer-files
|
||||||
(x mode only)
|
(x mode only)
|
||||||
Do not overwrite existing files that are newer than the
|
Do not overwrite existing files that are newer than the
|
||||||
versions appearing in the archive being extracted.
|
versions appearing in the archive being extracted.
|
||||||
.It Fl L
|
.It Fl L , Fl Fl dereference
|
||||||
(c and r mode only)
|
(c and r mode only)
|
||||||
All symbolic links will be followed.
|
All symbolic links will be followed.
|
||||||
Normally, symbolic links are archived as such.
|
Normally, symbolic links are archived as such.
|
||||||
With this option, the target of the link will be archived instead.
|
With this option, the target of the link will be archived instead.
|
||||||
.It Fl l
|
.It Fl l , Fl Fl check-links
|
||||||
This is a synonym for the
|
(c and r modes only)
|
||||||
.Fl -check-links
|
Issue a warning message unless all links to each file are archived.
|
||||||
option.
|
.It Fl Fl lzma
|
||||||
.It Fl m
|
(c mode only) Compress the resulting archive with the original LZMA algorithm.
|
||||||
|
Use of this option is discouraged and new archives should be created with
|
||||||
|
.Fl Fl xz
|
||||||
|
instead.
|
||||||
|
Note that, unlike other
|
||||||
|
.Nm tar
|
||||||
|
implementations, this implementation recognizes LZMA compression
|
||||||
|
automatically when reading archives.
|
||||||
|
.It Fl m , Fl Fl modification-time
|
||||||
(x mode only)
|
(x mode only)
|
||||||
Do not extract modification time.
|
Do not extract modification time.
|
||||||
By default, the modification time is set to the time stored in the archive.
|
By default, the modification time is set to the time stored in the archive.
|
||||||
.It Fl n
|
.It Fl n , Fl Fl norecurse , Fl Fl no-recursion
|
||||||
(c, r, u modes only)
|
(c, r, u modes only)
|
||||||
Do not recursively archive the contents of directories.
|
Do not recursively archive the contents of directories.
|
||||||
.It Fl -newer Ar date
|
.It Fl Fl newer Ar date
|
||||||
(c, r, u modes only)
|
(c, r, u modes only)
|
||||||
Only include files and directories newer than the specified date.
|
Only include files and directories newer than the specified date.
|
||||||
This compares ctime entries.
|
This compares ctime entries.
|
||||||
.It Fl -newer-mtime Ar date
|
.It Fl Fl newer-mtime Ar date
|
||||||
(c, r, u modes only)
|
(c, r, u modes only)
|
||||||
Like
|
Like
|
||||||
.Fl -newer ,
|
.Fl Fl newer ,
|
||||||
except it compares mtime entries instead of ctime entries.
|
except it compares mtime entries instead of ctime entries.
|
||||||
.It Fl -newer-than Pa file
|
.It Fl Fl newer-than Pa file
|
||||||
(c, r, u modes only)
|
(c, r, u modes only)
|
||||||
Only include files and directories newer than the specified file.
|
Only include files and directories newer than the specified file.
|
||||||
This compares ctime entries.
|
This compares ctime entries.
|
||||||
.It Fl -newer-mtime-than Pa file
|
.It Fl Fl newer-mtime-than Pa file
|
||||||
(c, r, u modes only)
|
(c, r, u modes only)
|
||||||
Like
|
Like
|
||||||
.Fl -newer-than ,
|
.Fl Fl newer-than ,
|
||||||
except it compares mtime entries instead of ctime entries.
|
except it compares mtime entries instead of ctime entries.
|
||||||
.It Fl -nodump
|
.It Fl Fl nodump
|
||||||
(c and r modes only)
|
(c and r modes only)
|
||||||
Honor the nodump file flag by skipping this file.
|
Honor the nodump file flag by skipping this file.
|
||||||
.It Fl -null
|
.It Fl Fl null
|
||||||
(use with
|
(use with
|
||||||
.Fl I ,
|
.Fl I
|
||||||
.Fl T ,
|
|
||||||
or
|
or
|
||||||
.Fl X )
|
.Fl T )
|
||||||
Filenames or patterns are separated by null characters,
|
Filenames or patterns are separated by null characters,
|
||||||
not by newlines.
|
not by newlines.
|
||||||
This is often used to read filenames output by the
|
This is often used to read filenames output by the
|
||||||
.Fl print0
|
.Fl print0
|
||||||
option to
|
option to
|
||||||
.Xr find 1 .
|
.Xr find 1 .
|
||||||
.It Fl -numeric-owner
|
|
||||||
(x mode only)
|
|
||||||
Ignore symbolic user and group names when restoring archives to disk,
|
|
||||||
only numeric uid and gid values will be obeyed.
|
|
||||||
.It Fl Fl no-same-owner
|
.It Fl Fl no-same-owner
|
||||||
(x mode only)
|
(x mode only)
|
||||||
Do not extract owner and group IDs.
|
Do not extract owner and group IDs.
|
||||||
@ -330,7 +361,7 @@ On extract, it causes user and group names in the archive
|
|||||||
to be ignored in favor of the numeric user and group ids.
|
to be ignored in favor of the numeric user and group ids.
|
||||||
On create, it causes user and group names to not be stored
|
On create, it causes user and group names to not be stored
|
||||||
in the archive.
|
in the archive.
|
||||||
.It Fl O
|
.It Fl O , Fl Fl to-stdout
|
||||||
(x, t modes only)
|
(x, t modes only)
|
||||||
In extract (-x) mode, files will be written to standard out rather than
|
In extract (-x) mode, files will be written to standard out rather than
|
||||||
being extracted to disk.
|
being extracted to disk.
|
||||||
@ -349,11 +380,11 @@ the archive will be discarded.
|
|||||||
.It Fl o
|
.It Fl o
|
||||||
(c, r, u mode)
|
(c, r, u mode)
|
||||||
A synonym for
|
A synonym for
|
||||||
.Fl -format Ar ustar
|
.Fl Fl format Ar ustar
|
||||||
.It Fl -one-file-system
|
.It Fl Fl one-file-system
|
||||||
(c, r, and u modes)
|
(c, r, and u modes)
|
||||||
Do not cross mount points.
|
Do not cross mount points.
|
||||||
.It Fl -options Ar options
|
.It Fl Fl options Ar options
|
||||||
Select optional behaviors for particular modules.
|
Select optional behaviors for particular modules.
|
||||||
The argument is a text string containing comma-separated
|
The argument is a text string containing comma-separated
|
||||||
keywords and values.
|
keywords and values.
|
||||||
@ -424,7 +455,7 @@ Supported values are store (uncompressed) and deflate (gzip algorithm).
|
|||||||
.El
|
.El
|
||||||
If a provided option is not supported by any module, that
|
If a provided option is not supported by any module, that
|
||||||
is a fatal error.
|
is a fatal error.
|
||||||
.It Fl P
|
.It Fl P , Fl Fl absolute-paths
|
||||||
Preserve pathnames.
|
Preserve pathnames.
|
||||||
By default, absolute pathnames (those that begin with a /
|
By default, absolute pathnames (those that begin with a /
|
||||||
character) have the leading slash removed both when creating archives
|
character) have the leading slash removed both when creating archives
|
||||||
@ -435,21 +466,22 @@ will refuse to extract archive entries whose pathnames contain
|
|||||||
.Pa ..
|
.Pa ..
|
||||||
or whose target directory would be altered by a symlink.
|
or whose target directory would be altered by a symlink.
|
||||||
This option suppresses these behaviors.
|
This option suppresses these behaviors.
|
||||||
.It Fl p
|
.It Fl p , Fl Fl insecure , Fl Fl preserve-permissions
|
||||||
(x mode only)
|
(x mode only)
|
||||||
Preserve file permissions.
|
Preserve file permissions.
|
||||||
Attempt to restore the full permissions, including owner, file modes, file
|
Attempt to restore the full permissions, including owner, file modes, file
|
||||||
flags and ACLs, if available, for each item extracted from the archive.
|
flags and ACLs, if available, for each item extracted from the archive.
|
||||||
By default, newly-created files are owned by the user running
|
This is the default, if
|
||||||
.Nm ,
|
|
||||||
the file mode is restored for newly-created regular files, and
|
|
||||||
all other types of entries receive default permissions.
|
|
||||||
If
|
|
||||||
.Nm
|
.Nm
|
||||||
is being run by root, the default is to restore the owner unless the
|
is being run by root and can be overriden by also specifying
|
||||||
.Fl o
|
.Fl Fl no-same-owner
|
||||||
option is also specified.
|
and
|
||||||
.It Fl q ( Fl -fast-read )
|
.Fl Fl no-same-permissions .
|
||||||
|
.It Fl Fl posix
|
||||||
|
(c, r, u mode only)
|
||||||
|
Synonym for
|
||||||
|
.Fl Fl format Ar pax
|
||||||
|
.It Fl q , Fl Fl fast-read
|
||||||
(x and t mode only)
|
(x and t mode only)
|
||||||
Extract or list only the first archive entry that matches each pattern
|
Extract or list only the first archive entry that matches each pattern
|
||||||
or filename operand.
|
or filename operand.
|
||||||
@ -463,8 +495,16 @@ This option is provided as a performance optimization.
|
|||||||
Extract files as sparse files.
|
Extract files as sparse files.
|
||||||
For every block on disk, check first if it contains only NULL bytes and seek
|
For every block on disk, check first if it contains only NULL bytes and seek
|
||||||
over it otherwise.
|
over it otherwise.
|
||||||
This works similiar to the conv=sparse option of dd.
|
This works similar to the conv=sparse option of dd.
|
||||||
.It Fl -strip-components Ar count
|
.It Fl Fl same-owner
|
||||||
|
(x mode only)
|
||||||
|
Extract owner and group IDs.
|
||||||
|
This is the reverse of
|
||||||
|
.Fl Fl no-same-owner
|
||||||
|
and the default behavior if
|
||||||
|
.Nm
|
||||||
|
is run as root.
|
||||||
|
.It Fl Fl strip-components Ar count
|
||||||
(x mode only)
|
(x mode only)
|
||||||
Remove the specified number of leading path elements.
|
Remove the specified number of leading path elements.
|
||||||
Pathnames with fewer elements will be silently skipped.
|
Pathnames with fewer elements will be silently skipped.
|
||||||
@ -496,7 +536,7 @@ of symbolic links.
|
|||||||
The optional trailing p specifies that after a successful substitution
|
The optional trailing p specifies that after a successful substitution
|
||||||
the original path name and the new path name should be printed to
|
the original path name and the new path name should be printed to
|
||||||
standard error.
|
standard error.
|
||||||
.It Fl T Ar filename
|
.It Fl T Ar filename , Fl Fl files-from Ar filename
|
||||||
In x or t mode,
|
In x or t mode,
|
||||||
.Nm
|
.Nm
|
||||||
will read the list of names to be extracted from
|
will read the list of names to be extracted from
|
||||||
@ -510,20 +550,26 @@ The special name
|
|||||||
on a line by itself will cause the current directory to be changed to
|
on a line by itself will cause the current directory to be changed to
|
||||||
the directory specified on the following line.
|
the directory specified on the following line.
|
||||||
Names are terminated by newlines unless
|
Names are terminated by newlines unless
|
||||||
.Fl -null
|
.Fl Fl null
|
||||||
is specified.
|
is specified.
|
||||||
Note that
|
Note that
|
||||||
.Fl -null
|
.Fl Fl null
|
||||||
also disables the special handling of lines containing
|
also disables the special handling of lines containing
|
||||||
.Dq -C .
|
.Dq -C .
|
||||||
.It Fl U
|
.It Fl Fl totals
|
||||||
|
(c, r, u mode only)
|
||||||
|
After archiving all files, print a summary to stderr.
|
||||||
|
.It Fl U , Fl Fl unlink , Fl Fl unlink-first
|
||||||
(x mode only)
|
(x mode only)
|
||||||
Unlink files before creating them.
|
Unlink files before creating them.
|
||||||
Without this option,
|
This can be a minor performance optimization if most files
|
||||||
|
already exist, but can make things slower if most files
|
||||||
|
do not already exist.
|
||||||
|
This flag also causes
|
||||||
.Nm
|
.Nm
|
||||||
overwrites existing files, which preserves existing hardlinks.
|
to remove intervening directory symlinks instead of
|
||||||
With this option, existing hardlinks will be broken, as will any
|
reporting an error.
|
||||||
symlink that would affect the location of an extracted file.
|
See the SECURITY section below for more details.
|
||||||
.It Fl Fl uid Ar id
|
.It Fl Fl uid Ar id
|
||||||
Use the provided user id number and ignore the user
|
Use the provided user id number and ignore the user
|
||||||
name from the archive.
|
name from the archive.
|
||||||
@ -547,7 +593,7 @@ the name is not verified against the system user database.
|
|||||||
Pipe the input (in x or t mode) or the output (in c mode) through
|
Pipe the input (in x or t mode) or the output (in c mode) through
|
||||||
.Pa program
|
.Pa program
|
||||||
instead of using the builtin compression support.
|
instead of using the builtin compression support.
|
||||||
.It Fl v
|
.It Fl v , Fl Fl verbose
|
||||||
Produce verbose output.
|
Produce verbose output.
|
||||||
In create and extract modes,
|
In create and extract modes,
|
||||||
.Nm
|
.Nm
|
||||||
@ -560,18 +606,18 @@ will produce output similar to that of
|
|||||||
Additional
|
Additional
|
||||||
.Fl v
|
.Fl v
|
||||||
options will provide additional detail.
|
options will provide additional detail.
|
||||||
.It Fl -version
|
.It Fl Fl version
|
||||||
Print version of
|
Print version of
|
||||||
.Nm
|
.Nm
|
||||||
and
|
and
|
||||||
.Nm libarchive ,
|
.Nm libarchive ,
|
||||||
and exit.
|
and exit.
|
||||||
.It Fl w
|
.It Fl w , Fl Fl confirmation , Fl Fl interactive
|
||||||
Ask for confirmation for every action.
|
Ask for confirmation for every action.
|
||||||
.It Fl X Ar filename
|
.It Fl X Ar filename , Fl Fl exclude-from Ar filename
|
||||||
Read a list of exclusion patterns from the specified file.
|
Read a list of exclusion patterns from the specified file.
|
||||||
See
|
See
|
||||||
.Fl -exclude
|
.Fl Fl exclude
|
||||||
for more information about the handling of exclusions.
|
for more information about the handling of exclusions.
|
||||||
.It Fl y
|
.It Fl y
|
||||||
(c mode only)
|
(c mode only)
|
||||||
@ -582,16 +628,7 @@ Note that, unlike other
|
|||||||
.Nm tar
|
.Nm tar
|
||||||
implementations, this implementation recognizes bzip2 compression
|
implementations, this implementation recognizes bzip2 compression
|
||||||
automatically when reading archives.
|
automatically when reading archives.
|
||||||
.It Fl z
|
.It Fl Z , Fl Fl compress , Fl Fl uncompress
|
||||||
(c mode only)
|
|
||||||
Compress the resulting archive with
|
|
||||||
.Xr gzip 1 .
|
|
||||||
In extract or list modes, this option is ignored.
|
|
||||||
Note that, unlike other
|
|
||||||
.Nm tar
|
|
||||||
implementations, this implementation recognizes gzip compression
|
|
||||||
automatically when reading archives.
|
|
||||||
.It Fl Z
|
|
||||||
(c mode only)
|
(c mode only)
|
||||||
Compress the resulting archive with
|
Compress the resulting archive with
|
||||||
.Xr compress 1 .
|
.Xr compress 1 .
|
||||||
@ -600,9 +637,16 @@ Note that, unlike other
|
|||||||
.Nm tar
|
.Nm tar
|
||||||
implementations, this implementation recognizes compress compression
|
implementations, this implementation recognizes compress compression
|
||||||
automatically when reading archives.
|
automatically when reading archives.
|
||||||
|
.It Fl z , Fl Fl gunzip , Fl Fl gzip
|
||||||
|
(c mode only)
|
||||||
|
Compress the resulting archive with
|
||||||
|
.Xr gzip 1 .
|
||||||
|
In extract or list modes, this option is ignored.
|
||||||
|
Note that, unlike other
|
||||||
|
.Nm tar
|
||||||
|
implementations, this implementation recognizes gzip compression
|
||||||
|
automatically when reading archives.
|
||||||
.El
|
.El
|
||||||
.Sh EXIT STATUS
|
|
||||||
.Ex -std
|
|
||||||
.Sh ENVIRONMENT
|
.Sh ENVIRONMENT
|
||||||
The following environment variables affect the execution of
|
The following environment variables affect the execution of
|
||||||
.Nm :
|
.Nm :
|
||||||
@ -613,25 +657,21 @@ See
|
|||||||
.Xr environ 7
|
.Xr environ 7
|
||||||
for more information.
|
for more information.
|
||||||
.It Ev TAPE
|
.It Ev TAPE
|
||||||
The default tape device.
|
The default device.
|
||||||
The
|
The
|
||||||
.Fl f
|
.Fl f
|
||||||
option overrides this.
|
option overrides this.
|
||||||
|
Please see the description of the
|
||||||
|
.Fl f
|
||||||
|
option above for more details.
|
||||||
.It Ev TZ
|
.It Ev TZ
|
||||||
The timezone to use when displaying dates.
|
The timezone to use when displaying dates.
|
||||||
See
|
See
|
||||||
.Xr environ 7
|
.Xr environ 7
|
||||||
for more information.
|
for more information.
|
||||||
.El
|
.El
|
||||||
.Sh FILES
|
.Sh EXIT STATUS
|
||||||
.Bl -tag -width ".Ev BLOCKSIZE"
|
.Ex -std
|
||||||
.It Pa /dev/sa0
|
|
||||||
The default tape device, if not overridden by the
|
|
||||||
.Ev TAPE
|
|
||||||
environment variable or the
|
|
||||||
.Fl f
|
|
||||||
option.
|
|
||||||
.El
|
|
||||||
.Sh EXAMPLES
|
.Sh EXAMPLES
|
||||||
The following creates a new archive
|
The following creates a new archive
|
||||||
called
|
called
|
||||||
@ -694,9 +734,9 @@ permissions, or names that differ from existing data on disk:
|
|||||||
.Dl $ tar -cvf output.tar @input.mtree
|
.Dl $ tar -cvf output.tar @input.mtree
|
||||||
.Pp
|
.Pp
|
||||||
The
|
The
|
||||||
.Fl -newer
|
.Fl Fl newer
|
||||||
and
|
and
|
||||||
.Fl -newer-mtime
|
.Fl Fl newer-mtime
|
||||||
switches accept a variety of common date and time specifications, including
|
switches accept a variety of common date and time specifications, including
|
||||||
.Dq 12 Mar 2005 7:14:29pm ,
|
.Dq 12 Mar 2005 7:14:29pm ,
|
||||||
.Dq 2005-03-12 19:14 ,
|
.Dq 2005-03-12 19:14 ,
|
||||||
@ -705,7 +745,7 @@ and
|
|||||||
.Dq 19:14 PST May 1 .
|
.Dq 19:14 PST May 1 .
|
||||||
.Pp
|
.Pp
|
||||||
The
|
The
|
||||||
.Fl -options
|
.Fl Fl options
|
||||||
argument can be used to control various details of archive generation
|
argument can be used to control various details of archive generation
|
||||||
or reading.
|
or reading.
|
||||||
For example, you can generate mtree output which only contains
|
For example, you can generate mtree output which only contains
|
||||||
@ -713,9 +753,9 @@ For example, you can generate mtree output which only contains
|
|||||||
and
|
and
|
||||||
.Cm uid
|
.Cm uid
|
||||||
keywords:
|
keywords:
|
||||||
.Dl Nm Fl cf Pa file.tar Fl -format=mtree Fl -options='!all,type,time,uid' Pa dir
|
.Dl Nm Fl cf Pa file.tar Fl Fl format=mtree Fl Fl options='!all,type,time,uid' Pa dir
|
||||||
or you can set the compression level used by gzip or xz compression:
|
or you can set the compression level used by gzip or xz compression:
|
||||||
.Dl Nm Fl czf Pa file.tar Fl -options='compression-level=9' .
|
.Dl Nm Fl czf Pa file.tar Fl Fl options='compression-level=9' .
|
||||||
For more details, see the explanation of the
|
For more details, see the explanation of the
|
||||||
.Fn archive_read_set_options
|
.Fn archive_read_set_options
|
||||||
and
|
and
|
||||||
@ -861,6 +901,7 @@ components, or symlinks to other directories.
|
|||||||
.Xr mt 1 ,
|
.Xr mt 1 ,
|
||||||
.Xr pax 1 ,
|
.Xr pax 1 ,
|
||||||
.Xr shar 1 ,
|
.Xr shar 1 ,
|
||||||
|
.Xr xz 1 ,
|
||||||
.Xr libarchive 3 ,
|
.Xr libarchive 3 ,
|
||||||
.Xr libarchive-formats 5 ,
|
.Xr libarchive-formats 5 ,
|
||||||
.Xr tar 5
|
.Xr tar 5
|
||||||
@ -870,7 +911,7 @@ in
|
|||||||
.St -p1003.1-96
|
.St -p1003.1-96
|
||||||
but was dropped from
|
but was dropped from
|
||||||
.St -p1003.1-2001 .
|
.St -p1003.1-2001 .
|
||||||
The options used by this implementation were developed by surveying a
|
The options supported by this implementation were developed by surveying a
|
||||||
number of existing tar implementations as well as the old POSIX specification
|
number of existing tar implementations as well as the old POSIX specification
|
||||||
for tar and the current POSIX specification for pax.
|
for tar and the current POSIX specification for pax.
|
||||||
.Pp
|
.Pp
|
||||||
@ -896,6 +937,9 @@ beginning with
|
|||||||
This is a complete re-implementation based on the
|
This is a complete re-implementation based on the
|
||||||
.Xr libarchive 3
|
.Xr libarchive 3
|
||||||
library.
|
library.
|
||||||
|
It was first released with
|
||||||
|
.Fx 5.4
|
||||||
|
in May, 2005.
|
||||||
.Sh BUGS
|
.Sh BUGS
|
||||||
This program follows
|
This program follows
|
||||||
.St -p1003.1-96
|
.St -p1003.1-96
|
||||||
@ -905,7 +949,7 @@ option.
|
|||||||
Note that GNU tar prior to version 1.15 treated
|
Note that GNU tar prior to version 1.15 treated
|
||||||
.Fl l
|
.Fl l
|
||||||
as a synonym for the
|
as a synonym for the
|
||||||
.Fl -one-file-system
|
.Fl Fl one-file-system
|
||||||
option.
|
option.
|
||||||
.Pp
|
.Pp
|
||||||
The
|
The
|
||||||
@ -983,6 +1027,3 @@ Converting between dissimilar archive formats (such as tar and cpio) using the
|
|||||||
convention can cause hard link information to be lost.
|
convention can cause hard link information to be lost.
|
||||||
(This is a consequence of the incompatible ways that different archive
|
(This is a consequence of the incompatible ways that different archive
|
||||||
formats store hardlink information.)
|
formats store hardlink information.)
|
||||||
.Pp
|
|
||||||
There are alternative long options for many of the short options that
|
|
||||||
are deliberately not documented.
|
|
||||||
|
@ -103,6 +103,7 @@ progress_func(void *cookie)
|
|||||||
struct archive *a = progress_data->archive;
|
struct archive *a = progress_data->archive;
|
||||||
struct archive_entry *entry = progress_data->entry;
|
struct archive_entry *entry = progress_data->entry;
|
||||||
uint64_t comp, uncomp;
|
uint64_t comp, uncomp;
|
||||||
|
int compression;
|
||||||
|
|
||||||
if (!need_report())
|
if (!need_report())
|
||||||
return;
|
return;
|
||||||
@ -112,9 +113,13 @@ progress_func(void *cookie)
|
|||||||
if (a != NULL) {
|
if (a != NULL) {
|
||||||
comp = archive_position_compressed(a);
|
comp = archive_position_compressed(a);
|
||||||
uncomp = archive_position_uncompressed(a);
|
uncomp = archive_position_uncompressed(a);
|
||||||
|
if (comp > uncomp)
|
||||||
|
compression = 0;
|
||||||
|
else
|
||||||
|
compression = (int)((uncomp - comp) * 100 / uncomp);
|
||||||
fprintf(stderr,
|
fprintf(stderr,
|
||||||
"In: %s bytes, compression %d%%;",
|
"In: %s bytes, compression %d%%;",
|
||||||
tar_i64toa(comp), (int)((uncomp - comp) * 100 / uncomp));
|
tar_i64toa(comp), compression);
|
||||||
fprintf(stderr, " Out: %d files, %s bytes\n",
|
fprintf(stderr, " Out: %d files, %s bytes\n",
|
||||||
archive_file_count(a), tar_i64toa(uncomp));
|
archive_file_count(a), tar_i64toa(uncomp));
|
||||||
}
|
}
|
||||||
@ -214,7 +219,7 @@ read_archive(struct bsdtar *bsdtar, char mode)
|
|||||||
}
|
}
|
||||||
if (bsdtar->uname)
|
if (bsdtar->uname)
|
||||||
archive_entry_set_uname(entry, bsdtar->uname);
|
archive_entry_set_uname(entry, bsdtar->uname);
|
||||||
if (bsdtar->gname >= 0)
|
if (bsdtar->gname)
|
||||||
archive_entry_set_gname(entry, bsdtar->gname);
|
archive_entry_set_gname(entry, bsdtar->gname);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -44,7 +44,7 @@ DEFINE_TEST(test_option_s)
|
|||||||
{
|
{
|
||||||
struct stat st;
|
struct stat st;
|
||||||
|
|
||||||
/* Create a sample file heirarchy. */
|
/* Create a sample file hierarchy. */
|
||||||
assertMakeDir("in", 0755);
|
assertMakeDir("in", 0755);
|
||||||
assertMakeDir("in/d1", 0755);
|
assertMakeDir("in/d1", 0755);
|
||||||
assertEqualInt(0, mkfile("in/d1/foo", "foo"));
|
assertEqualInt(0, mkfile("in/d1/foo", "foo"));
|
||||||
|
@ -401,7 +401,7 @@ tree_next(struct tree *t)
|
|||||||
* violation. Just crash now. */
|
* violation. Just crash now. */
|
||||||
if (t->visit_type == TREE_ERROR_FATAL) {
|
if (t->visit_type == TREE_ERROR_FATAL) {
|
||||||
fprintf(stderr, "Unable to continue traversing"
|
fprintf(stderr, "Unable to continue traversing"
|
||||||
" directory heirarchy after a fatal error.");
|
" directory hierarchy after a fatal error.");
|
||||||
abort();
|
abort();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -226,7 +226,11 @@ yes(const char *fmt, ...)
|
|||||||
fflush(stderr);
|
fflush(stderr);
|
||||||
|
|
||||||
l = read(2, buff, sizeof(buff) - 1);
|
l = read(2, buff, sizeof(buff) - 1);
|
||||||
if (l <= 0)
|
if (l < 0) {
|
||||||
|
fprintf(stderr, "Keyboard read failed\n");
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
if (l == 0)
|
||||||
return (0);
|
return (0);
|
||||||
buff[l] = 0;
|
buff[l] = 0;
|
||||||
|
|
||||||
|
@ -751,6 +751,9 @@ write_hierarchy(struct bsdtar *bsdtar, struct archive *a, const char *path)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (bsdtar->option_no_subdirs)
|
||||||
|
descend = 0;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Are we about to cross to a new filesystem?
|
* Are we about to cross to a new filesystem?
|
||||||
*/
|
*/
|
||||||
@ -763,7 +766,6 @@ write_hierarchy(struct bsdtar *bsdtar, struct archive *a, const char *path)
|
|||||||
} else if (descend == 0) {
|
} else if (descend == 0) {
|
||||||
/* We're not descending, so no need to check. */
|
/* We're not descending, so no need to check. */
|
||||||
} else if (bsdtar->option_dont_traverse_mounts) {
|
} else if (bsdtar->option_dont_traverse_mounts) {
|
||||||
/* User has asked us not to cross mount points. */
|
|
||||||
descend = 0;
|
descend = 0;
|
||||||
} else {
|
} else {
|
||||||
/* We're prepared to cross a mount point. */
|
/* We're prepared to cross a mount point. */
|
||||||
@ -790,8 +792,15 @@ write_hierarchy(struct bsdtar *bsdtar, struct archive *a, const char *path)
|
|||||||
* In -u mode, check that the file is newer than what's
|
* In -u mode, check that the file is newer than what's
|
||||||
* already in the archive; in all modes, obey --newerXXX flags.
|
* already in the archive; in all modes, obey --newerXXX flags.
|
||||||
*/
|
*/
|
||||||
if (!new_enough(bsdtar, name, st))
|
if (!new_enough(bsdtar, name, st)) {
|
||||||
|
if (!descend)
|
||||||
|
continue;
|
||||||
|
if (bsdtar->option_interactive &&
|
||||||
|
!yes("add '%s'", name))
|
||||||
|
continue;
|
||||||
|
tree_descend(tree);
|
||||||
continue;
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
archive_entry_free(entry);
|
archive_entry_free(entry);
|
||||||
entry = archive_entry_new();
|
entry = archive_entry_new();
|
||||||
@ -885,8 +894,7 @@ write_hierarchy(struct bsdtar *bsdtar, struct archive *a, const char *path)
|
|||||||
!yes("add '%s'", name))
|
!yes("add '%s'", name))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
/* Note: if user vetoes, we won't descend. */
|
if (descend)
|
||||||
if (descend && !bsdtar->option_no_subdirs)
|
|
||||||
tree_descend(tree);
|
tree_descend(tree);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -936,6 +944,7 @@ write_entry_backend(struct bsdtar *bsdtar, struct archive *a,
|
|||||||
const char *pathname = archive_entry_sourcepath(entry);
|
const char *pathname = archive_entry_sourcepath(entry);
|
||||||
fd = open(pathname, O_RDONLY | O_BINARY);
|
fd = open(pathname, O_RDONLY | O_BINARY);
|
||||||
if (fd == -1) {
|
if (fd == -1) {
|
||||||
|
bsdtar->return_value = 1;
|
||||||
if (!bsdtar->verbose)
|
if (!bsdtar->verbose)
|
||||||
lafe_warnc(errno,
|
lafe_warnc(errno,
|
||||||
"%s: could not open file", pathname);
|
"%s: could not open file", pathname);
|
||||||
@ -982,15 +991,21 @@ report_write(struct bsdtar *bsdtar, struct archive *a,
|
|||||||
struct archive_entry *entry, int64_t progress)
|
struct archive_entry *entry, int64_t progress)
|
||||||
{
|
{
|
||||||
uint64_t comp, uncomp;
|
uint64_t comp, uncomp;
|
||||||
|
int compression;
|
||||||
|
|
||||||
if (bsdtar->verbose)
|
if (bsdtar->verbose)
|
||||||
fprintf(stderr, "\n");
|
fprintf(stderr, "\n");
|
||||||
comp = archive_position_compressed(a);
|
comp = archive_position_compressed(a);
|
||||||
uncomp = archive_position_uncompressed(a);
|
uncomp = archive_position_uncompressed(a);
|
||||||
fprintf(stderr, "In: %d files, %s bytes;",
|
fprintf(stderr, "In: %d files, %s bytes;",
|
||||||
archive_file_count(a), tar_i64toa(uncomp));
|
archive_file_count(a), tar_i64toa(uncomp));
|
||||||
|
if (comp > uncomp)
|
||||||
|
compression = 0;
|
||||||
|
else
|
||||||
|
compression = (int)((uncomp - comp) * 100 / uncomp);
|
||||||
fprintf(stderr,
|
fprintf(stderr,
|
||||||
" Out: %s bytes, compression %d%%\n",
|
" Out: %s bytes, compression %d%%\n",
|
||||||
tar_i64toa(comp), (int)((uncomp - comp) * 100 / uncomp));
|
tar_i64toa(comp), compression);
|
||||||
/* Can't have two calls to tar_i64toa() pending, so split the output. */
|
/* Can't have two calls to tar_i64toa() pending, so split the output. */
|
||||||
safe_fprintf(stderr, "Current: %s (%s",
|
safe_fprintf(stderr, "Current: %s (%s",
|
||||||
archive_entry_pathname(entry),
|
archive_entry_pathname(entry),
|
||||||
@ -1031,6 +1046,12 @@ write_file_data(struct bsdtar *bsdtar, struct archive *a,
|
|||||||
progress += bytes_written;
|
progress += bytes_written;
|
||||||
bytes_read = read(fd, bsdtar->buff, FILEDATABUFLEN);
|
bytes_read = read(fd, bsdtar->buff, FILEDATABUFLEN);
|
||||||
}
|
}
|
||||||
|
if (bytes_read < 0) {
|
||||||
|
lafe_warnc(errno,
|
||||||
|
"%s: Read error",
|
||||||
|
archive_entry_pathname(entry));
|
||||||
|
bsdtar->return_value = 1;
|
||||||
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user