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

[BUG] file.copy state with makedirs uses file permissions on created directories #62426

Closed
lkubb opened this issue Aug 4, 2022 · 1 comment · Fixed by #62650
Closed

[BUG] file.copy state with makedirs uses file permissions on created directories #62426

lkubb opened this issue Aug 4, 2022 · 1 comment · Fixed by #62650
Labels
Bug broken, incorrect, or confusing behavior needs-triage State-Module

Comments

@lkubb
Copy link
Contributor

lkubb commented Aug 4, 2022

Description
When file.copy creates parent directories, it creates those with file permissions specified in mode. Directories generally should have the executable bit set though when read permissions are granted.

Setup
Irrelevant.

Steps to Reproduce the behavior

create test file:
  file.managed:
    - name: /tmp/file
    - replace: false

/tmp/test will have 644 perms:
  file.copy:
    - name: /tmp/test/test
    - source: /tmp/file
    - makedirs: true
    - mode: '0644'

display perms:
  module.run:
    - file.get_mode:
      - path: /tmp/test

remove test files:
  file.absent:
    - names:
      - /tmp/test
      - /tmp/file

Expected behavior
Create directories with sensible permissions.

Screenshots

----------
          ID: display perms
    Function: module.run
      Result: True
     Comment: file.get_mode: 0644
     Started: 14:01:43.678142
    Duration: 0.551 ms
     Changes:
              ----------
              file.get_mode:
                  0644

Versions Report

salt --versions-report (Provided by running salt --versions-report. Please also mention any differences in master/minion versions.)
Salt Version:
          Salt: 3004.2

Dependency Versions:
          cffi: 1.14.6
      cherrypy: unknown
      dateutil: 2.8.0
     docker-py: Not Installed
         gitdb: 4.0.5
     gitpython: 3.1.12
        Jinja2: 2.11.3
       libgit2: Not Installed
      M2Crypto: Not Installed
          Mako: 1.1.4
       msgpack: 1.0.2
  msgpack-pure: Not Installed
  mysql-python: Not Installed
     pycparser: 2.19
      pycrypto: Not Installed
  pycryptodome: 3.9.8
        pygit2: Not Installed
        Python: 3.7.12 (default, May 13 2022, 19:05:09)
  python-gnupg: 0.4.4
        PyYAML: 5.4.1
         PyZMQ: 18.0.1
         smmap: 3.0.2
       timelib: 0.2.4
       Tornado: 4.5.3
           ZMQ: 4.3.1

System Versions:
          dist: darwin 21.5.0
        locale: UTF-8
       machine: x86_64
       release: 21.5.0
        system: Darwin
       version: 12.4 x86_64
@lkubb lkubb added Bug broken, incorrect, or confusing behavior needs-triage labels Aug 4, 2022
@OrangeDog
Copy link
Contributor

It should have a dir_mode argument, same as file.managed. Definite bug here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug broken, incorrect, or confusing behavior needs-triage State-Module
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants