1
0
forked from pool/virtualbox

Accepting request 789598 from home:lwfinger:branches:Virtualization

- Fix build errors for gcc-10 (boo#1167897). File "fixes_for_gcc10.patch" is
  added.
- Convert /usr/bin/VirtualBox to use "~/.config/VirtualBox" instead "~/.vbox".
  This change was requested in boo#1167660.

OBS-URL: https://build.opensuse.org/request/show/789598
OBS-URL: https://build.opensuse.org/package/show/Virtualization/virtualbox?expand=0&rev=543
This commit is contained in:
Larry Finger 2020-03-30 04:53:46 +00:00 committed by Git OBS Bridge
parent 243616fc78
commit d8ce0b3983
7 changed files with 92 additions and 25 deletions

View File

@ -63,3 +63,4 @@ Index: VirtualBox-6.1.4/src/VBox/Additions/x11/VBoxClient/clipboard.cpp
#ifdef VBOX_WITH_SHARED_CLIPBOARD_FUSE
int rc2 = vboxClipboardFUSEStop();

45
fixes_for_gcc10.patch Normal file
View File

@ -0,0 +1,45 @@
Index: VirtualBox-6.1.4/Config.kmk
===================================================================
--- VirtualBox-6.1.4.orig/Config.kmk
+++ VirtualBox-6.1.4/Config.kmk
@@ -2684,8 +2684,16 @@ else
# The reason for this hack is that the windows kmk_ash cannot deal with $((1+1)).
# Some versions of gcc (e.g. openSUSE11) return only major.minor on `gcc -dumpversion`.
# gcc-5 of openSUSE42.1 only returns the major version on `gcc -dumpversion`!
- VBOX_GCC_VERSION = $(shell ($(1) -dumpfullversion 2>/dev/null || $(1) -dumpversion) | \
- $(SED_EXT) 's|\([0-9]\)\.\{0,1\}\([0-9]\{0,1\}\)\.\{0,1\}\([0-9]\{0,1\}\).*|$$(int-add $$(int-mul 10000, \1), $$(int-mul 100, $$(firstword \2 0)), $$(firstword \3 0))|' )
+ #
+ # Check to make sure that the compiler has either -dumpfullversion or -dumpversion. gcc-10 has neither
+ RC = $(shell ($(1) -dumpfullversion 2>/dev/null || $(1) -dumpversion 2>/dev/null) ; echo $$?)
+ ifneq ($(RC),0)
+ # dump version commands not available - hardcode 10.0.1 for the moment
+ VBOX_GCC_VERSION = 100001
+ else
+ VBOX_GCC_VERSION = $(shell ($(1) -dumpfullversion 2>/dev/null || $(1) -dumpversion 2>/dev/null) | \
+ $(SED_EXT) 's|\([0-9]\)\.\{0,1\}\([0-9]\{0,1\}\)\.\{0,1\}\([0-9]\{0,1\}\).*|$$(int-add $$(int-mul 10000, \1), $$(int-mul 100, $$(firstword \2 0)), $$(firstword \3 0))|' )
+ endif
endif
# YASM macros
ifndef DONT_USE_YASM
Index: VirtualBox-6.1.4/include/iprt/formats/mach-o.h
===================================================================
--- VirtualBox-6.1.4.orig/include/iprt/formats/mach-o.h
+++ VirtualBox-6.1.4/include/iprt/formats/mach-o.h
@@ -38,7 +38,7 @@
/* cputype */
#define CPU_ARCH_MASK INT32_C(0xff000000)
#define CPU_ARCH_ABI64 INT32_C(0x01000000)
-#define CPU_TYPE_ANY INT32_C(-1)
+#define CPU_TYPE_ANY INT32_C(999)
#define CPU_TYPE_VAX INT32_C(1)
#define CPU_TYPE_MC680x0 INT32_C(6)
#define CPU_TYPE_X86 INT32_C(7)
@@ -53,7 +53,7 @@
#define CPU_TYPE_POWERPC64 (CPU_TYPE_POWERPC | CPU_ARCH_ABI64)
/* cpusubtype */
-#define CPU_SUBTYPE_MULTIPLE INT32_C(-1)
+#define CPU_SUBTYPE_MULTIPLE -1
#define CPU_SUBTYPE_LITTLE_ENDIAN INT32_C(0)
#define CPU_SUBTYPE_BIG_ENDIAN INT32_C(1)

View File

@ -1,8 +1,16 @@
Index: VirtualBox-5.1.4/Config.kmk
Index: VirtualBox-6.1.4/Config.kmk
===================================================================
--- VirtualBox-5.1.4.orig/Config.kmk
+++ VirtualBox-5.1.4/Config.kmk
@@ -4852,6 +4852,9 @@ TEMPLATE_VBOXR3HARDENEDEXE_LDFLAGS.darwi
--- VirtualBox-6.1.4.orig/Config.kmk
+++ VirtualBox-6.1.4/Config.kmk
@@ -2687,7 +2687,6 @@ else
VBOX_GCC_VERSION = $(shell ($(1) -dumpfullversion 2>/dev/null || $(1) -dumpversion) | \
$(SED_EXT) 's|\([0-9]\)\.\{0,1\}\([0-9]\{0,1\}\)\.\{0,1\}\([0-9]\{0,1\}\).*|$$(int-add $$(int-mul 10000, \1), $$(int-mul 100, $$(firstword \2 0)), $$(firstword \3 0))|' )
endif
-
# YASM macros
ifndef DONT_USE_YASM
include $(KBUILD_PATH)/tools/YASM.kmk
@@ -5533,6 +5532,9 @@ TEMPLATE_VBOXR3HARDENEDEXE_LDFLAGS.darwi
ifeq ($(KBUILD_TARGET),linux)
# not necessary except USE_LIB_PCAP is defined in SUPR3HardenedMain.cpp
# TEMPLATE_VBOXR3HARDENEDEXE_LIBS += cap
@ -12,7 +20,7 @@ Index: VirtualBox-5.1.4/Config.kmk
endif
ifeq ($(KBUILD_TARGET),win) # No CRT!
TEMPLATE_VBOXR3HARDENEDEXE_SDKS = VBOX_NTDLL $(TEMPLATE_VBOXR3EXE_SDKS)
@@ -4871,8 +4874,8 @@ ifeq ($(KBUILD_TARGET),win) # No CRT!
@@ -5554,8 +5556,8 @@ ifeq ($(KBUILD_TARGET),win) # No CRT!
TEMPLATE_VBOXR3HARDENEDEXE_LIBS.amd64 = $(NOT_SUCH_VARIABLE)
else ifn1of ($(KBUILD_TARGET), os2 solaris)
# We want to keep the RPATH on Solaris to be able to find libgcc_1/libstdc++ within $(VBOX_WITH_RUNPATH)

View File

@ -55,21 +55,21 @@ Index: VirtualBox-5.1.22/src/apps/VBoxUSB_DevRules/VBoxUSB_DevRules.cpp
+#include <QtWidgets/QPushButton>+
+int main(int argc, char *argv[])
+{
+ QApplication app(argc, argv);
+ QMessageBox msgBox;
+ QApplication app(argc, argv);
+ QMessageBox msgBox;
+ QPushButton *myYesButton = msgBox.addButton("Enable", QMessageBox::YesRole);
+ QPushButton *myNoButton = msgBox.addButton("Disable", QMessageBox::NoRole);
+ msgBox.setWindowTitle(QObject::tr("USB Rules and Permissions !"));
+ msgBox.setText(QObject::tr("USB passthrough requires read/write access to USB devices. "
+ msgBox.setText(QObject::tr("USB passthrough requires read/write access to USB devices. "
+ "As a result, it opens a security hole.\n\n"
+ "Nonetheless, this feature is extremely useful and it may be worth the security risk. "
+ "Thus the code defaults to enabling it.\n\nIf you agree that the risk is acceptable, then click 'Enable'.\n"
+ "You will not be asked this question again when VB is updated. If you later change your mind, run 'rm ~/.vbox/*'\n\n"
+ "You should not be asked this question again when VB is updated. If you later change your mind, run 'rm ~/.config/virtualbox/*'\n\n"
+ "If you wish to disable USB passthrough to plug the security hole, then click 'Disable'. "
+ "You will be asked for the system password, and /etc/udev/rules.d/60-vboxdrv.rules will be changed.\n\n"
+ "These changes cannot be preserved through VB updates, thus this screen will be displayed again at that time."));
+ "These changes may not be preserved through VB updates, thus this screen may be displayed again at that time."));
+ msgBox.exec();
+ app.quit();
+ app.quit();
+ if (msgBox.clickedButton() == myYesButton)
+ return 0;
+ return 1;

View File

@ -6,8 +6,8 @@ export QT_NO_KDE_INTEGRATION=1
#
# Handle the issue regarding USB passthru
# The following conditions apply:
# 1. If ~/.vbox/enable exists, the user accepts the security risk.
# 2. If ~/.vbox/disable exists, the user does not accept the risk. That file will contain the inode of /usr/lib/udev/rules.d/60-vboxdrv.rules.
# 1. If ~/.config/VirtualBox/enable exists, the user accepts the security risk.
# 2. If ~/.config/VirtualBox/disable exists, the user does not accept the risk. That file will contain the inode of /usr/lib/udev/rules.d/60-vboxdrv.rules.
# When that changes, the VBoxUSB_DevRules will again be displayed as that means that VB has been reloaded.
#
devrules()
@ -15,38 +15,40 @@ devrules()
/usr/lib/virtualbox/VBoxUSB_DevRules
if [ $? -eq 0 ] ; then
# User accepts the risk
touch ~/.vbox/enable
rm -f ~/.vbox/disable
touch ~/.config/VirtualBox/enable
rm -f ~/.config/VirtualBox/disable
else
# User declines the risk - save the inode
echo "" > ~/.vbox/disable
rm -f ~/.vbox/enable
echo "" > ~/.config/VirtualBox/disable
rm -f ~/.config/VirtualBox/enable
fi
}
# Start of main routine
#
# Ensure that ~/.vbox exists
mkdir -p ~/.vbox/
# Ensure that ~/.config/VirtualBox exists
mkdir -p ~/.config/VirtualBox
# Originally, this information was in ~/.vbox. Remove any files found there
rm -rf ~/.vbox
# Get the inode for /usr/lib/udev/rules.d/60-vboxdrv.rules
INODE=$(stat /usr/lib/udev/rules.d/60-vboxdrv.rules | grep Inode | cut -d' ' -f3)
if [ ! -f ~/.vbox/enable ] && [ ! -f ~/.vbox/disable ] ; then
if [ ! -f ~/.config/VirtualBox/enable ] && [ ! -f ~/.config/VirtualBox/disable ] ; then
# Neither file exists - find what the user wants
devrules
fi
# Get the original Inode if it exists
if [ -f ~/.vbox/disable ] ; then
read LINE < ~/.vbox/disable
if [ -f ~/.config/VirtualBox/disable ] ; then
read LINE < ~/.config/VirtualBox/disable
else
LINE=" "
fi
# If user originally declined, make certain that /usr/lib/udev/rules.d/60-vboxdrv.rules has not been changed
if [ -f ~/.vbox/disable ] && [ "$LINE" != "$INODE" ] && [ "$LINE" != "" ] ; then
if [ -f ~/.config/VirtualBox/disable ] && [ "$LINE" != "$INODE" ] && [ "$LINE" != "" ] ; then
# disable is selected and the Inode has changed - ask again
devrules
fi
if [ -f ~/.vbox/disable ] ; then
echo $INODE > ~/.vbox/disable
if [ -f ~/.config/VirtualBox/disable ] ; then
echo $INODE > ~/.config/VirtualBox/disable
if [ "$LINE" != "$INODE" ] ; then
if [ -f /usr/bin/kdesu ] ; then
kdesu /sbin/vbox-fix-usb-rules.sh

View File

@ -1,3 +1,11 @@
-------------------------------------------------------------------
Sun Mar 29 19:20:48 UTC 2020 - Larry Finger <Larry.Finger@gmail.com>
- Fix build errors for gcc-10 (boo#1167897). File "fixes_for_gcc10.patch" is
added.
- Convert /usr/bin/VirtualBox to use "~/.config/VirtualBox" instead "~/.vbox".
This change was requested in boo#1167660.
-------------------------------------------------------------------
Fri Mar 27 09:32:21 UTC 2020 - Antonio Larrosa <alarrosa@suse.com>

View File

@ -156,6 +156,8 @@ Patch135: fixes_for_5.6.patch
Patch136: VirtualBox-6.1.4-VBoxClient-vmsvga-x11-crash.patch
# Fix build for Qt 5.15
Patch137: fix-missing-includes-with-qt-5.15.patch
# Fix builds with GCC10
Patch138: fixes_for_gcc10.patch
Patch999: virtualbox-fix-ui-background-color.patch
#
BuildRequires: LibVNCServer-devel
@ -463,6 +465,7 @@ as an "extpack" for VirtualBox. The implementation is licensed under GPL.
%endif
%patch136 -p1
%patch137 -p1
%patch138 -p1
# make VB UI background colors look sane again
%patch999 -p1