Optionally warn about missing zero blocks at the end of the archive

(In response to savannah bug #63574)

* doc/intern.texi: Document actual tar behaviour in regard to
missing end-of-file marker.
* doc/tar.texi: Rewrite the "warnings" section.  Document
--warning=missing-zero-blocks
* src/common.h (WARN_MISSING_ZERO_BLOCKS): New constant.
(WARN_ALL): Include all warning bits.
* src/list.c (read_and): If EOF is reached without seeing end-of-file
blocks and the "missing-zero-blocks" warning is requested, warn about
the fact.
* src/warning.c: New warnings: "missing-zero-blocks", "verbose".
(warning_option): Change definition to reflect changes in common.h
This commit is contained in:
Sergey Poznyakoff
2022-12-29 17:42:04 +02:00
parent 2cde05fa10
commit a65f01ac35
5 changed files with 247 additions and 101 deletions
+7
View File
@@ -256,6 +256,13 @@ read_and (void (*do_something) (void))
continue;
case HEADER_END_OF_FILE:
if (!ignore_zeros_option)
{
char buf[UINTMAX_STRSIZE_BOUND];
WARNOPT (WARN_MISSING_ZERO_BLOCKS,
(0, 0, _("Terminating zero blocks missing at %s"),
STRINGIFY_BIGINT (current_block_ordinal (), buf)));
}
if (block_number_option)
{
char buf[UINTMAX_STRSIZE_BOUND];