brezerk / q4wine

Q4Wine is a Qt GUI for W.I.N.E. It will help you manage wine prefixes and installed applications.
http://q4wine.brezblock.org.ua/
GNU General Public License v3.0
204 stars 40 forks source link

Improper usage of WINEARCH env variable that is always part of %ENV_ARGS% #162

Open PhobosK opened 3 years ago

PhobosK commented 3 years ago

Putting always the Wine's WINEARCH env variable in the _%ENV_ARGS%_ is not a proper way of using it. As it is stated in wine's FAQ (and documentation) the WINEARCH should be used only when creating a new prefix. Once created the prefix cannot be changed, so any later usage of the env var is not proper - see here

This bug cannot be noticed on systems that allow (or have) only one Wine version installed, but on systems that allow (or have) several versions it causes problems, especially when the wine executable is suffixed. The problem is easily seen when using it with the WINELOADER env variable which is also a persistent variable in _%ENV_ARGS%_

For example: Gentoo allows installing several versions of Wine at the same time.

/usr/bin/wine -> /usr/bin/wine-staging-5.14
/usr/bin/wine64 -> /usr/bin/wine64-staging-5.14
/usr/bin/wine64-staging -> /usr/bin/wine64-staging-5.14
/usr/bin/wine64-staging-5.14
/usr/bin/wine64-vanilla -> /usr/bin/wine64-vanilla-5.0.1
/usr/bin/wine64-vanilla-5.0.1
/usr/bin/wine-staging -> /usr/bin/wine-staging-5.14
/usr/bin/wine-staging-5.14
/usr/bin/wine-vanilla -> /usr/bin/wine-vanilla-5.0.1
/usr/bin/wine-vanilla-5.0.1

q4wine supports this via Wine version manager, but it doesn't operate properly with the WINEARCH env variable, because it always adds it to the _%ENVARGS%. Thus in the above Gentoo example, if I have q4wine Wine version named Vanilla the command line will always be (when using the default template of q4wine):

/usr/bin/env  WINE='/usr/bin/wine-vanilla'  WINEPREFIX='/home/USER/prefix'  WINESERVER='/usr/bin/wineserver-vanilla'  WINELOADER='/usr/bin/wine-preloader-vanilla'  WINEDLLPATH=''  WINEARCH='win64'  WINEDEBUG='-all'  WINEDLLOVERRIDES=''  LANG=''  /bin/sh -c \"cd '/home/USER' && /usr/bin/nice -n 10 /usr/bin/wine-vanilla  explorer.exe /desktop=winecfg,800x600  'winecfg' -h 2>&1 \" "

which gives an error and totally breaks the q4wine usage:

/usr/lib64/wine-vanilla-5.0.1/bin/wine-vanilla64: could not open

This error is a Wine one because it adds the arch at the end of the binary name... But anyway the WINEARCH should not be used anywhere else besides creating new prefixes...

BTW in already existing q4wine prefixes the interface allows changing the architecture, which should not be allowed

Probably this case should also be considered when working on issue #140

Great app by the way :) and great work. Thanks :)

PhobosK commented 3 years ago

After further investigation I found out that the error /usr/lib64/wine-vanilla-5.0.1/bin/wine-vanilla64: could not open is actually caused by the WINELOADER env variable alone. This may be distro specific handling of this env variable, but still needs to be addressed... Usually the var is set automatically by Wine, so there is no need to be enforced in %ENV_ARGS% Anyway this doesn't invalidate this issue.

IMHO the way to address such Wine specifics is to add all the major wine env variables as separate template vars like for example %WINELOADER% etc, so the user can select from them in the prefix template and _%ENVARGS% to stay for all of them combined (as it is now)