New option --warning=failed-read

* 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.
This commit is contained in:
Sergey Poznyakoff
2017-11-16 13:55:15 +02:00
parent 560f67c9f0
commit 32e51de2af
6 changed files with 66 additions and 11 deletions

View File

@@ -13,7 +13,7 @@
.\"
.\" 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
@@ -1163,6 +1163,12 @@ Keywords applicable for \fBtar --create\fR:
.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

View File

@@ -4610,6 +4610,10 @@ Disable all warning messages.
@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}
@@ -5726,7 +5730,7 @@ Disable SELinux context support.
@end table
@node Ignore Failed Read
@subsection Ignore Fail Read
@subsection Ignore Failed Read
@table @option
@item --ignore-failed-read
@@ -5734,6 +5738,13 @@ Disable SELinux context support.
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}