azukiapp / azk

azk is a lightweight open source development environment orchestration tool. Instantly & safely run any environment on your local machine.
http://azk.io
Apache License 2.0
898 stars 63 forks source link

[Sync] Fixing ownership of the symlink itself, not of the target file #644

Closed fearenales closed 8 years ago

fearenales commented 8 years ago

This PR intends to fix a bug in the sync mount.

When a symlink was intended to be synced, sync tried to run a chown over it. The bug occurs when the target file didn't exist in the sync container context.

Example:

mounts: {
  '/azk/#{manifest.dir}' : sync("."),
  '/azk/other/file'      : path("../file"),  // may or may not be mounted
}
$ ls -l ./link
lrwxrwxrwx 1 user users 27 Mar 31 19:28 link -> ../file

In this case, the sync occurs for the current dir (.), which contains a symlink named link that points to the file ../file. In the sync container, the file doesn't exist, and the chown fails.

Adding the -h option, the chown command is applied to the symlink itself, instead of be applied to the target file.