]> git.ipfire.org Git - thirdparty/tar.git/commit
Fix bug with -x --xattr read-only files
authorPaul Eggert <eggert@cs.ucla.edu>
Fri, 26 Aug 2022 20:23:23 +0000 (15:23 -0500)
committerPaul Eggert <eggert@cs.ucla.edu>
Fri, 26 Aug 2022 21:39:16 +0000 (16:39 -0500)
commit0b74885e81b90d6ab4890b195dce99ca9109fe59
tree6d4b3df349fa35a26b8c3bab24d469584791204a
parent258d1c44e5ee7c58b28bf0000e9d737df6081885
Fix bug with -x --xattr read-only files

Problem reported by Kevin Raymond in:
https://bugzilla.redhat.com/show_bug.cgi?id=1886540
* src/extract.c (open_output_file): If we already created the
empty file, do not open with O_EXCL, or with O_CREAT or O_TRUNC
for that matter.  Instead, use only O_NOFOLLOW to avoid some
races.  When estimating current mode, use openflag & O_EXCL rather
than overwriting_old_files.
(extract_file): Also invert S_IWUSR if it’s not set.
* tests/xattr08.at: New test.
* tests/Makefile.am, tests/testsuite.at: Add it.
src/extract.c
tests/Makefile.am
tests/testsuite.at
tests/xattr08.at [new file with mode: 0644]