Created attachment 203232 [details] libarchive directory traversal patch libarchive-based utilities, notably including tar(1), fail if told to traverse "." if the parent directory is not readable. This is caused by libarchive trying to open ".." at the end of the traverse in order to exit the directory, which is an obviously wrong thing to do. Attached patch (against 12-stable) fixes this and includes a test case.
Sorry, this fix isn't quite complete; there are still error cases with archiving "foo/bar/." where "foo" is not readable. Will post another fix shortly.
Created attachment 203234 [details] libarchive directory traversal patch New patch. This fixes both the original issue and the issue of spurious "Bad file descriptor" errors that occur if the initial directory is not readable.
A version of this patch was accepted by upstream libarchive: https://github.com/libarchive/libarchive/pull/1167
Closed as fixed, by the MFC of r347990 (see upstream PR #1167)
Assign to committer that resolved