From a0543d7c7c8967115efb9c90e16670bf0aee5bd5 Mon Sep 17 00:00:00 2001 From: Mitchell Hashimoto Date: Wed, 17 Jul 2013 23:34:47 -0400 Subject: [PATCH] Use 32-bit integer for NFS fsuid for older kernels [GH-1127] --- CHANGELOG.md | 2 ++ lib/vagrant/action/builtin/nfs.rb | 10 ++++------ 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e3ca557b6..f4eb23a9b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,8 @@ BUG FIXES: - NFS exports with improper casing on Mac OS X work properly. [GH-1202] - Shared folders overriding '/vagrant' in multi-VM environments no longer all just use the last value. [GH-1935] + - NFS export fsid's are now 32-bit integers, rather than UUIDs. This + lets NFS exports work with Linux kernels older than 2.6.20. [GH-1127] ## 1.2.4 (July 16, 2013) diff --git a/lib/vagrant/action/builtin/nfs.rb b/lib/vagrant/action/builtin/nfs.rb index 2cd190987..b466fe290 100644 --- a/lib/vagrant/action/builtin/nfs.rb +++ b/lib/vagrant/action/builtin/nfs.rb @@ -1,6 +1,6 @@ -require 'digest/md5' require 'fileutils' require 'pathname' +require 'zlib' require "log4r" @@ -95,11 +95,9 @@ module Vagrant opts[:map_gid] = prepare_permission(:gid, opts) opts[:nfs_version] ||= 3 - # The poor man's UUID. An MD5 hash here is sufficient since - # we need a 32 character "uuid" to represent the filesystem - # of an export. Hashing the host path is safe because two of - # the same host path will hash to the same fsid. - opts[:uuid] = Digest::MD5.hexdigest(opts[:hostpath]) + # We use a CRC32 to generate a 32-bit checksum so that the + # fsid is compatible with both old and new kernels. + opts[:uuid] = Zlib.crc32(opts[:hostpath]).to_s end # Prepares the UID/GID settings for a single folder.