[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Bug-tar] tar with -k option no longer warns when not overwriting fi
From: |
Sergey Poznyakoff |
Subject: |
Re: [Bug-tar] tar with -k option no longer warns when not overwriting files |
Date: |
Thu, 17 Nov 2011 22:24:54 +0200 |
Paul Eggert <address@hidden> ha escrit:
> Yes, thanks, I'd try ordinary -v for now. I don't think it'll mess up
> existing users much. (And if I'm wrong we can change it to
> the more-complicated way....)
OK, I pushed this:
>From 02bf3a96a931678211117534ee535863c780c6dc Mon Sep 17 00:00:00 2001
From: Sergey Poznyakoff <address@hidden>
Date: Thu, 17 Nov 2011 22:19:05 +0200
Subject: [PATCH] Warn about existing files in keep-old-files mode (complements
8f390db9).
This is controlled by "existing-file" warning code, which is off
by default.
* src/common.h (WARN_EXISTING_FILE): New warning code.
(WARN_VERBOSE_WARNINGS): Add WARN_EXISTING_FILE.
* src/extract.c (maybe_recoverable): warn about existing file
if WARN_EXISTING_FILE is set.
* src/warning.c: New warning type: "existing-file"
---
src/common.h | 3 ++-
src/extract.c | 2 ++
src/warning.c | 4 +++-
3 files changed, 7 insertions(+), 2 deletions(-)
diff --git a/src/common.h b/src/common.h
index c29ffc0..b60c4a0 100644
--- a/src/common.h
+++ b/src/common.h
@@ -810,11 +810,12 @@ void checkpoint_run (bool do_write);
#define WARN_UNKNOWN_KEYWORD 0x00020000
#define WARN_XDEV 0x00040000
#define WARN_DECOMPRESS_PROGRAM 0x00080000
+#define WARN_EXISTING_FILE 0x00100000
/* The warnings composing WARN_VERBOSE_WARNINGS are enabled by default
in verbose mode */
#define WARN_VERBOSE_WARNINGS (WARN_RENAME_DIRECTORY|WARN_NEW_DIRECTORY|\
- WARN_DECOMPRESS_PROGRAM)
+ WARN_DECOMPRESS_PROGRAM|WARN_EXISTING_FILE)
#define WARN_ALL (~WARN_VERBOSE_WARNINGS)
void set_warning_option (const char *arg);
diff --git a/src/extract.c b/src/extract.c
index d24f98f..60ec747 100644
--- a/src/extract.c
+++ b/src/extract.c
@@ -643,6 +643,8 @@ maybe_recoverable (char *file_name, bool regular, bool
*interdir_made)
switch (old_files_option)
{
case KEEP_OLD_FILES:
+ WARNOPT (WARN_EXISTING_FILE,
+ (0, 0, _("%s: skipping existing file"), file_name));
return RECOVER_SKIP;
case KEEP_NEWER_FILES:
diff --git a/src/warning.c b/src/warning.c
index 5d1bcab..102364d 100644
--- a/src/warning.c
+++ b/src/warning.c
@@ -42,6 +42,7 @@ static char const *const warning_args[] = {
"unknown-keyword",
"xdev",
"decompress-program",
+ "existing-file",
NULL
};
@@ -66,7 +67,8 @@ static int warning_types[] = {
WARN_UNKNOWN_CAST,
WARN_UNKNOWN_KEYWORD,
WARN_XDEV,
- WARN_DECOMPRESS_PROGRAM
+ WARN_DECOMPRESS_PROGRAM,
+ WARN_EXISTING_FILE
};
ARGMATCH_VERIFY (warning_args, warning_types);
--
1.7.3.2
--
Regards,
Sergey