dustymabe / vagrant-sshfs

SSHFS synced folder implementation for Vagrant.
GNU General Public License v2.0
225 stars 33 forks source link

Directories on guest don't get created #94

Closed girtsf closed 2 years ago

girtsf commented 6 years ago

Vagrant documentation (https://www.vagrantup.com/docs/synced-folders/basic_usage.html) says "The second parameter must be an absolute path of where to share the folder within the guest machine. This folder will be created (recursively, if it must) if it does not exist." This to me implies that sshfs would take the same approach.

I'm using vagrant-sshfs in reverse mode: config.vm.synced_folder "devel", "/home/vagrant/devel", type: "sshfs", reverse: true, create: true

When I do vagrant up, it blows up on the mount:

==> default: Machine booted and ready!
==> default: Checking for guest additions in VM...
    default: The guest additions on this VM do not match the installed version of
    default: VirtualBox! In most cases this is fine, but in rare cases it can
    default: prevent things such as shared folders from working properly. If you see
    default: shared folder errors, please make sure the guest additions within the
    default: virtual machine match the version of VirtualBox you have installed on
    default: your host and reload your VM.
    default:
    default: Guest Additions Version: 5.2.8
    default: VirtualBox Version: 5.1
==> default: Mounting SSHFS shared folder...
==> default: mounting folder via SSHFS: guestpath:/home/vagrant/devel => hostpath:/Users/girts/work/software-dev/devel
==> default: Checking Mount..
==> default: Checking Mount..
==> default: Checking Mount..
==> default: Checking Mount..
==> default: Checking Mount..
==> default: Checking Mount..
==> default: Checking Mount..
Mounting SSHFS shared folder via reverse SSHFS mount failed. Please
look at the below output from from the processes that were run.

SSHFS command output:

vagrant@127.0.0.1:/home/vagrant/devel: No such file or directory

Should vagrant-sshfs create directories in guest to match up with what built-in synced folders do?

dustymabe commented 6 years ago

I guess it depends on how you look at it. For a reverse mount you are sharing a folder from the guest back into the host. It seems odd to me to share a folder that doesn't yet exist (i.e. has no content) back to the host. Then again Vagrant boxes are typically ephemeral, so maybe you could make an argument for creating it if it doesn't exist. I don't know.

girtsf commented 6 years ago

My use case: I check out git repos inside guest, and do builds from the guest. I want to make the files available for editing from the host. Doing it the other way makes the builds really slow, but slight latency when editing one file at a time doesn't really matter. My current workaround is to add disabled: true, do the initial vagrant up (which will create and checkout the git repos), then re-enable the synced folder. Alternatively, I could build my own box that has the shared folder already created, but that seems like an overkill.

dustymabe commented 6 years ago

I'll probably try to address this in the next release.

girtsf commented 6 years ago

Thank you, appreciated!