]> git.ipfire.org Git - thirdparty/tar.git/commit
Fix missing type in mknodat() mode argument
authorAnssi Hannula <anssi.hannula@bitwise.fi>
Wed, 6 Nov 2024 10:43:32 +0000 (12:43 +0200)
committerSergey Poznyakoff <gray@gnu.org>
Mon, 12 May 2025 10:18:21 +0000 (13:18 +0300)
commit827dde1605a1acdaaee3afdcdde95dad0017f7eb
tree426563581c5bb521e87e6de0763fcf8e776dcb84
parent65228e9ba9fa2d4a419f7970d83b88e3aeeb45aa
Fix missing type in mknodat() mode argument

Per POSIX, the type of the file to be created should be OR'ed to the
`mode` argument of mknodat().

However, set_xattr() creates an empty file using mknodat() and does not
do that.

E.g. Linux kernel considers zero type as S_IFREG, so the code works on
most systems.

However, e.g. fakeroot, at least up to the current v1.36, does not
consider 0 as S_IFREG, instead creating an invalid file, causing tar to
enter an infinite retry loop when trying to create a file with xattrs
under fakeroot.

Since set_xattr is used only when extracting regular files, fix that
by ORing its mode argument with S_IFREG.

Copyright-paperwork-exempt: Yes
src/extract.c