Skip file or archive member if its transformed name is empty.

* NEWS: Document changes.
* doc/tar.texi: Document changes.
* src/common.h (transform_stat_info): Change return value.
(transform_name_fp): Change signature.
(WARN_EMPTY_TRANSFORM): New constant.
* src/create.c: Check return from transform_name.  Skip file, if it
is false.
* src/list.c (transform_stat_info): Return bool.
(read_and): Skip member if transform_stat_info returns false.
* src/transform.c (_transform_name_to_obstack): Change return type.
Always allocate result in obstack.
(transform_name_fp): Change arguments.  Return true on
success (transformed string not empty).  Otherwise return false and
don't change the source string.
* src/warning.c: New warning class: empty-transform.
* tests/extrac17.at: Use --warning=empty-transform.
This commit is contained in:
Sergey Poznyakoff
2025-05-06 15:23:03 +03:00
parent bfc3346394
commit 6131dd2805
8 changed files with 131 additions and 45 deletions

11
NEWS
View File

@@ -1,4 +1,4 @@
GNU tar NEWS - User visible changes. 2024-11-02
GNU tar NEWS - User visible changes. 2025-05-06
Please send GNU tar bug reports to <bug-tar@gnu.org>
version TBD
@@ -24,6 +24,15 @@ as argument to --mtime option (see GNU tar manual, chapter 4
Defines output format for the COMMAND set by the above option. If
used, command output will be parsed using strptime(3).
* Skip file or archive member if transformed name is empty
If applying file name transformations (--transform and
--strip-component options) to a file or member name results in an
empty string that file or member is skipped and a warning is printed.
The warning can be suppressed using the --warning=empty-transform
option.
* Bug fixes
** Fixed O(n^2) time complexity bug for large numbers of directories when