Bug 1565970

Summary: cat /ostree/repo/refs/heads/ostree/0/1/0 > /etc/file1 failed
Product: [Fedora] Fedora Reporter: lnie <lnie>
Component: rpm-ostreeAssignee: Colin Walters <walters>
Status: CLOSED NOTABUG QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 28CC: adimania, amurdaca, bbaude, dustymabe, dwalsh, fkluknav, jonathan, lsm5, miabbott, walters
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2018-04-24 14:55:56 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description lnie 2018-04-11 08:11:04 UTC
Description of problem:
I'm running this testcase
http://fedoraproject.org/wiki/User:Roshi/QA/AtomicTests/Atomic_Upgrade

[fedora@atomic01 ~]$ sudo cat /ostree/repo/refs/heads/ostree/0/1/0 > /etc/file1
-bash: /etc/file1: Permission denied

On a normal f28 server system,the command succeed as usual.



Version-Release number of selected component (if applicable):
Fedora-AtomicHost-28-20180410.n.1.x86_64.qcow2.1

How reproducible:
always

Steps to Reproduce:
1.
2.
3.

Actual results:


Expected results:


Additional info:

Comment 1 Dusty Mabe 2018-04-24 14:54:56 UTC
hey Inie. Thanks for the bug report. This isn't a bug, though as the write to '/etc/file1' in the command you are running is not privileged (i.e. it's not part of the sudo command). 

If you were running as root this would work:

```
[vagrant@vanilla-f28-atomic ~]$ sudo su -
[root@vanilla-f28-atomic ~]# whoami 
root
[root@vanilla-f28-atomic ~]# cat /ostree/repo/refs/heads/ostree/0/1/0 > /etc/file1
[root@vanilla-f28-atomic ~]# echo $?
0
```

It would also work if you included the redirect in the sudo command:

```
[vagrant@vanilla-f28-atomic ~]$ whoami
vagrant
[vagrant@vanilla-f28-atomic ~]$ sudo su -c "cat /ostree/repo/refs/heads/ostree/0/1/0 > /etc/file1"
[vagrant@vanilla-f28-atomic ~]$ echo $?
0
```

closing for now as notabug

Comment 2 Micah Abbott 2018-04-24 15:00:39 UTC
I've updated the linked test case to clearly indicate to use a privileged user when writing to /etc

Comment 3 Dusty Mabe 2018-04-24 15:07:02 UTC
(In reply to Micah Abbott from comment #2)
> I've updated the linked test case to clearly indicate to use a privileged
> user when writing to /etc

thanks micah