[arch-commits] Commit in virtualbox/trunk (4 files)

Christian Hesse eworm at archlinux.org
Wed Apr 8 13:08:47 UTC 2020


    Date: Wednesday, April 8, 2020 @ 13:08:47
  Author: eworm
Revision: 612601

upgpkg: virtualbox 6.1.4-6

fix shared folder automount

Added:
  virtualbox/trunk/016-VBoxServiceAutoMount-Change-Linux-mount-code-to-use-.patch
Modified:
  virtualbox/trunk/PKGBUILD
Deleted:
  virtualbox/trunk/101-vboxsf-automount.patch
  virtualbox/trunk/mount.vboxsf

----------------------------------------------------------------+
 016-VBoxServiceAutoMount-Change-Linux-mount-code-to-use-.patch |  189 ++++++++++
 101-vboxsf-automount.patch                                     |   20 -
 PKGBUILD                                                       |   16 
 mount.vboxsf                                                   |   17 
 4 files changed, 194 insertions(+), 48 deletions(-)

Added: 016-VBoxServiceAutoMount-Change-Linux-mount-code-to-use-.patch
===================================================================
--- 016-VBoxServiceAutoMount-Change-Linux-mount-code-to-use-.patch	                        (rev 0)
+++ 016-VBoxServiceAutoMount-Change-Linux-mount-code-to-use-.patch	2020-04-08 13:08:47 UTC (rev 612601)
@@ -0,0 +1,189 @@
+From 369dd2ee3c82c4417fee04aeec933c74fd198e78 Mon Sep 17 00:00:00 2001
+From: Hans de Goede <hdegoede at redhat.com>
+Date: Tue, 23 Jan 2018 15:09:20 +0100
+Subject: [PATCH resend] VBoxServiceAutoMount: Change Linux mount code to use
+ an options string
+
+Signed-off-by: Hans de Goede <hdegoede at redhat.com>
+---
+ .../common/VBoxService/VBoxServiceAutoMount.cpp    | 62 +++-------------------
+ 1 file changed, 8 insertions(+), 54 deletions(-)
+
+diff --git a/src/VBox/Additions/common/VBoxService/VBoxServiceAutoMount.cpp b/src/VBox/Additions/common/VBoxService/VBoxServiceAutoMount.cpp
+--- ./src/VBox/Additions/common/VBoxService/VBoxServiceAutoMount.cpp.orig	2019-04-16 11:09:11.000000000 +0100
++++ ./src/VBox/Additions/common/VBoxService/VBoxServiceAutoMount.cpp	2019-04-26 17:10:47.178485356 +0100
+@@ -40,6 +40,7 @@
+ #include <iprt/ctype.h>
+ #include <iprt/dir.h>
+ #include <iprt/mem.h>
++#include <iprt/param.h>
+ #include <iprt/path.h>
+ #include <iprt/semaphore.h>
+ #include <iprt/sort.h>
+@@ -114,6 +115,9 @@ RT_C_DECLS_END
+ # define VBOXSERVICE_AUTOMOUNT_MIQF             SHFL_MIQF_PATH
+ #endif
+ 
++#ifndef MAX_MNTOPT_STR
++#define MAX_MNTOPT_STR PAGE_SIZE
++#endif
+ 
+ /*********************************************************************************************************************************
+ *   Structures and Typedefs                                                                                                      *
+@@ -400,13 +399,13 @@ static int vbsvcAutoMountSharedFolderOld
+     int rc = vbsvcAutoMountPrepareMountPointOld(pszMountPoint, pszShareName, &Opts);
+     if (RT_SUCCESS(rc))
+     {
++        char szOptBuf[MAX_MNTOPT_STR] = { '\0', };
++        RTStrPrintf(szOptBuf, sizeof(szOptBuf), "uid=%d,gid=%d,dmode=%0o,fmode=%0o,dmask=%0o,fmask=%0o",
++                    Opts.uid, Opts.gid, Opts.dmode, Opts.fmode, Opts.dmask, Opts.fmask);
+ # ifdef RT_OS_SOLARIS
+         int fFlags = 0;
+         if (Opts.ronly)
+             fFlags |= MS_RDONLY;
+-        char szOptBuf[MAX_MNTOPT_STR] = { '\0', };
+-        RTStrPrintf(szOptBuf, sizeof(szOptBuf), "uid=%d,gid=%d,dmode=%0o,fmode=%0o,dmask=%0o,fmask=%0o",
+-                    Opts.uid, Opts.gid, Opts.dmode, Opts.fmode, Opts.dmask, Opts.fmask);
+         int r = mount(pszShareName,
+                       pszMountPoint,
+                       fFlags | MS_OPTIONSTR,
+@@ -423,35 +422,11 @@ static int vbsvcAutoMountSharedFolderOld
+ 
+ # else /* RT_OS_LINUX */
+         unsigned long fFlags = MS_NODEV;
+-
+-        /*const char *szOptions = { "rw" }; - ??? */
+-        struct vbsf_mount_info_new mntinf;
+-        RT_ZERO(mntinf);
+-
+-        mntinf.nullchar     = '\0';
+-        mntinf.signature[0] = VBSF_MOUNT_SIGNATURE_BYTE_0;
+-        mntinf.signature[1] = VBSF_MOUNT_SIGNATURE_BYTE_1;
+-        mntinf.signature[2] = VBSF_MOUNT_SIGNATURE_BYTE_2;
+-        mntinf.length       = sizeof(mntinf);
+-
+-        mntinf.uid   = Opts.uid;
+-        mntinf.gid   = Opts.gid;
+-        mntinf.ttl   = Opts.ttl;
+-        mntinf.dmode = Opts.dmode;
+-        mntinf.fmode = Opts.fmode;
+-        mntinf.dmask = Opts.dmask;
+-        mntinf.fmask = Opts.fmask;
+-        mntinf.cMaxIoPages = Opts.cMaxIoPages;
+-        mntinf.szTag[0] = '\0';
+-
+-        strcpy(mntinf.name, pszShareName);
+-        strcpy(mntinf.nls_name, "\0");
+-
+         int r = mount(pszShareName,
+                       pszMountPoint,
+                       "vboxsf",
+                       fFlags,
+-                      &mntinf);
++                      szOptBuf);
+         if (r == 0)
+         {
+             VGSvcVerbose(0, "vbsvcAutoMountWorker: Shared folder '%s' was mounted to '%s'\n", pszShareName, pszMountPoint);
+@@ -484,34 +459,6 @@ static int vbsvcAutoMountSharedFolderOld
+         }
+         else /* r == -1, we got some error in errno.  */
+         {
+-            if (errno == EPROTO)
+-            {
+-                VGSvcVerbose(3, "vbsvcAutoMountWorker: Messed up share name, re-trying ...\n");
+-
+-                /** @todo r=bird: What on earth is going on here?????  Why can't you
+-                 *        strcpy(mntinf.name, pszShareName) to fix it again? */
+-
+-                /* Sometimes the mount utility messes up the share name.  Try to
+-                 * un-mangle it again. */
+-                char szCWD[RTPATH_MAX];
+-                size_t cchCWD;
+-                if (!getcwd(szCWD, sizeof(szCWD)))
+-                {
+-                    VGSvcError("vbsvcAutoMountWorker: Failed to get the current working directory\n");
+-                    szCWD[0] = '\0';
+-                }
+-                cchCWD = strlen(szCWD);
+-                if (!strncmp(pszMountPoint, szCWD, cchCWD))
+-                {
+-                    while (pszMountPoint[cchCWD] == '/')
+-                        ++cchCWD;
+-                    /* We checked before that we have enough space */
+-                    strcpy(mntinf.name, pszMountPoint + cchCWD);
+-                }
+-                r = mount(mntinf.name, pszMountPoint, "vboxsf", fFlags, &mntinf);
+-            }
+-            if (r == -1) /* Was there some error from one of the tries above? */
+-            {
+                 switch (errno)
+                 {
+                     /* If we get EINVAL here, the system already has mounted the Shared Folder to another
+@@ -530,7 +477,6 @@ static int vbsvcAutoMountSharedFolderOld
+                         rc = RTErrConvertFromErrno(errno);
+                         break;
+                 }
+-            }
+         }
+ # endif
+     }
+@@ -1464,51 +1410,21 @@ static int vbsvcAutomounterMountIt(PVBSV
+     }
+ 
+ #  if defined(RT_OS_LINUX)
+-    /*
+-     * Linux a bit more work...
+-     */
+-    struct vbsf_mount_info_new MntInfo;
+-    RT_ZERO(MntInfo);
+-    struct vbsf_mount_opts MntOpts;
+-    RT_ZERO(MntOpts);
+-    MntInfo.nullchar     = '\0';
+-    MntInfo.signature[0] = VBSF_MOUNT_SIGNATURE_BYTE_0;
+-    MntInfo.signature[1] = VBSF_MOUNT_SIGNATURE_BYTE_1;
+-    MntInfo.signature[2] = VBSF_MOUNT_SIGNATURE_BYTE_2;
+-    MntInfo.length       = sizeof(MntInfo);
+-    MntInfo.ttl          = MntOpts.ttl              = -1 /*default*/;
+-    MntInfo.msDirCacheTTL= MntOpts.msDirCacheTTL    = -1 /*default*/;
+-    MntInfo.msInodeTTL   = MntOpts.msInodeTTL       = -1 /*default*/;
+-    MntInfo.cMaxIoPages  = MntOpts.cMaxIoPages      = 0 /*default*/;
+-    MntInfo.cbDirBuf     = MntOpts.cbDirBuf         = 0 /*default*/;
+-    MntInfo.enmCacheMode = MntOpts.enmCacheMode     = kVbsfCacheMode_Default;
+-    MntInfo.uid          = MntOpts.uid   = 0;
+-    MntInfo.gid          = MntOpts.gid   = gidMount;
+-    MntInfo.dmode        = MntOpts.dmode = 0770;
+-    MntInfo.fmode        = MntOpts.fmode = 0770;
+-    MntInfo.dmask        = MntOpts.dmask = 0000;
+-    MntInfo.fmask        = MntOpts.fmask = 0000;
+-    memcpy(MntInfo.szTag, g_szTag, sizeof(g_szTag)); AssertCompile(sizeof(MntInfo.szTag) >= sizeof(g_szTag));
+-    rc = RTStrCopy(MntInfo.name, sizeof(MntInfo.name), pEntry->pszName);
+-    if (RT_FAILURE(rc))
++    unsigned long fFlags = MS_NODEV;
++    char szOpts[MAX_MNTOPT_STR] = { '\0', };
++    ssize_t cchOpts = RTStrPrintf2(szOpts, sizeof(szOpts),
++                                   "uid=0,gid=%d,dmode=0770,fmode=0770,dmask=0000,fmask=0000", gidMount);
++    if (cchOpts <= 0)
+     {
+-        VGSvcError("vbsvcAutomounterMountIt: Share name '%s' is too long for the MntInfo.name field!\n", pEntry->pszName);
+-        return rc;
++        VGSvcError("vbsvcAutomounterMountIt: szOpts overflow! %zd\n", cchOpts);
++        return VERR_BUFFER_OVERFLOW;
+     }
+ 
+-    errno = 0;
+-    unsigned long fFlags = MS_NODEV;
+-    rc = mount(pEntry->pszName, pEntry->pszActualMountPoint, "vboxsf", fFlags, &MntInfo);
++    rc = mount(pEntry->pszName, pEntry->pszActualMountPoint, "vboxsf", fFlags, szOpts);
+     if (rc == 0)
+     {
+         VGSvcVerbose(0, "vbsvcAutomounterMountIt: Successfully mounted '%s' on '%s'\n",
+                      pEntry->pszName, pEntry->pszActualMountPoint);
+-
+-        errno = 0;
+-        rc = vbsfmount_complete(pEntry->pszName, pEntry->pszActualMountPoint, fFlags, &MntOpts);
+-        if (rc != 0) /* Ignorable. /etc/mtab is probably a link to /proc/mounts. */
+-            VGSvcVerbose(1, "vbsvcAutomounterMountIt: vbsfmount_complete failed: %s (%d/%d)\n",
+-                         rc == 1 ? "open_memstream" : rc == 2 ? "setmntent" : rc == 3 ? "addmntent" : "unknown", rc, errno);
+         return VINF_SUCCESS;
+     }
+     else if (errno == EINVAL)

Deleted: 101-vboxsf-automount.patch
===================================================================
--- 101-vboxsf-automount.patch	2020-04-08 12:50:25 UTC (rev 612600)
+++ 101-vboxsf-automount.patch	2020-04-08 13:08:47 UTC (rev 612601)
@@ -1,20 +0,0 @@
-This ghetto patch attempts to fix shared folder automounting for guests running
-Linux 4.16, and also suggests an alternative to mount.vboxsf.
-
-diff -uprb VirtualBox-5.2.8.orig/src/VBox/Additions/common/VBoxService/VBoxServiceAutoMount.cpp VirtualBox-5.2.8/src/VBox/Additions/common/VBoxService/VBoxServiceAutoMount.cpp
---- VirtualBox-5.2.8.orig/src/VBox/Additions/common/VBoxService/VBoxServiceAutoMount.cpp	2018-02-26 17:57:30.000000000 +0200
-+++ VirtualBox-5.2.8/src/VBox/Additions/common/VBoxService/VBoxServiceAutoMount.cpp	2018-04-07 21:00:05.785735622 +0300
-@@ -346,6 +346,13 @@ static int vbsvcAutoMountSharedFolder(co
-                       "vboxsf",
-                       fFlags,
-                       &mntinf);
-+        if (r == -1 && errno == EINVAL)
-+        {
-+            /* Mainline vboxsf accepts regular mount opts. */
-+            char mount_opts[1024];
-+            snprintf(mount_opts, 1024, "gid=%d,dmode=0770,fmode=0770", mntinf.gid);
-+            r = mount(pszShareName, pszMountPoint, "vboxsf", fFlags, mount_opts);
-+        }
-         if (r == 0)
-         {
-             VGSvcVerbose(0, "vbsvcAutoMountWorker: Shared folder '%s' was mounted to '%s'\n", pszShareName, pszMountPoint);

Modified: PKGBUILD
===================================================================
--- PKGBUILD	2020-04-08 12:50:25 UTC (rev 612600)
+++ PKGBUILD	2020-04-08 13:08:47 UTC (rev 612601)
@@ -10,7 +10,7 @@
          'virtualbox-guest-utils-nox'
          'virtualbox-ext-vnc')
 pkgver=6.1.4
-pkgrel=5
+pkgrel=6
 _vboxsf_commit='5aba938bcabd978e4615186ad7d8617d633e6f30'
 arch=('x86_64')
 url='https://virtualbox.org/'
@@ -75,10 +75,7 @@
         '013-Makefile.patch'
         '014-vboxclient.patch'
         '015-linux-5.6.patch'
-        # The following patch and mount.vboxsf wrapper should be removed
-        # once support for mainline-style options string gets upstreamed
-        '101-vboxsf-automount.patch'
-        'mount.vboxsf')
+        '016-VBoxServiceAutoMount-Change-Linux-mount-code-to-use-.patch')
 sha256sums=('59f8f5774473f593e3eb5940e2a337e0674bcd9854164b2578fd43f896260c99'
             'SKIP'
             '76d98ea062fcad9e5e3fa981d046a6eb12a3e718a296544a68b66f4b65cb56db'
@@ -100,8 +97,7 @@
             'da7e58ed37dc23c6202aab3017864579a99e78417f3421ddcc98a198198fe2c9'
             'db617a3e7a3a94b96d5c3fe771d31c927242ef4f2cb265a22e4d5d64560a910a'
             '7787d241e4948866b0a3f33a45fc638665b4a3e83e64c33bdf085d0043732d6b'
-            'a784f3cc24652a16385cc63abac6c5178932ca5f3861be7650631b7dafa753a4'
-            'f3ed6741f8977f40900c8aa372fa082df1f8723d497d4fff445153c543bc8947')
+            '100c9e14e9cfb12ae65364e830153d2481cf272ceeb39d11c6b203bc6e35bf0c')
 
 prepare() {
     cd "VirtualBox-$pkgver"
@@ -339,8 +335,7 @@
     source "VirtualBox-$pkgver/env.sh"
     pushd "VirtualBox-$pkgver/out/linux.$BUILD_PLATFORM_ARCH/release/bin/additions"
     install -d "$pkgdir/usr/bin"
-    install -m0755 VBoxClient VBoxControl VBoxService "$srcdir/mount.vboxsf" "$pkgdir/usr/bin"
-    install -Dm0755 mount.vboxsf "$pkgdir/usr/lib/virtualbox/mount.vboxsf"
+    install -m0755 VBoxClient VBoxControl VBoxService "$pkgdir/usr/bin"
     install -m0755 -D "$srcdir"/VirtualBox-$pkgver/src/VBox/Additions/x11/Installer/98vboxadd-xclient \
         "$pkgdir"/usr/bin/VBoxClient-all
     install -m0644 -D "$srcdir"/VirtualBox-$pkgver/src/VBox/Additions/x11/Installer/vboxclient.desktop \
@@ -364,8 +359,7 @@
     source "VirtualBox-$pkgver/env.sh"
     pushd "VirtualBox-$pkgver/out/linux.$BUILD_PLATFORM_ARCH/release/bin/additions"
     install -d "$pkgdir/usr/bin"
-    install -m0755 VBoxControl VBoxService "$srcdir/mount.vboxsf" "$pkgdir/usr/bin"
-    install -Dm0755 mount.vboxsf "$pkgdir/usr/lib/virtualbox/mount.vboxsf"
+    install -m0755 VBoxControl VBoxService "$pkgdir/usr/bin"
     install -m0755 -D pam_vbox.so "$pkgdir/usr/lib/security/pam_vbox.so"
     popd
     # systemd stuff

Deleted: mount.vboxsf
===================================================================
--- mount.vboxsf	2020-04-08 12:50:25 UTC (rev 612600)
+++ mount.vboxsf	2020-04-08 13:08:47 UTC (rev 612601)
@@ -1,17 +0,0 @@
-#!/bin/bash
-
-# Hopefully this works as intented, supporting both pre-4.16 and newer kernels
-# https://bugs.archlinux.org/task/58272#comment168687
-
-kver_major=$(uname -r | cut -d. -f1)
-kver_minor=$(uname -r | cut -d. -f2)
-
-if ((kver_major * 100 + kver_minor < 416)); then
-	exec /usr/lib/virtualbox/mount.vboxsf "$@"
-fi
-
-# mount(1) annoyingly prepends the current directory to the source
-name=${1#$PWD/}; shift
-
-# Mainline vboxsf accepts regular mount opts
-exec /usr/bin/mount -cit vboxsf "$name" "$@"



More information about the arch-commits mailing list