Various formatting fixes

This commit is contained in:
Sergey Poznyakoff
2024-06-07 00:05:00 +03:00
parent 1e6ce98e3a
commit 5f2cda027d
3 changed files with 46 additions and 38 deletions

View File

@@ -13,7 +13,7 @@
.\" .\"
.\" You should have received a copy of the GNU General Public License .\" You should have received a copy of the GNU General Public License
.\" along with this program. If not, see <http://www.gnu.org/licenses/>. .\" along with this program. If not, see <http://www.gnu.org/licenses/>.
.TH TAR 1 "January 15, 2024" "TAR" "GNU TAR Manual" .TH TAR 1 "June 7, 2024" "TAR" "GNU TAR Manual"
.SH NAME .SH NAME
tar \- an archiving utility tar \- an archiving utility
.SH SYNOPSIS .SH SYNOPSIS
@@ -21,7 +21,6 @@ tar \- an archiving utility
\fBtar\fR {\fBA\fR|\fBc\fR|\fBd\fR|\fBr\fR|\fBt\fR|\fBu\fR|\fBx\fR}\ \fBtar\fR {\fBA\fR|\fBc\fR|\fBd\fR|\fBr\fR|\fBt\fR|\fBu\fR|\fBx\fR}\
[\fBGnSkUWOmpsMBiajJzZhPlRvwo\fR] [\fIARG\fR...] [\fBGnSkUWOmpsMBiajJzZhPlRvwo\fR] [\fIARG\fR...]
.SS UNIX-style usage .SS UNIX-style usage
.sp
\fBtar\fR \fB\-A\fR [\fIOPTIONS\fR] \fB\-f\fR \fIARCHIVE\fR \fIARCHIVE\fR... \fBtar\fR \fB\-A\fR [\fIOPTIONS\fR] \fB\-f\fR \fIARCHIVE\fR \fIARCHIVE\fR...
.sp .sp
\fBtar\fR \fB\-c\fR [\fB\-f\fR \fIARCHIVE\fR] [\fIOPTIONS\fR] [\fIFILE\fR...] \fBtar\fR \fB\-c\fR [\fB\-f\fR \fIARCHIVE\fR] [\fIOPTIONS\fR] [\fIFILE\fR...]
@@ -36,7 +35,6 @@ tar \- an archiving utility
.sp .sp
\fBtar\fR \fB\-x\fR [\fB\-f\fR \fIARCHIVE\fR] [\fIOPTIONS\fR] [\fIMEMBER\fR...] \fBtar\fR \fB\-x\fR [\fB\-f\fR \fIARCHIVE\fR] [\fIOPTIONS\fR] [\fIMEMBER\fR...]
.SS GNU-style usage .SS GNU-style usage
.sp
\fBtar\fR {\fB\-\-catenate\fR|\fB\-\-concatenate\fR} [\fIOPTIONS\fR] \fB\-\-file\fR \fIARCHIVE\fR \fIARCHIVE\fR... \fBtar\fR {\fB\-\-catenate\fR|\fB\-\-concatenate\fR} [\fIOPTIONS\fR] \fB\-\-file\fR \fIARCHIVE\fR \fIARCHIVE\fR...
.sp .sp
\fBtar\fR \fB\-\-create\fR [\fB\-\-file\fR \fIARCHIVE\fR] [\fIOPTIONS\fR] [\fIFILE\fR...] \fBtar\fR \fB\-\-create\fR [\fB\-\-file\fR \fIARCHIVE\fR] [\fIOPTIONS\fR] [\fIFILE\fR...]
@@ -83,11 +81,9 @@ GNU
.B tar .B tar
is an archiving program designed to store multiple files in a single is an archiving program designed to store multiple files in a single
file (an \fBarchive\fR), and to manipulate such archives. The archive file (an \fBarchive\fR), and to manipulate such archives. The archive
can be either a regular file or a device (e.g. a tape drive, hence the name can be either a regular file or a device (e.g., a tape drive, hence the name
of the program, which stands for \fBt\fRape \fBar\fRchiver), which can of the program, which stands for \fBt\fRape \fBar\fRchiver), which can
be located either on the local or on a remote machine. be located either on the local or on a remote machine.
.PP
.SS Option styles .SS Option styles
Options to GNU \fBtar\fR can be given in three different styles. Options to GNU \fBtar\fR can be given in three different styles.
In In
@@ -122,20 +118,20 @@ argument must follow the option letter without any intervening
whitespace, as in \fB\-g/tmp/snar.db\fR. whitespace, as in \fB\-g/tmp/snar.db\fR.
.PP .PP
Any number of options not taking arguments can be Any number of options not taking arguments can be
clustered together after a single dash, e.g. \fB\-vkp\fR. An option clustered together after a single dash, e.g.\& \fB\-vkp\fR. An option
that takes an argument (whether mandatory or optional) can appear at that takes an argument (whether mandatory or optional) can appear at
the end of such a cluster, e.g. \fB\-vkpf a.tar\fR. the end of such a cluster, e.g.\& \fB\-vkpf a.tar\fR.
.PP .PP
The example command above written in the The example command above written in the
.B short-option style .B short-option style
could look like: could look like:
.PP .PP
.EX .EX
tar -cvf etc.tar /etc tar \-cvf etc.tar /etc
.EE .EE
or or
.EX .EX
tar -c -v -f etc.tar /etc tar \-c \-v \-f etc.tar /etc
.EE .EE
.PP .PP
In In
@@ -152,11 +148,11 @@ method.
Here are several ways of writing the example command in this style: Here are several ways of writing the example command in this style:
.PP .PP
.EX .EX
tar --create --file etc.tar --verbose /etc tar \-\-create \-\-file etc.tar \-\-verbose /etc
.EE .EE
or (abbreviating some options): or (abbreviating some options):
.EX .EX
tar --cre --file=etc.tar --verb /etc tar \-\-cre \-\-file=etc.tar \-\-verb /etc
.EE .EE
.PP .PP
The options in all three styles can be intermixed, although doing so The options in all three styles can be intermixed, although doing so
@@ -228,7 +224,6 @@ same name, corresponding to various versions of the same file.
Extract files from an archive. Arguments are optional. When given, Extract files from an archive. Arguments are optional. When given,
they specify names of the archive members to be extracted. they specify names of the archive members to be extracted.
.TP .TP
.TP
\fB\-\-show\-defaults\fR \fB\-\-show\-defaults\fR
Show built-in defaults for various \fBtar\fR options and exit. Show built-in defaults for various \fBtar\fR options and exit.
.TP .TP
@@ -281,7 +276,7 @@ the snapshot file before dumping, thereby forcing a level 0 dump.
Assume the archive is seekable. Normally \fBtar\fR determines Assume the archive is seekable. Normally \fBtar\fR determines
automatically whether the archive can be seeked or not. This option automatically whether the archive can be seeked or not. This option
is intended for use in cases when such recognition fails. It takes is intended for use in cases when such recognition fails. It takes
effect only if the archive is open for reading (e.g. with effect only if the archive is open for reading (e.g., with
.B \-\-list .B \-\-list
or or
.B \-\-extract .B \-\-extract
@@ -447,7 +442,7 @@ GNU \fBtar\fR version number.
The name of the archive \fBtar\fR is processing. The name of the archive \fBtar\fR is processing.
.TP .TP
.B TAR_BLOCKING_FACTOR .B TAR_BLOCKING_FACTOR
Current blocking factor, i.e. number of 512-byte blocks in a record. Current blocking factor, i.e., number of 512-byte blocks in a record.
.TP .TP
.B TAR_VOLUME .B TAR_VOLUME
Ordinal number of the volume \fBtar\fR is processing (set if Ordinal number of the volume \fBtar\fR is processing (set if
@@ -597,7 +592,7 @@ Disable POSIX ACLs support.
.B \-\-selinux .B \-\-selinux
Enable SELinux context support. Enable SELinux context support.
.TP .TP
.B \-\-no-selinux .B \-\-no\-selinux
Disable SELinux context support. Disable SELinux context support.
.TP .TP
.B \-\-xattrs .B \-\-xattrs
@@ -608,7 +603,7 @@ Disable extended attributes support.
.TP .TP
.BI \-\-xattrs\-exclude= PATTERN .BI \-\-xattrs\-exclude= PATTERN
Specify the exclude pattern for xattr keys. \fIPATTERN\fR is a globbing Specify the exclude pattern for xattr keys. \fIPATTERN\fR is a globbing
pattern, e.g. \fB\-\-xattrs\-exclude='user.*'\fR to include only pattern, e.g.\& \fB\-\-xattrs\-exclude='user.*'\fR to include only
attributes from the user namespace. attributes from the user namespace.
.TP .TP
.BI \-\-xattrs\-include= PATTERN .BI \-\-xattrs\-include= PATTERN
@@ -631,7 +626,7 @@ name or IP address, and the part after it as the file or device
pathname, e.g.: pathname, e.g.:
.EX .EX
--file=remotehost:/dev/sr0 \-\-file=remotehost:/dev/sr0
.EE .EE
An optional username can be prefixed to the hostname, placing a \fB@\fR An optional username can be prefixed to the hostname, placing a \fB@\fR
@@ -644,7 +639,7 @@ command. Nowadays it is common to use
instead. You can do so by giving the following command line option: instead. You can do so by giving the following command line option:
.EX .EX
--rsh-command=/usr/bin/ssh \-\-rsh-command=/usr/bin/ssh
.EE .EE
The remote machine should have the The remote machine should have the
@@ -670,7 +665,7 @@ GNU \fBtar\fR version number.
The name of the archive \fBtar\fR is processing. The name of the archive \fBtar\fR is processing.
.TP .TP
.B TAR_BLOCKING_FACTOR .B TAR_BLOCKING_FACTOR
Current blocking factor, i.e. number of 512-byte blocks in a record. Current blocking factor, i.e., number of 512-byte blocks in a record.
.TP .TP
.B TAR_VOLUME .B TAR_VOLUME
Ordinal number of the volume \fBtar\fR is processing (set if Ordinal number of the volume \fBtar\fR is processing (set if
@@ -748,7 +743,7 @@ reading archives created with the \fB\-A\fR option.
\fB\-\-record\-size\fR=\fINUMBER\fR \fB\-\-record\-size\fR=\fINUMBER\fR
Set record size. \fINUMBER\fR is the number of bytes per record. It Set record size. \fINUMBER\fR is the number of bytes per record. It
must be multiple of \fB512\fR. It can can be suffixed with a \fBsize must be multiple of \fB512\fR. It can can be suffixed with a \fBsize
suffix\fR, e.g. \fB\-\-record-size=10K\fR, for 10 Kilobytes. See the suffix\fR, e.g.\& \fB\-\-record-size=10K\fR, for 10 Kilobytes. See the
subsection subsection
.BR "Size suffixes" , .BR "Size suffixes" ,
for a list of valid suffixes. for a list of valid suffixes.
@@ -854,17 +849,15 @@ Make numbered backups if numbered backups exist, simple backups otherwise.
.TP .TP
.BR never ", " simple .BR never ", " simple
Always make simple backups Always make simple backups
.RS
.RE .RE
.IP
If \fICONTROL\fR is not given, the value is taken from the If \fICONTROL\fR is not given, the value is taken from the
.B VERSION_CONTROL .B VERSION_CONTROL
environment variable. If it is not set, \fBexisting\fR is assumed. environment variable. If it is not set, \fBexisting\fR is assumed.
.RE
.TP .TP
\fB\-C\fR, \fB\-\-directory\fR=\fIDIR\fR \fB\-C\fR, \fB\-\-directory\fR=\fIDIR\fR
Change to \fIDIR\fR before performing any operations. This option is Change to \fIDIR\fR before performing any operations. This option is
order-sensitive, i.e. it affects all options that follow. order-sensitive, i.e., it affects all options that follow.
.TP .TP
\fB\-\-exclude\fR=\fIPATTERN\fR \fB\-\-exclude\fR=\fIPATTERN\fR
Exclude files matching \fIPATTERN\fR, a Exclude files matching \fIPATTERN\fR, a
@@ -879,6 +872,7 @@ Exclude contents of directories containing file \fBCACHEDIR.TAG\fR,
except for the tag file itself. The \fBCACHEDIR.TAG\fR file must be except for the tag file itself. The \fBCACHEDIR.TAG\fR file must be
a regular file whose content begins with the following 43 characters: a regular file whose content begins with the following 43 characters:
.IP .IP
.RS .RS
.EX .EX
Signature: 8a477f597d28d172789f06886806bc55 Signature: 8a477f597d28d172789f06886806bc55
@@ -988,7 +982,7 @@ unless overridden by environment variable \fBSIMPLE_BACKUP_SUFFIX\fR.
Get names to extract or create from \fIFILE\fR. Get names to extract or create from \fIFILE\fR.
Unless specified otherwise, the \fIFILE\fR must contain a list of Unless specified otherwise, the \fIFILE\fR must contain a list of
names separated by ASCII \fBLF\fR (i.e. one name per line). The names separated by ASCII \fBLF\fR (i.e., one name per line). The
names read are handled the same way as command line arguments. They names read are handled the same way as command line arguments. They
undergo quote removal and word splitting, and any string that starts undergo quote removal and word splitting, and any string that starts
with a \fB\-\fR is handled as \fBtar\fR command line option. with a \fB\-\fR is handled as \fBtar\fR command line option.
@@ -1011,7 +1005,7 @@ Treat each line obtained from a file list as a file name, even if it
starts with a dash. File lists are supplied with the starts with a dash. File lists are supplied with the
\fB\-\-files\-from\fR (\fB\-T\fR) option. The default behavior is to \fB\-\-files\-from\fR (\fB\-T\fR) option. The default behavior is to
handle names supplied in file lists as if they were typed in the handle names supplied in file lists as if they were typed in the
command line, i.e. any names starting with a dash are treated as command line, i.e., any names starting with a dash are treated as
\fBtar\fR options. The \fB\-\-verbatim\-files\-from\fR option \fBtar\fR options. The \fB\-\-verbatim\-files\-from\fR option
disables this behavior. disables this behavior.
@@ -1151,7 +1145,7 @@ Disable all warning messages.
.B alone-zero-block .B alone-zero-block
"A lone zero block at %s" "A lone zero block at %s"
.HP .HP
Keywords applicable for \fBtar --create\fR: Keywords applicable for \fBtar \-\-create\fR:
.TP .TP
.B cachedir .B cachedir
"%s: contains a cache directory tag %s; %s" "%s: contains a cache directory tag %s; %s"
@@ -1187,7 +1181,7 @@ keyword applies only if used together with the
.B \-\-ignore\-failed\-read .B \-\-ignore\-failed\-read
option. option.
.HP .HP
Keywords applicable for \fBtar --extract\fR: Keywords applicable for \fBtar \-\-extract\fR:
.TP .TP
.B existing\-file .B existing\-file
"%s: skipping existing file" "%s: skipping existing file"
@@ -1219,7 +1213,7 @@ default (unless \fB\-\-verbose\fR is used). A common example of what
you can get when using this warning is: you can get when using this warning is:
.EX .EX
$ tar --warning=decompress-program -x -f archive.Z $ tar \-\-warning=decompress-program \-x \-f archive.Z
tar (child): cannot run compress: No such file or directory tar (child): cannot run compress: No such file or directory
tar (child): trying gzip tar (child): trying gzip
.EE .EE
@@ -1256,7 +1250,6 @@ Ask for confirmation for every action.
When creating, same as \fB\-\-old\-archive\fR. When extracting, same When creating, same as \fB\-\-old\-archive\fR. When extracting, same
as \fB\-\-no\-same\-owner\fR. as \fB\-\-no\-same\-owner\fR.
.SS Size suffixes .SS Size suffixes
.sp
.nf .nf
.ta 8n 18n 42n .ta 8n 18n 42n
.ul .ul
@@ -1272,7 +1265,6 @@ as \fB\-\-no\-same\-owner\fR.
T Terabytes \fISIZE\fR x 1024^4 T Terabytes \fISIZE\fR x 1024^4
w Words \fISIZE\fR x 2 w Words \fISIZE\fR x 2
.fi .fi
.PP
.SH "RETURN VALUE" .SH "RETURN VALUE"
Tar's exit code indicates whether it was able to successfully perform Tar's exit code indicates whether it was able to successfully perform
the requested operation, and if not, what kind of error occurred. the requested operation, and if not, what kind of error occurred.
@@ -1284,10 +1276,11 @@ Successful termination.
.I Some files differ. .I Some files differ.
If \fBtar\fR was invoked with the \fB\-\-compare\fR (\fB\-\-diff\fR, \fB\-d\fR) If \fBtar\fR was invoked with the \fB\-\-compare\fR (\fB\-\-diff\fR, \fB\-d\fR)
command line option, this means that some files in the archive differ command line option, this means that some files in the archive differ
from their disk counterparts. If \fBtar\fR was given one of the \fB\-\-create\fR, from their disk counterparts. If \fBtar\fR was given one of the
\fB\-\-append\fR or \fB\-\-update\fR options, this exit code means \fB\-\-create\fR, \fB\-\-append\fR or \fB\-\-update\fR options, this
that some files were changed while being archived and so the resulting exit code means that some files were changed while being archived and
archive does not contain the exact copy of the file set. so the resulting archive does not contain the exact copy of the file
set.
.TP .TP
.B 2 .B 2
.I Fatal error. .I Fatal error.
@@ -1298,7 +1291,7 @@ If a subprocess that had been invoked by
exited with a nonzero exit code, exited with a nonzero exit code,
.B tar .B tar
itself exits with that code as well. This can happen, for example, if itself exits with that code as well. This can happen, for example, if
a compression option (e.g. \fB\-z\fR) was used and the external a compression option (e.g.\& \fB\-z\fR) was used and the external
compressor program failed. Another example is compressor program failed. Another example is
.B rmt .B rmt
failure during backup to a remote device. failure during backup to a remote device.

View File

@@ -191,6 +191,7 @@ enum old_files
SKIP_OLD_FILES, /* --skip-old-files */ SKIP_OLD_FILES, /* --skip-old-files */
KEEP_NEWER_FILES /* --keep-newer-files */ KEEP_NEWER_FILES /* --keep-newer-files */
}; };
#define MAX_OLD_FILES (KEEP_NEWER_FILES+1)
GLOBAL enum old_files old_files_option; GLOBAL enum old_files old_files_option;
GLOBAL bool keep_directory_symlink_option; GLOBAL bool keep_directory_symlink_option;

View File

@@ -1351,6 +1351,19 @@ static void
set_old_files_option (int code, struct option_locus *loc) set_old_files_option (int code, struct option_locus *loc)
{ {
struct option_locus *prev; struct option_locus *prev;
/* Option compatibility map. 0 means two options are incompatible. */
static bool compat_map[MAX_OLD_FILES][MAX_OLD_FILES] = {
[NO_OVERWRITE_DIR_OLD_FILES] = {
[KEEP_OLD_FILES] = 1,
[SKIP_OLD_FILES] = 1
},
[KEEP_OLD_FILES] = {
[NO_OVERWRITE_DIR_OLD_FILES] = 1
},
[SKIP_OLD_FILES] = {
[NO_OVERWRITE_DIR_OLD_FILES] = 1
}
};
static char const *const code_to_opt[] = { static char const *const code_to_opt[] = {
"--overwrite-dir", "--overwrite-dir",
"--no-overwrite-dir", "--no-overwrite-dir",
@@ -1362,7 +1375,8 @@ set_old_files_option (int code, struct option_locus *loc)
}; };
prev = optloc_save (OC_OLD_FILES, loc); prev = optloc_save (OC_OLD_FILES, loc);
if (prev && optloc_eq (loc, prev) && code != old_files_option) if (prev && optloc_eq (loc, prev) && code != old_files_option &&
compat_map[code][old_files_option] == 0)
option_conflict_error (code_to_opt[code], code_to_opt[old_files_option]); option_conflict_error (code_to_opt[code], code_to_opt[old_files_option]);
old_files_option = code; old_files_option = code;