Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't pre-create read-only files with --extract --xattrs #2

Closed
wants to merge 1 commit into from

Conversation

praiskup
Copy link
Owner

@praiskup praiskup commented Nov 5, 2021

We used to respect the target file mode when pre-creating files in
set_xattr, so we also pre-created read-only files that we were not able
to open later for writing. This is now fixed, and we always create the
file with S_IWUSR.

Fixes the original bug report https://bugzilla.redhat.com/1886540

  • src/extract.c (set_xattr): Blindly add S_IWUSR flag to pre-created
    files, to avoid openat failures later.
  • tests/xattr08.at: New test-case file.

@praiskup
Copy link
Owner Author

@ljavorsk
Copy link

Is there a reason why this patch still hasn't been touched/reviewed?

@praiskup
Copy link
Owner Author

Feel free to ping upstream, too. Perhaps this isn't trivial enough to review. Dunno.

@praiskup
Copy link
Owner Author

Follow-up discussion:
https://www.mail-archive.com/bug-tar@gnu.org/msg06146.html

Upstream merged 0b74885 and 35d9845.

@praiskup
Copy link
Owner Author

This was rather hard to review, but 35d9845 eventually does this:

tar/src/extract.c

Lines 1274 to 1275 in d648fe9

while (((file_created = set_xattr (file_name, &current_stat_info,
mode | S_IWUSR, typeflag))

Therefore the new code "pre-creates" the file with S_IWUSR (which was the initial idea about this PR).

* src/extract.c (extract_file): Document why we pre-create with S_IWUSR.
(set_xattr): Drop the INVERT_PERMISSIONS doc leftover.
@praiskup praiskup force-pushed the no-pre-created-read-only-files-xattrs branch from 5f9283c to 4fc376e Compare May 18, 2023 12:33
@praiskup
Copy link
Owner Author

This is documentation only now, proposed here:
https://www.mail-archive.com/bug-tar@gnu.org/msg06216.html

@praiskup
Copy link
Owner Author

praiskup commented Jun 6, 2023

Applied as e7987b7

@praiskup praiskup closed this Jun 6, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants