tar: revamp "file is the archive" diagnostic

* src/create.c (dump_file0): For clarity, change diagnostic
wording from "file is the archive; not dumped" to "archive cannot
contain itself; not dumped".  All test cases and documentation changed.
This commit is contained in:
Paul Eggert
2022-02-15 17:40:34 -08:00
parent 5c713540e3
commit eeda008a59
4 changed files with 6 additions and 9 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 "July 13, 2020" "TAR" "GNU TAR Manual" .TH TAR 1 "February 15, 2022" "TAR" "GNU TAR Manual"
.SH NAME .SH NAME
tar \- an archiving utility tar \- an archiving utility
.SH SYNOPSIS .SH SYNOPSIS
@@ -1168,7 +1168,7 @@ Keywords applicable for \fBtar --create\fR:
"%s: file is unchanged; not dumped" "%s: file is unchanged; not dumped"
.TP .TP
.B ignore-archive .B ignore-archive
"%s: file is the archive; not dumped" "%s: archive cannot contain itself; not dumped"
.TP .TP
.B file-removed .B file-removed
"%s: File removed before we read it" "%s: File removed before we read it"

View File

@@ -4634,11 +4634,9 @@ Disable all warning messages.
@item file-unchanged @item file-unchanged
@samp{%s: file is unchanged; not dumped} @samp{%s: file is unchanged; not dumped}
@kwindex ignore-archive @kwindex ignore-archive
@cindex @samp{file is the archive; not dumped}, warning message @cindex @samp{archive cannot contain itself; not dumped}, warning message
@kwindex ignore-archive
@cindex @samp{file is the archive; not dumped}, warning message
@item ignore-archive @item ignore-archive
@samp{%s: file is the archive; not dumped} @samp{%s: archive cannot contain itself; not dumped}
@kwindex file-removed @kwindex file-removed
@cindex @samp{File removed before we read it}, warning message @cindex @samp{File removed before we read it}, warning message
@item file-removed @item file-removed

View File

@@ -1723,7 +1723,7 @@ dump_file0 (struct tar_stat_info *st, char const *name, char const *p)
if (sys_file_is_archive (st)) if (sys_file_is_archive (st))
{ {
WARNOPT (WARN_IGNORE_ARCHIVE, WARNOPT (WARN_IGNORE_ARCHIVE,
(0, 0, _("%s: file is the archive; not dumped"), (0, 0, _("%s: archive cannot contain itself; not dumped"),
quotearg_colon (p))); quotearg_colon (p)));
return; return;
} }

View File

@@ -39,11 +39,10 @@ tar -cf a.tar . -C dir
./A.b ./A.b
./B.a ./B.a
], ],
[tar: ./a.tar: file is the archive; not dumped [tar: ./a.tar: archive cannot contain itself; not dumped
tar: The following options were used after any non-optional arguments in archive create or update mode. These options are positional and affect only arguments that follow them. Please, rearrange them properly. tar: The following options were used after any non-optional arguments in archive create or update mode. These options are positional and affect only arguments that follow them. Please, rearrange them properly.
tar: -C 'dir' has no effect tar: -C 'dir' has no effect
tar: Exiting with failure status due to previous errors tar: Exiting with failure status due to previous errors
]) ])
AT_CLEANUP AT_CLEANUP