EugenMayer / docker-sync

Run your application at full speed while syncing your code for development, finally empowering you to utilize docker for development under OSX/Windows/*Linux
GNU General Public License v3.0
3.54k stars 290 forks source link

Error on attempting to set permissions on symlinks to executables with rsync. Error codes 95 and 23 #519

Closed motin closed 6 years ago

motin commented 6 years ago

When symlinks to executable files are synced using rsync strategy on OSX, the following error is displayed for each and every one:

rsync: failed to set permissions on "dna/vendor/bin/propel" (in volume): Not supported (95)

After these errors, the general error code 23 is reported:

rsync error: some files could not be transferred (code 23) at /BuildRoot/Library/Caches/com.apple.xbs/Sources/rsync/rsync-52/rsync/main.c(996) [sender=2.6.9]
error  Error starting sync, exit code 23

What is happening here is that rsync tries to set the executable bit on the symlink itself, which is not allowed. The executable bit is already set on the target of the symlink, so syncing the executable bit on the symlink is unnecessary:

root@9a87c34c558c:/app# ls -l /app/dna/vendor/bin/propel
lrwxrwxrwx 1 www-data dialout 27 Jan  7 14:40 /app/dna/vendor/bin/propel -> ../propel/propel/bin/propel
root@9a87c34c558c:/app# ls -l /app/dna/vendor/bin/../propel/propel/bin/propel
-rwxr-xr-x 1 www-data dialout 60 Aug 28  2016 /app/dna/vendor/bin/../propel/propel/bin/propel

To be clear, everything inside the container works as expected with this setup, but the error reported is annoying and leads to "--delete" not working without also specifying "--ignore-errors", something that works fine as a workaround but is not safe in case real IO errors crop up some day. Using "--no-perms" instead of "--ignore-errors" works as well, but then permissions are not synced at all into the docker environment.

How can we tell rsync not to try to set these executable permission bits on these symlinks?

Note: This issue has been mentioned in the following closed issues, without the actual issue being solved: https://github.com/EugenMayer/docker-sync/issues/161 https://github.com/EugenMayer/docker-sync/issues/151 https://github.com/EugenMayer/docker-sync/issues/145#issuecomment-248433988

In all of above, the proposed solution has been to use --copy-links or not syncing symlinks at all. Both of those proposed solutions breaks code that is dependent on these symlinks. Running "npm install" or "composer install" inside the container is not a solution neither, since we actively develop inside the vendor folders (a lot of our code is organized as installable packages).

Docker Driver

d4m - Version 17.12.0-ce-mac45 (21669)

Sync strategy

rsync

docker-sync.yml

version: "2"

options:
  verbose: true
syncs:

  # one-way sync using rsync by default for performance reasons
  sq-personal-unit-sync-app:
    src: './' # VERY important with a trailing slash, since otherwise the host sync root gets synced to /app/name-of-parent-directory instead of /app
    sync_host_ip: 'auto'
    sync_host_port: 10872
    sync_strategy: 'rsync'
    sync_args: '-v --progress --delete --ignore-errors'
    sync_excludes: [
      '.git'
    ]

OS

OSX High Sierra

EugenMayer commented 6 years ago

read the rsync docs, if you find somethings, go ahead