]> git.ipfire.org Git - thirdparty/tar.git/commit
tar: invalidate directory cache after failed open master
authorDarren Carreras <artemis@perpetualsai.com>
Thu, 6 Aug 2026 05:30:20 +0000 (08:30 +0300)
committerSergey Poznyakoff <gray@gnu.org>
Thu, 6 Aug 2026 05:35:37 +0000 (08:35 +0300)
commitd1df7f403de05bfbe11527a5b570469fb1011fda
tree5ba16ed1ae2bb77282d78ca75f2d61dc7f5a3848
parent9371d36cc707a099e6867199f18bbaa7795b6150
tar: invalidate directory cache after failed open

fdbase_opendir copies a requested directory name into the cache before
opening it.  If open_subdir fails, this leaves the new name associated
with the old file descriptor.  A retry after tar creates the missing
parent can then extract into the old directory.

Close an unowned old descriptor before trying to open the new dir and
invalidate the cache entry if that fails.  Add a regression test using
equal-length sibling directory names.

* src/misc.c (fdbase_opendir): Invalidate the cache after a failed
replacement open.
* tests/extrac35.at: New test.
* tests/Makefile.am (TESTSUITE_AT): Add it.
* tests/testsuite.at: Include it.
src/misc.c
tests/Makefile.am
tests/extrac35.at [new file with mode: 0644]
tests/testsuite.at