The mount id is a file path which will contain forward slashes. A
previous attempt (although notably missing in the Linux host plugin) at
fixing this used `String.gsub` to escape the forward slashes; however,
the solution that eventually made its way into the 1.5 release uses
`Regexp.escape` which doesn't escape forward slashes.
The Ruby `Regexp.escape` method does not escape forward slashes because
they are not RE meta-characters; their special meaning is specific to
sed expressions as delimiters. To avoid the issue entirely, we can use
an alternative delimiter by prefixing the address expression with a
backslash with the desired delimiter character following.
Use control character (ASCII code point `0x01`) as expression delimiter
so it is very unlikely an identifier will have a conflicting character
within it.
With a synced folder configuration like so:
synced_folder ".", "/vagrant", :nfs => true
synced_folder "#{ENV['HOME']}/mirror", "/mirror", :nfs => true
synced_folder ENV['HOME'], "/home/#{ENV['USER']}", :nfs => true
on OSX, vagrant writes two overlapping exports to /etc/exports
which then fail the export check.
Iterating through the list of folders lexically builds a correct, single
exports entry.
Signed-off-by: Teemu Matilainen <teemu.matilainen@iki.fi>
On my machine i had a case where /etc/exports was updated but the old
exports were still there. This was leading to
"exportfs: duplicated export entries" and eventually leading to nfs
being not available for the box.
changing the command exportfs -r to exportfs -ar seems to address this
issue.
Signed-off-by: BlackEagle <ike.devolder@gmail.com>
In the case that NFS is already started on a Gentoo host, /etc/init.d/nfs start will not reload exports, but fail. /etc/init.d/nfs reload is known to fail for some esoteric configurations of /etc/exports, restart should be safe for existing connections.
mapall= and maproot= are mutually exclusive options. Currently, when trying to use maproot=, mapall= is getting automatically added, which prevents us from using the NFS mount. This change turns off the adding of mapall= if maproot= has been specified as an option.
@mitchellh, the internal encoding doesn't seem to work. Therefore,
I reverted that previous change to vagrant.rb.
However, I found two alternate solutions. Either transcoding,
`/etc/redhat-release` to ISO-8859-1 on open, or using something
like File.binread to transcode the file contents to raw.