Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 19 Aug 2010 04:21:10 +0600
From:      "Alexander Stepanov" <core@metro-set.ru>
To:        gnome@FreeBSD.org
Subject:   sysutils/hal mount-fuse patch
Message-ID:  <1f0153df5fba480704bf79f4e54ac823.squirrel@dp.metro-set.ru>

next in thread | raw e-mail | index | archive | help
------=_20100819042110_50644
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: 8bit

Hi, gnome


Here is a trivial patch for mount-fuse to handle mountpoints with whitespaces.


-- 
Alexander Stepanov
METRO
------=_20100819042110_50644
Content-Type: text/x-patch; name="mount-fuse.patch"
Content-Transfer-Encoding: 8bit
Content-Disposition: attachment; filename="mount-fuse.patch"

--- mount-fuse	2009-04-10 00:18:27.000000000 +0600
+++ /sbin/mount_ntfs	2010-08-19 04:05:00.000000000 +0600
@@ -23,17 +23,20 @@
 HWDEV=""
 FOUNDDEV="0"
 
-for i in $@
+while [ -n "$1" ]
 do
+    i="$1"
+    shift
+
     if [ "$FOUNDOPT" = "1" ]
     then
-        OPTIONS="${OPTIONS} -o ${i}"
+        OPTIONS="${OPTIONS} -o \"${i}\""
     elif [ "${FOUNDU}" = "1" ]
     then
-        OPTIONS="${OPTIONS} -o uid=${i}"
+        OPTIONS="${OPTIONS} -o \"uid=${i}\""
     elif [ "${FOUNDG}" = "1" ]
     then
-        OPTIONS="${OPTIONS} -o gid=${i}"
+        OPTIONS="${OPTIONS} -o \"gid=${i}\""
     elif [ "${FOUNDBADARG}" = "1" ]
     then
         # We have an invalid argument flag, so ignore it and following argument
@@ -60,7 +63,7 @@
              OLDFUSE="${i}"
 
              # Lets get the *real* device name for FUSE helper
-             REALHWDEV="`cat ${FUSEDB} | grep ${i} | cut -d '=' -f 2`"
+             REALHWDEV="`cat ${FUSEDB} | grep \"${i}\" | cut -d '=' -f 2`"
 
              # Now lets change the string we will be saving
              i="${REALHWDEV}"
@@ -73,9 +76,9 @@
         fi
 
         # Add the value to our mount string if it isn't any invalid flag
-        if [ "${i}" != "-o" -a "${i}" != "-u" -a "${i}" != "-C" -a "${i}" != "-g" -a "${i}" != "-m" -a "${i}" != "-a" -a "${i}" != "-i" -a "${i}" -a "-W" ]
+        if [ "${i}" != "-o" -a "${i}" != "-u" -a "${i}" != "-C" -a "${i}" != "-g" -a "${i}" != "-m" -a "${i}" != "-a" -a "${i}" != "-i" -a "${i}" != "-W" ]
         then
-          MNTSTRING="${MNTSTRING} ${i}"
+          MNTSTRING="${MNTSTRING} \"${i}\""
         fi
 
     fi
@@ -124,7 +127,7 @@
 fi
 
 # Run the FUSE helper command now, with the options in the right order
-${FUSE_HELPER} ${FINALSTRING}
+eval ${FUSE_HELPER} ${FINALSTRING}
 
 # If we have an OLDFUSE variable, lets clear it from the list
 if [ ! -z "${OLDFUSE}" -a -e ${FUSEDB} ]
------=_20100819042110_50644--





Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?1f0153df5fba480704bf79f4e54ac823.squirrel>