Skip to content

sync: preserve permissions of upstream/downstream files #848

@dsuievalov

Description

@dsuievalov

What happened?

Local/remote files permissions are not preserved by devspace sync:

# empty files
[~]$ mkdir test
[~]$ touch test/local test/local-with-extra-perms
# set extra permissions
[~]$ chown 755 test/local-with-extra-perms
[~]$ ll test
total 0
drwxr-xr-x   5 <local-user>  <local-group>   160B Dec 30 18:50 ./
drwxr-xr-x  56 <local-user>  <local-group>   1.8K Dec 30 17:05 ../
-rw-r--r--   1 <local-user>  <local-group>     0B Dec 30 18:50 local
-rwxr-xr-x   1 <local-user>  <local-group>     0B Dec 30 18:50 local-with-extra-perms*
# create remote dir and example file
[~]$ kubectl exec -it <pod> -- bash -c "mkdir -p /test && touch /test/remote && ls -al /test"
total 8
drwxrwxrwx 2 root root 4096 Dec 30 16:58 .
drwxr-xr-x 1 root root 4096 Dec 30 16:48 ..
-rw-rw-rw- 1 root root    0 Dec 30 16:58 remote
# run sync
[~]$ devspace sync -l app.kubernetes.io/instance=<instance> -l app.kubernetes.io/name=<name> -c <name> --container-path=/test --local-path=${PWD}/test --pod <pod>
[info]   Using kube context '<context>'
[info]   Using namespace '<namespace>'
[info]   Start syncing
[done] √ Sync started on /Users/<user>/test <-> /test (Pod: <namespace>/<pod>)
[info]   Initial sync completed
[info]   Upstream - Upload File /local
[info]   Upstream - Upload File /local-with-extra-perms
[info]   Upstream - Upload 2 create changes (size 0)
[info]   Upstream - Successfully processed 2 change(s)
^C
# sync results
# locally
[~]$ ll test
total 0
drwxr-xr-x   5 <local-user>  <local-group>   160B Dec 30 18:58 ./
drwxr-xr-x  56 <local-user>  <local-group>   1.8K Dec 30 17:05 ../
-rw-r--r--   1 <local-user>  <local-group>     0B Dec 30 18:57 local
-rwxr-xr-x   1 <local-user>  <local-group>     0B Dec 30 18:57 local-with-extra-perms*
-rw-r--r--   1 <local-user>  <local-group>     0B Dec 30 18:58 remote
# remotely
root@<pod>:~# ll /test
total 8
drwxrwxrwx 2 root root 4096 Dec 30 16:58 ./
drwxr-xr-x 1 root root 4096 Dec 30 16:48 ../
-rw-r--r-- 1 root root    0 Dec 30 16:57 local
-rw-r--r-- 1 root root    0 Dec 30 16:57 local-with-extra-perms
-rw-rw-rw- 1 root root    0 Dec 30 16:58 remote

What did you expect to happen instead?

Downloaded file remote should have permissions 0666 but get 0644
Uploaded file local-with-extra-perms should have permissions 0755 but get 0644

How can we reproduce the bug? (as minimally and precisely as possible)

Local Environment:

  • Operating System: mac
  • Devspace version: 4.3.4

Kubernetes Cluster:

  • Cloud Provider: google
  • Kubernetes Version: v1.14.7

Anything else we need to know?

/kind bug

Metadata

Metadata

Assignees

Labels

area/syncIssues related to the real-time code synchronizationkind/enhancementEnhancement of an existing feature / improvementp/mediumMedium priority

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions