Bug 1886540 - extracting using --xattrs of read only files lead to Cannot open: Permission denied issue
Summary: extracting using --xattrs of read only files lead to Cannot open: Permission ...
Keywords:
Status: CLOSED RAWHIDE
Alias: None
Product: Fedora
Classification: Fedora
Component: tar
Version: 38
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Lukas Javorsky
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2020-10-08 17:16 UTC by Kevin Raymond
Modified: 2023-07-27 09:58 UTC (History)
5 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2023-07-27 09:58:51 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)

Description Kevin Raymond 2020-10-08 17:16:03 UTC
Description of problem:
Using the Yocto projet tool, I used to compile linux distribution. After an OS upgrade I just encountered this error which is unexpected.


Version-Release number of selected component (if applicable):
1.32

How reproducible:
Always

Steps to Reproduce:
1. Create a folder
2. populate this folder with empty files (mode 644) and one mode 444
3. archive with attributes and then try to extract preserving attributes...

simple code

mkdir src
touch src/a
touch src/b
chmod 444 src/b
mkdir out
tar --xattrs --xattrs-include='*' -cf - -S -C src -p . | tar --xattrs --xattrs-include='*' -xf - -C out
tar: ./b: Cannot open: Permission denied
tar: Exiting with failure status due to previous errors



Actual results:
failure

Expected results:
pass

Additional info:
$ ls -lZ src/
total 0
-rw-r--r--. 1 shaiton shaiton unconfined_u:object_r:user_home_t:s0 0  8 oct.  18:48 a
-r--r--r--. 1 shaiton shaiton unconfined_u:object_r:user_home_t:s0 0  8 oct.  18:48 b
$ lsattr src/
--------------e----- src/a
--------------e----- src/b



setxattr("/proc/self/fd/5/./a", "security.selinux", "unconfined_u:object_r:user_home_"..., 37, 0) = 0
openat(5, "./a", O_WRONLY|O_CREAT|O_NOCTTY|O_NONBLOCK|O_CLOEXEC, 0644) = 6
utimensat(6, NULL, [UTIME_OMIT, {tv_sec=1602175704, tv_nsec=679442719} /* 2020-10-08T18:48:24.679442719+0200 */], 0) = 0
close(6)                                = 0
mknodat(5, "./b", 0444)                 = -1 EEXIST (File exists)
unlinkat(5, "./b", 0)                   = 0
mknodat(5, "./b", 0444)                 = 0
setxattr("/proc/self/fd/5/./b", "security.selinux", "unconfined_u:object_r:user_home_"..., 37, 0) = 0
openat(5, "./b", O_WRONLY|O_CREAT|O_NOCTTY|O_NONBLOCK|O_CLOEXEC, 0444) = -1 EACCES (Permission denied)
write(2, "tar: ", 5tar: )                    = 5
write(2, "./b: Cannot open", 16./b: Cannot open)        = 16
write(2, ": Permission denied", 19: Permission denied)     = 19
write(2, "\n", 1

Comment 1 Kevin Raymond 2020-10-09 06:38:32 UTC
Apparently this is not the bug I am facing, as the same code behave exactly the same under F32. However I keep it open in order to understand what is wrong with extracting a read only file from a tar archive and preserving its attributes.
Thanks

Comment 2 Pavel Raiskup 2020-10-09 10:20:25 UTC
Thank you for the report, Kevin!  I proposed the following patch upstream:

https://github.com/praiskup/tar/commit/63982eb098f6798a314d8f6aeb2e4139a78d2922

Comment 3 Pavel Raiskup 2020-10-09 11:42:40 UTC
Proposal: https://www.mail-archive.com/bug-tar@gnu.org/msg05904.html

Comment 4 Kevin Raymond 2020-10-12 06:52:59 UTC
Thanks Pavel for your prompt reaction.
Happy to try any koji (s)rpm if needed

Comment 5 Pavel Raiskup 2020-10-12 08:17:07 UTC
Ok, testing build is here:
https://copr.fedorainfracloud.org/coprs/praiskup/rhbz-1886540-tar/
( dnf copr enable praiskup/rhbz-1886540-tar )

Though I'd like to give the upstream some time to react before
we apply this against the Fedora package.

Comment 6 Pavel Raiskup 2020-10-12 08:35:53 UTC
PR: https://src.fedoraproject.org/rpms/tar/pull-request/7

Comment 7 Kevin Raymond 2020-10-14 12:30:49 UTC
Oh yeah I forgot about copr.
Works for me. I am still looking for the change between F32 where the same code raises the same issue but the « yocto build » is a success.
This should not be a blocker for the F33 release, therefore no probs to wait for the upstream feedback.

Comment 8 Ondrej Dubaj 2021-10-07 07:32:31 UTC
Patch still not applied upstream.

Comment 9 Ben Cotton 2021-11-04 13:39:38 UTC
This message is a reminder that Fedora 33 is nearing its end of life.
Fedora will stop maintaining and issuing updates for Fedora 33 on 2021-11-30.
It is Fedora's policy to close all bug reports from releases that are no longer
maintained. At that time this bug will be closed as EOL if it remains open with a
Fedora 'version' of '33'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, simply change the 'version' 
to a later Fedora version.

Thank you for reporting this issue and we are sorry that we were not 
able to fix it before Fedora 33 is end of life. If you would still like 
to see this bug fixed and are able to reproduce it against a later version 
of Fedora, you are encouraged  change the 'version' to a later Fedora 
version prior this bug is closed as described in the policy above.

Although we aim to fix as many bugs as possible during every release's 
lifetime, sometimes those efforts are overtaken by events. Often a 
more recent Fedora release includes newer upstream software that fixes 
bugs or makes them obsolete.

Comment 10 Ben Cotton 2021-11-04 14:09:12 UTC
This message is a reminder that Fedora 33 is nearing its end of life.
Fedora will stop maintaining and issuing updates for Fedora 33 on 2021-11-30.
It is Fedora's policy to close all bug reports from releases that are no longer
maintained. At that time this bug will be closed as EOL if it remains open with a
Fedora 'version' of '33'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, simply change the 'version' 
to a later Fedora version.

Thank you for reporting this issue and we are sorry that we were not 
able to fix it before Fedora 33 is end of life. If you would still like 
to see this bug fixed and are able to reproduce it against a later version 
of Fedora, you are encouraged  change the 'version' to a later Fedora 
version prior this bug is closed as described in the policy above.

Although we aim to fix as many bugs as possible during every release's 
lifetime, sometimes those efforts are overtaken by events. Often a 
more recent Fedora release includes newer upstream software that fixes 
bugs or makes them obsolete.

Comment 11 Ben Cotton 2021-11-04 15:06:13 UTC
This message is a reminder that Fedora 33 is nearing its end of life.
Fedora will stop maintaining and issuing updates for Fedora 33 on 2021-11-30.
It is Fedora's policy to close all bug reports from releases that are no longer
maintained. At that time this bug will be closed as EOL if it remains open with a
Fedora 'version' of '33'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, simply change the 'version' 
to a later Fedora version.

Thank you for reporting this issue and we are sorry that we were not 
able to fix it before Fedora 33 is end of life. If you would still like 
to see this bug fixed and are able to reproduce it against a later version 
of Fedora, you are encouraged  change the 'version' to a later Fedora 
version prior this bug is closed as described in the policy above.

Although we aim to fix as many bugs as possible during every release's 
lifetime, sometimes those efforts are overtaken by events. Often a 
more recent Fedora release includes newer upstream software that fixes 
bugs or makes them obsolete.

Comment 12 Pavel Raiskup 2021-11-05 11:48:55 UTC
Updated against latest upstream source (in my "mirror"), and CI tested:
https://github.com/praiskup/tar/pull/2

Comment 13 Lukas Javorsky 2022-08-26 07:51:34 UTC
I've tried to reach out to the upstream again: https://www.mail-archive.com/bug-tar@gnu.org/msg06146.html

Comment 14 Ben Cotton 2022-11-29 16:49:47 UTC
This message is a reminder that Fedora Linux 35 is nearing its end of life.
Fedora will stop maintaining and issuing updates for Fedora Linux 35 on 2022-12-13.
It is Fedora's policy to close all bug reports from releases that are no longer
maintained. At that time this bug will be closed as EOL if it remains open with a
'version' of '35'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, change the 'version' 
to a later Fedora Linux version.

Thank you for reporting this issue and we are sorry that we were not 
able to fix it before Fedora Linux 35 is end of life. If you would still like 
to see this bug fixed and are able to reproduce it against a later version 
of Fedora Linux, you are encouraged to change the 'version' to a later version
prior to this bug being closed.

Comment 15 Ben Cotton 2022-12-13 15:15:59 UTC
Fedora Linux 35 entered end-of-life (EOL) status on 2022-12-13.

Fedora Linux 35 is no longer maintained, which means that it
will not receive any further security or bug fix updates. As a result we
are closing this bug.

If you can reproduce this bug against a currently maintained version of Fedora Linux
please feel free to reopen this bug against that version. Note that the version
field may be hidden. Click the "Show advanced fields" button if you do not see
the version field.

If you are unable to reopen this bug, please file a new report against an
active release.

Thank you for reporting this bug and we are sorry it could not be fixed.

Comment 16 Pavel Raiskup 2023-05-18 13:08:11 UTC
PR https://src.fedoraproject.org/rpms/tar/pull-request/7 updated

Comment 17 Lukas Javorsky 2023-07-27 09:58:51 UTC
Upstreamed in tar-1.35 version, which is in Fedora Rawhide.


Note You need to log in before you can comment on or make changes to this bug.