[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Bug-tar] [PATCH] add --ignore-missing to ignore missing input files
From: |
Stefan Tomanek |
Subject: |
[Bug-tar] [PATCH] add --ignore-missing to ignore missing input files |
Date: |
Thu, 19 Apr 2012 17:05:01 +0200 |
User-agent: |
Mutt/1.5.21 (2010-09-15) |
When feeding filenames from 'find' to tar, it is possible for files to
disappear before being processed. This forces tar to signal an error
unless --ignore-failed-read has been specified. Using this switch
however covers a wide variety of error conditions. To simplify the
archival of big filesystems with find and tar, this change adds the
command line switch "--ignore-missing" to ignore files that disappeared
in the time between find identifying them and tar processing them.
Signed-off-by: Stefan Tomanek <address@hidden>
---
src/common.h | 2 ++
src/misc.c | 2 +-
src/tar.c | 7 +++++++
3 files changed, 10 insertions(+), 1 deletions(-)
diff --git a/src/common.h b/src/common.h
index c51ab11..996a05a 100644
--- a/src/common.h
+++ b/src/common.h
@@ -164,6 +164,8 @@ GLOBAL gid_t group_option;
GLOBAL bool ignore_failed_read_option;
+GLOBAL bool ignore_missing_option;
+
GLOBAL bool ignore_zeros_option;
GLOBAL bool incremental_option;
diff --git a/src/misc.c b/src/misc.c
index 734dc4e..4e99afc 100644
--- a/src/misc.c
+++ b/src/misc.c
@@ -885,7 +885,7 @@ seek_diag_details (char const *name, off_t offset)
void
stat_diag (char const *name)
{
- if (ignore_failed_read_option)
+ if (ignore_failed_read_option || (errno == ENOENT && ignore_missing_option))
stat_warn (name);
else
stat_error (name);
diff --git a/src/tar.c b/src/tar.c
index 8c4f656..1895506 100644
--- a/src/tar.c
+++ b/src/tar.c
@@ -279,6 +279,7 @@ enum
IGNORE_CASE_OPTION,
IGNORE_COMMAND_ERROR_OPTION,
IGNORE_FAILED_READ_OPTION,
+ IGNORE_MISSING_OPTION,
INDEX_FILE_OPTION,
KEEP_NEWER_FILES_OPTION,
LEVEL_OPTION,
@@ -426,6 +427,8 @@ static struct argp_option options[] = {
N_("dump level for created listed-incremental archive"), GRID+1 },
{"ignore-failed-read", IGNORE_FAILED_READ_OPTION, 0, 0,
N_("do not exit with nonzero on unreadable files"), GRID+1 },
+ {"ignore-missing", IGNORE_MISSING_OPTION, 0, 0,
+ N_("do not exit with nonzero on missing input files"), GRID+1 },
{"occurrence", OCCURRENCE_OPTION, N_("NUMBER"), OPTION_ARG_OPTIONAL,
N_("process only the NUMBERth occurrence of each file in the archive;"
" this option is valid only in conjunction with one of the subcommands"
@@ -1896,6 +1899,10 @@ parse_opt (int key, char *arg, struct argp_state *state)
ignore_failed_read_option = true;
break;
+ case IGNORE_MISSING_OPTION:
+ ignore_missing_option = true;
+ break;
+
case KEEP_NEWER_FILES_OPTION:
old_files_option = KEEP_NEWER_FILES;
break;
--
1.7.9.1
- [Bug-tar] [PATCH] add --ignore-missing to ignore missing input files,
Stefan Tomanek <=
- Re: [Bug-tar] [PATCH] add --ignore-missing to ignore missing input files, Paul Eggert, 2012/04/19
- Re: [Bug-tar] [PATCH] add --ignore-missing to ignore missing input files, Stefan Tomanek, 2012/04/20
- Re: [Bug-tar] [PATCH] add --ignore-missing to ignore missing input files, Paul Eggert, 2012/04/20
- Re: [Bug-tar] [PATCH] add --ignore-missing to ignore missing input files, Stefan Tomanek, 2012/04/20
- Re: [Bug-tar] [PATCH] add --ignore-missing to ignore missing input files, Paul Eggert, 2012/04/20
- Re: [Bug-tar] [PATCH] add --ignore-missing to ignore missing input files, Stefan Tomanek, 2012/04/20
- Re: [Bug-tar] [PATCH] add --ignore-missing to ignore missing input files, Paul Eggert, 2012/04/20
- Re: [Bug-tar] [PATCH] add --ignore-missing to ignore missing input files, Stefan Tomanek, 2012/04/21
- Re: [Bug-tar] [PATCH] add --ignore-missing to ignore missing input files, Joerg Schilling, 2012/04/21
- Re: [Bug-tar] [PATCH] add --ignore-missing to ignore missing input files, Paul Eggert, 2012/04/21