On 07/01/2019 23:24, Harald van Dijk wrote:
Hi,
After upgrading to GNU tar 1.31, I am seeing bad behaviour trying to
extract archives containing ./ entries with the -U option. This is
easily reproducible:
$ tar cf - --no-recursion . | tar xUf -
Aborted
The abort() in src/extract.c's maybe_recoverable(), marked with a
comment as unreachable, is in fact reachable in this case.
And looking at the code, it's obvious that it's reachable.
The abort() was added in commit ccef8581:
<https://git.savannah.gnu.org/cgit/tar.git/commit/?id=ccef8581b8673cadd1c084595de4efde956c3c2b>
It was in response to a GCC warning that one case falls through to the next.
I think the author of that commit misread the code, and the proper
response to the warning is to add a break statement, like so:
--- a/src/extract.c
+++ b/src/extract.c
@@ -787,7 +787,7 @@
case UNLINK_FIRST_OLD_FILES:
break;
}
- abort (); /* notreached */
+ break;
case ENOENT:
/* Attempt creating missing intermediate directories. */
It restores the tar -U handling to how it was in 1.30, but it should
probably get new tests added to cover the various cases that abort. I'm
seeing some unrelated failures running the test suite that I'd need to
look into before being able to submit something that's properly tested
though.
Cheers,
Harald van Dijk