vagrant icon indicating copy to clipboard operation
vagrant copied to clipboard

rsync-auto not ignoring folders in exclusions lists, fail because of permissions issue

Open kamuridesu opened this issue 3 years ago • 1 comments

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

  1. have a folder with only root permission
  2. add it to the exclusion list
  3. try to use rsync-auto
  4. 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

kamuridesu avatar Sep 29 '22 20:09 kamuridesu

It seems to be related: https://github.com/hashicorp/vagrant/issues/4248#issuecomment-91232058

kamuridesu avatar Sep 29 '22 20:09 kamuridesu

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.

soapy1 avatar Jan 18 '23 18:01 soapy1

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

soapy1 avatar Jan 20 '23 00:01 soapy1

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.

soapy1 avatar Feb 08 '23 20:02 soapy1