Hello, following scenario is quite confusing:
$ pushd $(mktemp -d) $ mkdir x $ touch x/a $ tar cf ar x $ tar tf ar x x/a x/ x/a tar: x/a: Not found in archive tar: Exiting with failure status due to previous errors Note that users are usually not aware of the --recursion option. Some more obvious warning could be thrown instead, possibly "Member matched no file in archive"? Pavel
>From 9f652cca6fe6b2b5ba9d60a8c3d2dd00a0254f0d Mon Sep 17 00:00:00 2001 From: Pavel Raiskup <[email protected]> Date: Mon, 1 Dec 2014 09:35:40 +0100 Subject: [PATCH] tar: tune up warnings for not-matched members If the --recursion is ON (default), any directory member matches also files in this directory. Subsequent members trying to match file in this directory ended up with confusing 'MEMBER: Not found in archive' warning which was not quite truth. * src/names.c (names_notfound): Use 'Member matched no file in archive'. Suggest --no-recursion if that may be the issue. --- src/names.c | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/src/names.c b/src/names.c index e3e145a..85d347c 100644 --- a/src/names.c +++ b/src/names.c @@ -852,12 +852,20 @@ names_notfound (void) for (cursor = namelist; cursor; cursor = cursor->next) if (!WASFOUND (cursor) && cursor->name[0]) { - regex_usage_warning (cursor->name); - ERROR ((0, 0, - (cursor->found_count == 0) ? - _("%s: Not found in archive") : - _("%s: Required occurrence not found in archive"), - quotearg_colon (cursor->name))); + regex_usage_warning (cursor->name); + + const char *err_msg = _("%s: Member matched no file in archive"); + + /* --recursion is in effect */ + if (recursion_option && cursor->prev) + err_msg = _("%s: Member matched no file in archive" + " (maybe --no-recursion?)"); + + /* --occurrence */ + if (cursor->found_count) + err_msg = _("%s: Required occurrence not found in archive"); + + ERROR ((0, 0, err_msg, quotearg_colon (cursor->name))); } /* Don't bother freeing the name list; we're about to exit. */ -- 1.9.3
