* NEWS: Document the --warning=failed-read option.
* doc/tar.texi: Likewise.
* doc/tar.1: Likewise.
* src/common.h (WARN_FAILED_READ): New constant.
(WARNING_ENABLED): New macro.
* src/misc.c (close_diag, open_diag)
(read_diag_details, readlink_diag)
(savedir_diag, seek_diag_details)
(stat_diag): Suppress warnings if WARN_FAILED_READ is set.
* src/warning.c (failed-read): New keyword.
In some cases tar would restore the directory permissions too early,
causing subsequent link extractions in that directory to fail.
+* The --warnings=failed-read option
+
+This new warning control option suppresses warning messages about
+unreadable files and directories. It has effect only if used together
+with the --ignore-failed-read option.
+
+* The --warnings=none option now suppresses all warnings
+
+This includes warnings about unreadable files produced when
+--ignore-failed-read is in effect. To output these, use
+--warnings=none --warnings=no-failed-read.
+
\f
version 1.29 - Sergey Poznyakoff, 2016-05-16
.\"
.\" You should have received a copy of the GNU General Public License
.\" along with this program. If not, see <http://www.gnu.org/licenses/>.
-.TH TAR 1 "March 23, 2016" "TAR" "GNU TAR Manual"
+.TH TAR 1 "November 16, 2017" "TAR" "GNU TAR Manual"
.SH NAME
tar \- an archiving utility
.SH SYNOPSIS
.TP
.B file-changed
"%s: file changed as we read it"
+.TP
+.B failed-read
+Suppresses warnings about unreadable files or directories. This
+keyword applies only if used together with the
+.B \-\-ignore\-failed\-read
+option.
.HP
Keywords applicable for \fBtar --extract\fR:
.TP
@cindex @samp{file changed as we read it}, warning message
@item file-changed
@samp{%s: file changed as we read it}
+@item failed-read
+Suppresses warnings about unreadable files or directories. This
+keyword applies only if used together with the @option{--ignore-failed-read}
+option. @xref{Ignore Failed Read}.
@end table
@subheading Keywords applicable for @command{tar --extract}
@end table
@node Ignore Failed Read
-@subsection Ignore Fail Read
+@subsection Ignore Failed Read
@table @option
@item --ignore-failed-read
Do not exit with nonzero on unreadable files or directories.
@end table
+This option has effect only during creation. It instructs tar to
+treat as mild conditions any missing or unreadable files (directories).
+Such failures don't affect the program exit code, and the
+corresponding diagnostic messages are marked as warnings, not errors.
+These warnings can be suppressed using the
+@option{--warning=failed-read} option (@pxref{warnings}).
+
@node extract options
@section Options Used by @option{--extract}
@cindex options for use with @option{--extract}
#define WARN_EXISTING_FILE 0x00100000
#define WARN_XATTR_WRITE 0x00200000
#define WARN_RECORD_SIZE 0x00400000
+#define WARN_FAILED_READ 0x00800000
/* These warnings are enabled by default in verbose mode: */
#define WARN_VERBOSE_WARNINGS (WARN_RENAME_DIRECTORY|WARN_NEW_DIRECTORY|\
extern int warning_option;
+#define WARNING_ENABLED(opt) (warning_option & (opt))
+
#define WARNOPT(opt,args) \
do \
{ \
- if (warning_option & opt) WARN (args); \
+ if (WARNING_ENABLED(opt)) WARN (args); \
} \
while (0)
close_diag (char const *name)
{
if (ignore_failed_read_option)
- close_warn (name);
+ {
+ if (WARNING_ENABLED(WARN_FAILED_READ))
+ close_warn (name);
+ }
else
close_error (name);
}
open_diag (char const *name)
{
if (ignore_failed_read_option)
- open_warn (name);
+ {
+ if (WARNING_ENABLED(WARN_FAILED_READ))
+ open_warn (name);
+ }
else
open_error (name);
}
read_diag_details (char const *name, off_t offset, size_t size)
{
if (ignore_failed_read_option)
- read_warn_details (name, offset, size);
+ {
+ if (WARNING_ENABLED(WARN_FAILED_READ))
+ read_warn_details (name, offset, size);
+ }
else
read_error_details (name, offset, size);
}
readlink_diag (char const *name)
{
if (ignore_failed_read_option)
- readlink_warn (name);
+ {
+ if (WARNING_ENABLED(WARN_FAILED_READ))
+ readlink_warn (name);
+ }
else
readlink_error (name);
}
savedir_diag (char const *name)
{
if (ignore_failed_read_option)
- savedir_warn (name);
+ {
+ if (WARNING_ENABLED(WARN_FAILED_READ))
+ savedir_warn (name);
+ }
else
savedir_error (name);
}
seek_diag_details (char const *name, off_t offset)
{
if (ignore_failed_read_option)
- seek_warn_details (name, offset);
+ {
+ if (WARNING_ENABLED(WARN_FAILED_READ))
+ seek_warn_details (name, offset);
+ }
else
seek_error_details (name, offset);
}
stat_diag (char const *name)
{
if (ignore_failed_read_option)
- stat_warn (name);
+ {
+ if (WARNING_ENABLED(WARN_FAILED_READ))
+ stat_warn (name);
+ }
else
stat_error (name);
}
"existing-file",
"xattr-write",
"record-size",
+ "failed-read",
NULL
};
WARN_DECOMPRESS_PROGRAM,
WARN_EXISTING_FILE,
WARN_XATTR_WRITE,
- WARN_RECORD_SIZE
+ WARN_RECORD_SIZE,
+ WARN_FAILED_READ
};
ARGMATCH_VERIFY (warning_args, warning_types);