From ee1b9cadf2521e4e82052266623c2f0c4f7b003098784b03716515fd00a7ec9e Mon Sep 17 00:00:00 2001 From: Larry Finger Date: Tue, 24 Mar 2020 02:06:06 +0000 Subject: [PATCH] Accepting request 787617 from home:lwfinger:branches:Virtualization - With version 6.1.4 of VB, the bidirectional clipboard part of VBoxClient for guest systems is failing. A patch is provided at https://www.virtualbox.org/ticket/19336. These changes have been added to file "VirtualBox-6.1.4-VBoxClient-vmsvga-x11-crash.patch". This fixes boo #1167403 "VBoxClient --clipboard dies". - Update the wrapper that starts the UI for VirtualBox to check the version of the extpack that is installed. If no pack is installed or if the license is not current, the new code does nothing. If there is a current license and the installed pack does not match the running version of VB, then the script downloads and installs the new version. File "update-extpack.sh" is added. OBS-URL: https://build.opensuse.org/request/show/787617 OBS-URL: https://build.opensuse.org/package/show/Virtualization/virtualbox?expand=0&rev=540 --- ...ox-6.1.4-VBoxClient-vmsvga-x11-crash.patch | 48 +++++++++++++- update-extpack.sh | 64 +++++++++++++++++++ virtualbox-wrapper.sh | 4 ++ virtualbox.changes | 19 ++++++ virtualbox.spec | 4 +- 5 files changed, 135 insertions(+), 4 deletions(-) create mode 100644 update-extpack.sh diff --git a/VirtualBox-6.1.4-VBoxClient-vmsvga-x11-crash.patch b/VirtualBox-6.1.4-VBoxClient-vmsvga-x11-crash.patch index e0dbd6e..4fb3e1a 100644 --- a/VirtualBox-6.1.4-VBoxClient-vmsvga-x11-crash.patch +++ b/VirtualBox-6.1.4-VBoxClient-vmsvga-x11-crash.patch @@ -1,6 +1,7 @@ -diff -up VirtualBox-6.1.4/src/VBox/Additions/x11/VBoxClient/display-svga-x11.cpp~ VirtualBox-6.1.4/src/VBox/Additions/x11/VBoxClient/display-svga-x11.cpp ---- VirtualBox-6.1.4/src/VBox/Additions/x11/VBoxClient/display-svga-x11.cpp~ 2020-02-18 18:13:08.000000000 +0100 -+++ VirtualBox-6.1.4/src/VBox/Additions/x11/VBoxClient/display-svga-x11.cpp 2020-03-03 16:27:49.947341705 +0100 +Index: VirtualBox-6.1.4/src/VBox/Additions/x11/VBoxClient/display-svga-x11.cpp +=================================================================== +--- VirtualBox-6.1.4.orig/src/VBox/Additions/x11/VBoxClient/display-svga-x11.cpp ++++ VirtualBox-6.1.4/src/VBox/Additions/x11/VBoxClient/display-svga-x11.cpp @@ -100,16 +100,19 @@ static void x11Connect(struct X11CONTEXT { XCloseDisplay(pContext->pDisplay); @@ -21,3 +22,44 @@ diff -up VirtualBox-6.1.4/src/VBox/Additions/x11/VBoxClient/display-svga-x11.cpp } pContext->rootWindow = DefaultRootWindow(pContext->pDisplay); } +Index: VirtualBox-6.1.4/src/VBox/Additions/x11/VBoxClient/clipboard.cpp +=================================================================== +--- VirtualBox-6.1.4.orig/src/VBox/Additions/x11/VBoxClient/clipboard.cpp ++++ VirtualBox-6.1.4/src/VBox/Additions/x11/VBoxClient/clipboard.cpp +@@ -215,7 +215,6 @@ DECLCALLBACK(void) ShClX11RequestFromX11 + * + * @returns VBox status code. + */ +-#if 0 + static int vboxClipboardConnect(void) + { + LogFlowFuncEnter(); +@@ -245,7 +244,6 @@ static int vboxClipboardConnect(void) + LogFlowFuncLeaveRC(rc); + return rc; + } +-#endif + + /** + * The main loop of our clipboard reader. +@@ -469,7 +467,7 @@ static int run(struct VBCLSERVICE **ppIn + RT_NOREF(ppInterface, fDaemonised); + + /* Initialise the guest library. */ +- int rc = 0; //vboxClipboardConnect(); ++ int rc = vboxClipboardConnect(); + if (RT_SUCCESS(rc)) + { + #ifdef VBOX_WITH_SHARED_CLIPBOARD_FUSE +@@ -477,9 +475,9 @@ static int run(struct VBCLSERVICE **ppIn + if (RT_SUCCESS(rc)) + { + #endif +- RTThreadSleep(60 * 1000); ++ // RTThreadSleep(60 * 1000); + +- //rc = vboxClipboardMain(); ++ rc = vboxClipboardMain(); + + #ifdef VBOX_WITH_SHARED_CLIPBOARD_FUSE + int rc2 = vboxClipboardFUSEStop(); diff --git a/update-extpack.sh b/update-extpack.sh new file mode 100644 index 0000000..355e8ea --- /dev/null +++ b/update-extpack.sh @@ -0,0 +1,64 @@ +#!/bin/bash + +# Script to update extpack +# The idea for this method and the original code came from Larry Len Rainey. +# +# This implementation by Larry Finger + +# Define some symbols and determine the current version of VB + +VBOXMANAGE=/usr/bin/VBoxManage +AWK=/usr/bin/awk +GREP=/usr/bin/grep +WGET=/usr/bin/wget +VBOX_VERSION=`$VBOXMANAGE --version | $AWK -F_ {'print $1'}` + +# Define a symbol for the name of the extpack matching the VB version +VBOX_EXT=`echo Oracle_VM_VirtualBox_Extension_Pack-${VBOX_VERSION}.vbox-extpack` + +# Full path to extpack license file +LICENSE_PATH="/usr/lib/virtualbox/ExtensionPacks/Oracle_VM_VirtualBox_Extension_Pack/ExtPack-license.rtf" + +# Determine the installed version of extpack, if any. +EXTPACK_CURRENT=`$VBOXMANAGE list extpacks | $GREP -A1 "Oracle VM VirtualBox Extension Pack" | $GREP Version | $AWK -F\ {'print $2'}` + +# The extpacks are licensed under a Personal Use and Evaluation License +# At some point, the user must agree to the conditions of that license. +# If no extpack is installed on this system, then there is no agreement, +# thus this script cannot install the extpack. +# +# This situation applies to new installations that could conform to the license, +# but more importantly, it handles commercial setups that have not purchased +# the necessary license. +# Check if extpack is currently installed. If not exit +if [ -z $EXTPACK_CURRENT ]; then + exit 0 +fi +# +# An extpack has been installed on this system. Now we need to check if +# it was issued under the current version of the license. + +#Note to maintainers: The "version 10" in the next command must be changed +# manually when Oracle revises the license. + +LICENSE_CHECK=`$GREP "version 10" $LICENSE_PATH | $AWK -F\ {'print $2'}` +if [ -z $LICENSE_CHECK ]; then +# New license version does not match the current installation. +# The user will need to agree to the new version, thus we do nothing here. + exit 0 +fi +if [ $VBOX_VERSION == $EXTPACK_CURRENT ]; then +# The extpack currently installed matches - we are done + exit 0 +fi + +# A new version of extpack is needed - switch to directory that can be written, and download it +pushd ~ > /dev/null 2>&1 +$WGET http://download.virtualbox.org/virtualbox/$VBOX_VERSION/$VBOX_EXT > /dev/null 2>&1 + +# Now install it +echo Y | $VBOXMANAGE extpack install --replace $VBOX_EXT > /dev/null 2>&1 + +# Clean up by deleting downloaded file and restoring the original working directory +rm -f $VBOX_EXT +popd ~ > /dev/null 2>&1 diff --git a/virtualbox-wrapper.sh b/virtualbox-wrapper.sh index 327867f..76da593 100644 --- a/virtualbox-wrapper.sh +++ b/virtualbox-wrapper.sh @@ -1,5 +1,6 @@ #!/bin/bash export QT_NO_KDE_INTEGRATION=1 + # make certain that the user/group combination is valid /usr/bin/id -nG | grep -v -e "root" -e "vboxusers" >/dev/null && /usr/lib/virtualbox/VBoxPermissionMessage && exit # @@ -22,6 +23,7 @@ devrules() rm -f ~/.vbox/enable fi } + # Start of main routine # # Ensure that ~/.vbox exists @@ -54,6 +56,8 @@ if [ -f ~/.vbox/disable ] ; then fi fi fi +# Check if extpack needs to be updated +/usr/bin/update-extpack.sh # Check that /usr/lib/virtualbox/VirtualBoxVM has SUID permissions PERM=$(ls -l /usr/lib/virtualbox/VirtualBoxVM | grep rwsr) if [ -z "$PERM" ] diff --git a/virtualbox.changes b/virtualbox.changes index 7493f0a..07ca330 100644 --- a/virtualbox.changes +++ b/virtualbox.changes @@ -1,3 +1,22 @@ +------------------------------------------------------------------- +Tue Mar 24 01:51:36 UTC 2020 - Larry Finger + +- With version 6.1.4 of VB, the bidirectional clipboard part of VBoxClient + for guest systems is failing. A patch is provided at + https://www.virtualbox.org/ticket/19336. These changes have been added + to file "VirtualBox-6.1.4-VBoxClient-vmsvga-x11-crash.patch". This + fixes boo #1167403 "VBoxClient --clipboard dies". + +------------------------------------------------------------------- +Sun Mar 22 20:36:40 UTC 2020 - Larry Finger + +- Update the wrapper that starts the UI for VirtualBox to check the + version of the extpack that is installed. If no pack is installed + or if the license is not current, the new code does nothing. If there + is a current license and the installed pack does not match the + running version of VB, then the script downloads and installs the + new version. File "update-extpack.sh" is added. + ------------------------------------------------------------------- Mon Mar 16 21:32:05 UTC 2020 - Larry Finger diff --git a/virtualbox.spec b/virtualbox.spec index a9fbadd..9217de9 100644 --- a/virtualbox.spec +++ b/virtualbox.spec @@ -67,6 +67,7 @@ Source3: %{name}-60-vboxguest.rules Source4: %{name}-default.virtualbox Source5: %{name}-kmp-files Source7: %{name}-kmp-preamble +Source8: update-extpack.sh Source9: %{name}-wrapper.sh Source10: %{name}-LocalConfig.kmk Source11: %{name}-60-vboxdrv.rules @@ -717,7 +718,7 @@ install -m 644 out/linux.*/release/bin/VBox.png %{buildroot}%{_datadir}/pixmaps/ install -m 644 %{SOURCE4} %{buildroot}%{_sysconfdir}/default/virtualbox #install wrapper script install -m 644 %{SOURCE9} %{buildroot}%{_bindir}/VirtualBox - +install -m 644 %{SOURCE8} %{buildroot}%{_bindir}/update-extpack.sh # Service files to load kernel modules on boot install -m 0644 %{SOURCE14} %{buildroot}%{_unitdir}/vboxdrv.service ln -s -f %{_sbindir}/service %{buildroot}%{_sbindir}/rcvboxdrv @@ -1004,6 +1005,7 @@ export DISABLE_RESTART_ON_UPDATE=yes %{_vbox_instdir}/VirtualBox #wrapper script is in bindir %attr(0755,root,root) %{_bindir}/VirtualBox +%attr(0755,root,root) %{_bindir}/update-extpack.sh #rules fixing script is in /sbin %attr(0755,root,root) /sbin/vbox-fix-usb-rules.sh #ldd shows libQt* dependency