Package: wine
Version: 1.6.2-19
Severity: normal
Tags: patch

Hi,

There are currently two issues with the /usr/bin/wine script:

a) On amd64 if fails when there more than one foreign-achitecture installed.
   For instance on my machine where I do a lot of cross-compiling from amd64
   to armhf and arm64:

        > dpkg --print-foreign-architectures
        i386
        armhf
        arm64
   which causes the existing foreign architecture test to fail.
   
b) The current script does not seamlessly handle both 32 and 64 bit binaries.
   Fortunately its trivial to add this support using file to detect whether
   the windows binary is 32 or 64 bit and then setting WINEPREFIX to either
   $HOME/.wine for 32 or $HOME/.wine64 for 64 bits.

Patch containing fixes for both these issues attached.

Cheers,
Erik

-- System Information:
Debian Release: 8.0
  APT prefers testing
  APT policy: (900, 'testing'), (800, 'unstable'), (500, 'testing-updates'), 
(500, 'experimental')
Architecture: amd64 (x86_64)
Foreign Architectures: i386, armhf, arm64

Kernel: Linux 3.16.0-4-amd64 (SMP w/4 CPU cores)
Locale: LANG=en_AU.UTF-8, LC_CTYPE=en_AU.UTF-8 (charmap=UTF-8) (ignored: LC_ALL 
set to en_AU.UTF-8)
Shell: /bin/sh linked to /bin/dash
Init: systemd (via /run/systemd/system)

Versions of packages wine depends on:
ii  file    1:5.20-2
ii  wine32  1.6.2-19
ii  wine64  1.6.2-19

wine recommends no packages.

Versions of packages wine suggests:
pn  avscan | klamav | clamav   <none>
ii  binfmt-support             2.1.5-1
ii  ttf-mscorefonts-installer  3.6
pn  winbind                    <none>

-- no debconf information
--- /usr/bin/wine	2015-01-11 05:40:21.000000000 +1100
+++ usr_bin_wine	2015-01-05 21:15:03.311892601 +1100
@@ -6,11 +6,22 @@
 wine32=$bindir/wine32
 wine64=$bindir/wine64
 
+if test -z "${WINEARCH}${WINEPREFIX}" ; then
+    if test $(file $1 | grep -c 'Intel 80386') -eq 1 ; then
+        WINEARCH=win32
+        WINEPREFIX=$HOME/.wine
+    elif test $(file $1 | grep -c 'x86-64') -eq 1 ; then
+        WINEARCH=win64
+        WINEPREFIX=$HOME/.wine64
+    fi
+fi
+
+
 if test -x $wine32 -a "$WINEARCH" != "win64"; then
     wine=$wine32
 elif test -x $wine64; then
     wine=$wine64
-    if [ "$(dpkg --print-architecture)" = "amd64" -a "$(dpkg --print-foreign-architectures)" != "i386" ]; then
+    if [ "$(dpkg --print-architecture)" = "amd64" -a "$(dpkg --print-foreign-architectures | grep -c "i386")" -ne 1 ]; then
         echo "it looks like multiarch needs to be enabled.  as root, please"
         echo "execute \"dpkg --add-architecture i386 && apt-get update &&"
         echo "apt-get install $(echo $name | sed s/wine/wine32/)\""

Reply via email to