file.copy preserve=True does still not preserve ownership and makedirs=True get undesired mode
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 15.7k
- Forks
- 5.6k
- Avg merge
- 2d 44m
- Merged PRs (30d)
- 80
Description
Description of Issue/Question
Running file.copy with preserve: True does not preserve ownership (resets to root/user under which salt is running). Access permissions are preserved.
References: #22711, #40154
Setup
Master / minion with both salt-2016 and salt-2019
Tested on RHEL 7.
Steps to Reproduce Issue
Testing with makedirs=True preserve=True
rm -rf /tmp/foo /tmp/baz && \
mkdir -p /tmp/baz && \
touch /tmp/baz/bar && \
chown -R nobody:nobody /tmp/baz && \
chmod 600 /tmp/baz/bar && \
salt-call -l error state.single file.copy name="/tmp/foo/bar" source="/tmp/baz/bar" makedirs=True preserve=True
ls -ld /tmp/foo /tmp/foo/bar /tmp/baz /tmp/baz/bar
Result from 2019 - file owned by root and directory with rw mode only (no x)
drwxr-xr-x 2 nobody nobody 17 Apr 26 09:22 /tmp/baz
-rw------- 1 nobody nobody 0 Apr 26 09:22 /tmp/baz/bar
drw------- 2 nobody nobody 17 Apr 26 09:22 /tmp/foo
-rw------- 1 root root 0 Apr 26 09:22 /tmp/foo/bar
Result from 2016 - file and created dir owned by root but directory with 755 mode.
drwxr-xr-x 2 nobody nobody 16 Apr 26 09:24 /tmp/baz
-rw------- 1 nobody nobody 0 Apr 26 09:24 /tmp/baz/bar
drwxr-xr-x 2 root root 16 Apr 26 09:24 /tmp/foo
-rw------- 1 root root 0 Apr 26 09:24 /tmp/foo/bar
Versions Report
On 2019
Salt Version:
Salt: 2019.2.0
Dependency Versions:
cffi: Not Installed
cherrypy: Not Installed
dateutil: 1.5
docker-py: Not Installed
gitdb: Not Installed
gitpython: Not Installed
ioflo: Not Installed
Jinja2: 2.7.2
libgit2: Not Installed
libnacl: Not Installed
M2Crypto: 0.31.0
Mako: Not Installed
msgpack-pure: Not Installed
msgpack-python: 0.5.6
mysql-python: Not Installed
pycparser: Not Installed
pycrypto: 2.6.1
pycryptodome: Not Installed
pygit2: Not Installed
Python: 2.7.5 (default, Sep 12 2018, 05:31:16)
python-gnupg: Not Installed
PyYAML: 3.11
PyZMQ: 15.3.0
RAET: Not Installed
smmap: Not Installed
timelib: Not Installed
Tornado: 4.2.1
ZMQ: 4.1.4
System Versions:
dist: redhat 7.6 Maipo
locale: UTF-8
machine: x86_64
release: 3.10.0-957.10.1.el7.x86_64
system: Linux
version: Red Hat Enterprise Linux Server 7.6 Maipo
On 2016
Salt Version:
Salt: 2016.11.10
Dependency Versions:
cffi: Not Installed
cherrypy: Not Installed
dateutil: 1.5
docker-py: Not Installed
gitdb: Not Installed
gitpython: Not Installed
ioflo: Not Installed
Jinja2: 2.7.2
libgit2: Not Installed
libnacl: Not Installed
M2Crypto: 0.21.1
Mako: Not Installed
msgpack-pure: Not Installed
msgpack-python: 0.5.1
mysql-python: Not Installed
pycparser: Not Installed
pycrypto: 2.6.1
pycryptodome: Not Installed
pygit2: Not Installed
Python: 2.7.5 (default, Sep 12 2018, 05:31:16)
python-gnupg: Not Installed
PyYAML: 3.11
PyZMQ: 15.3.0
RAET: Not Installed
smmap: Not Installed
timelib: Not Installed
Tornado: 4.2.1
ZMQ: 4.1.4
System Versions:
dist: redhat 7.6 Maipo
machine: x86_64
release: 3.10.0-957.10.1.el7.x86_64
system: Linux
version: Red Hat Enterprise Linux Server 7.6 Maipo
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the issue with the provided salt-call state.single file.copy command on RHEL 7, then trace the file.copy implementation and its handling of preserve=True and makedirs=True. Done means ownership is preserved and newly created directories have the expected mode, with coverage for both behaviors.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- devops, infrastructure
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100