Hi Andrew,

Thanks for reporting.  Please, apply the attached patch (I'll push it
when savannah is back online).

Regards,
Sergey

>From 90ccb91b97bd038883fe1b1d9d806aab6b89a42e Mon Sep 17 00:00:00 2001
From: Sergey Poznyakoff <g...@gnu.org>
Date: Mon, 2 Jun 2025 07:22:53 +0300
Subject: [PATCH] Bugfix

* src/names.c (all_names_found): Exempt wildcard entries from hierarchy
checking.
---
 src/names.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/src/names.c b/src/names.c
index d3a36bcd..ebdec2e0 100644
--- a/src/names.c
+++ b/src/names.c
@@ -1407,8 +1407,9 @@ name_match (const char *file_name)
    The decision is postponed until the next entry is read if:

    1) P ended with a slash (i.e. it was a directory)
-   2) P matches any entry from the namelist *and* represents a subdirectory
-   or a file lying under this entry (in the terms of directory structure).
+   2) P matches a non-wildcard entry from the namelist *and* represents a
+   subdirectory or a file lying under this entry (in the terms of directory
+   structure).

    This is necessary to handle contents of directories. */
 bool
@@ -1420,7 +1421,8 @@ all_names_found (struct tar_stat_info *p)
   for (struct name const *cursor = namelist; cursor; cursor = cursor->next)
     {
       if ((cursor->name[0] && !wasfound (cursor))
-	  || (len >= cursor->length && ISSLASH (p->file_name[cursor->length])))
+	  || (!cursor->is_wildcard &&
+	      len >= cursor->length && ISSLASH (p->file_name[cursor->length])))
 	return false;
     }
   return true;
--
2.35.1

Reply via email to