rsync-auto not ignoring folders in exclusions lists, fail because of permissions issue
I have a folder that only root can access in my project containing sensitive data and don't want it to be exposed in the VM so I added it to the exclusion list. But rsync-auto keeps failing because it doesn't have permission to the folder, where it doesn't have to check at all.
Debug output
https://gist.githubusercontent.com/kamuridesu/9db490f11d32a5c0c45393d9d6ebe396/raw/180facd7df0740de043082ade45f97d805ad94e7/vagrant_rsync_auto.log
Expected behavior
Synchronize folders, ignoring the paths on rsync__exclude.
Actual behavior
Error, trying to add files that lack permission.
Reproduction information
Vagrant version
Vagrant 2.3.0
Host operating system
Arch Linux Rolling Release Kernel: 5.19.11-arch1-1
Guest operating system
Debian 10 "Buster" Kernel: 4.19.0-18-amd64
Steps to reproduce
- have a folder with only root permission
- add it to the exclusion list
- try to use rsync-auto
- see the error
Vagrantfile
# -*- mode: ruby -*-
# vi: set ft=ruby :
Vagrant.configure("2") do |config|
config.vm.box = "debian/buster64"
config.vm.box_check_update = false
config.vm.network "private_network", ip: "192.168.56.100"
#
config.vm.provider "virtualbox" do |vb|
vb.memory = "4000"
vb.cpus = "4"
end
config.vm.provision "shell", path: "configs/shell/provision.sh"
config.vm.synced_folder ".", "/vagrant", type: "rsync",
rsync__exclude: [".git/", "data/", "data/*", "data/**", "data/postgres"]
end
It seems to be related: https://github.com/hashicorp/vagrant/issues/4248#issuecomment-91232058
This looks like its related to an issue with the listen gem https://github.com/guard/listen/issues/557. Seems to be only effecting linux host.
Once https://github.com/hashicorp/vagrant/pull/13066 is merged this problem can be avoided using the polling method (as suggested by https://github.com/guard/listen/issues/251#issuecomment-63169321). This can be enabled in Vagrant by running vagrant rsync-auto --poll
I'm going to go ahead and close this issue now that https://github.com/hashicorp/vagrant/pull/13066 is merged. This problem can now be avoided using vagrant rsync-auto --poll (using the polling option). This workaround must be used when running on a mac host due to limitations around how file checking works.