Hello Paul,

first of all, my changes that you recently committed were motivated by
fixing --one-top-level with absolute path argument and RESOLVE_BENEATH -
we started discussing it at the beginning of this year.

But the subsequent commit e54e505a broke exactly that case, in case the
directory does not exist:

$ mkdir d && echo hello > d/file
$ tar cf test.tar d
$ tar xf test.tar --one-top-level=/tmp/abs-otl-target
tar: /tmp/abs-otl-target: Cannot open: No such file or directory
tar: Error is not recoverable: exiting now

According to Claude Code, the cause is simple:

"The bug is in fdbase_opendir (commit e54e505a): the cache miss path at
line 1380 uses open_subdir(chdir_fd, ...) instead of open_subdir(dfd,
...). For absolute paths, dfd is AT_FDCWD but chdir_fd may differ, and
RESOLVE_BENEATH in open_subdir blocks absolute path components."

(But note that we need commit e54e505a, you can not just revert it, it
is not just an optimization: it fixes a big security hole introduced in
the previous commit 941f62b2: after that, with an absolute path argument
to --one-top-level, RESOLVE_BENEATH was not used at all.)

Can you please fix this regression in e54e505a?

Regards, Pavel


Reply via email to