Cardapio doesn't launch Wine applications correctly

Bug #603485 reported by Kazade
64
This bug affects 12 people
Affects Status Importance Assigned to Milestone
Cardapio
Fix Released
Low
Unassigned

Bug Description

Install a game under Wine, I've seen the bug with Ignition: http://www.abandonia.com/en/search_abandonia/ignition

When using Cardapio, I'm greeted with a "File not found" message from Wine, but when launched from the default Ubuntu menu the game works fine. It seems like an environment variable is not being set correctly.

Revision history for this message
Thiago Teixeira (tvst) wrote :

I can't seem to reproduce this bug. I installed that game and it launches fine for me.

Can you tell me what the Ignition command line is for you?

To find out, follow these steps:
1) Right-click on Cardapio and choose "Edit Menus"
2) Navigate to the launcher for Ignition
3) Select it and choose "Properties"
4) What does it say under "Command" ?

Revision history for this message
Kazade (kazade) wrote :

This is the command:

env WINEPREFIX="/home/luke/.wine" wine C:\\windows\\command\\start.exe /Unix /home/luke/.wine/dosdevices/c:/users/luke/Start\ Menu/Programs/UDS/Ignition.lnk

Oddly I can reproduce this on my desktop and laptop, it might be something to do with the Wine version I don't recall .desktop files using paths to the .lnk file before. I'm using Wine 1.2-rc6 available here: http://www.winehq.org/download/deb

Revision history for this message
Thiago Teixeira (tvst) wrote :

This is strange. On mine (version 1.1.42) it is:

env WINEPREFIX="/home/tvst/.wine" wine "C:\GAMES\IGNITION\Ign_win.exe"

and it works fine. How did you install the game?

Revision history for this message
Thiago Teixeira (tvst) wrote :

Also, please try the following lines in a terminal.

(I'm just testing some slightly different ways to escape the backslash)

$ python
>>> import subprocess
>>> import os
>>> subprocess.Popen(r'env WINEPREFIX="/home/luke/.wine" wine C:\\windows\\command\\start.exe /Unix /home/luke/.wine/dosdevices/c:/users/luke/Start\ Menu/Programs/UDS/Ignition.lnk', shell = True, cwd = os.path.expanduser('~'))

[what happens?]

>>> subprocess.Popen(r'env WINEPREFIX="/home/luke/.wine" wine C:\windows\command\start.exe /Unix /home/luke/.wine/dosdevices/c:/users/luke/Start\ Menu/Programs/UDS/Ignition.lnk', shell = True, cwd = os.path.expanduser('~'))

[what happens?]

>>> subprocess.Popen(r'env WINEPREFIX="/home/luke/.wine" wine C:\windows\command\\start.exe /Unix /home/luke/.wine/dosdevices/c:/users/luke/Start Menu/Programs/UDS/Ignition.lnk', shell = True, cwd = os.path.expanduser('~'))

[what happens?]

>>> subprocess.Popen(r'env WINEPREFIX="/home/luke/.wine" wine C:\\\\windows\\\\command\\\\start.exe /Unix /home/luke/.wine/dosdevices/c:/users/luke/Start\\ Menu/Programs/UDS/Ignition.lnk', shell = True, cwd = os.path.expanduser('~'))

[what happens?]

Revision history for this message
Kazade (kazade) wrote :

The first version works. The second errors out as wine can't find the executable. The third tries to start, but causes a Wine error.

I'm fairly sure this is a result of a recent change to wine since 1.1.42. .lnk files are the Windows shortcut files created by the programs installer, in 1.1.42 and below a .desktop file was created to mimic the Windows shortcut. (You'd see this in installers that would create desktop shortcuts, you'd end up with a .desktop and a .lnk file) In the version of Wine I have, it's actually calling the Windows shortcut itself.

Revision history for this message
Thiago Teixeira (tvst) wrote :

Weird. If the first version works, then this is a problem with the backslash. I am probably escaping it incorrectly in the code. I'll we what I can do...

Revision history for this message
Thiago Teixeira (tvst) wrote :

No, wait. I that's not right. I never do any escaping of the command string at any point, so that can't be it.

I'm having a lot of trouble reproducing this bug. I even changed my menu entry to point to

env WINEPREFIX="/home/tvst/.wine" wine "c:\\windows\\command\\start.exe" /Unix /home/tvst/.wine/dosdevices/c:/users/tvst/Start\ Menu/Programs/UDS/Ignition.lnk

and it still works! Which means that (at least in my case) it doesn't matter if points to a .lnk file or not.

So this must be related to the new version of Wine somehow. I will install it later and do some more debugging...

Thiago Teixeira (tvst)
Changed in cardapio:
status: New → Incomplete
Changed in cardapio:
importance: Undecided → Low
Revision history for this message
Anthony Stewart (madnessred) wrote :

I have the same issue with Spotify.

Error: File not found.
Command: wine "C:\Program Files\Spotify\spotify.exe"

If, however, I press Alt+F2 and type that, then it works fine.

And here is some python information if it helps.
python
>>> import subprocess, os
>>> subprocess.Popen(r'wine "C:\Program Files\Spotify\spotify.exe"', shell = True, cwd = os.path.expanduser('~'))
>>> fixme:toolhelp:CreateToolhelp32Snapshot Unimplemented: heap list snapshot

KeyboardInterrupt
>>> subprocess.Popen(r'wine "C:\\Program Files\\Spotify\\spotify.exe"', shell = True, cwd = os.path.expanduser('~'))
>>> fixme:toolhelp:CreateToolhelp32Snapshot Unimplemented: heap list snapshot

KeyboardInterrupt
>>> subprocess.Popen(r'wine "C:\\\\Program Files\\\\Spotify\\\\spotify.exe"', shell = True, cwd = os.path.expanduser('~'))
>>> fixme:toolhelp:CreateToolhelp32Snapshot Unimplemented: heap list snapshot

KeyboardInterrupt
>>> subprocess.Popen(r'wine C:\\Program Files\\Spotify\\spotify.exe', shell = True, cwd = os.path.expanduser('~'))
<subprocess.Popen object at 0x7fa77fff5f10>
>>> wine: cannot find 'C:\Program'

KeyboardInterrupt
>>> subprocess.Popen(r'wine C:\\Program\ Files\\Spotify\\spotify.exe', shell = True, cwd = os.path.expanduser('~'))
<subprocess.Popen object at 0x7fa77fff5ed0>
>>> fixme:toolhelp:CreateToolhelp32Snapshot Unimplemented: heap list snapshot

KeyboardInterrupt

All of those open the program as expected except
>>> wine: cannot find 'C:\Program'

If I use the standard menu it works fine as well.

Revision history for this message
Anthony Stewart (madnessred) wrote :

Follow up, I edited cardapio.py, and added this to the launch_raw function

print
print "subprocess.Popen(" + path + ", shell = True, cwd = " + self.home_folder_path + ")"
print

And this was the output:

subprocess.Popen(env WINEPREFIX="/home/anthony/.wine" wine C:\\\\windows\\\\command\\\\start.exe /Unix /home/anthony/.wine/dosdevices/c:/users/anthony/Start\\ Menu/Programs/Spotify.lnk, shell = True, cwd = /home/anthony)

Then in python and ran the following:

python
>>> import os,subprocess
>>> subprocess.Popen('env WINEPREFIX="/home/anthony/.wine" wine C:\\\\windows\\\\command\\\\start.exe /Unix /home/anthony/.wine/dosdevices/c:/users/anthony/Start\\ Menu/Programs/Spotify.lnk', shell = True, cwd = '/home/anthony')

And the program launched fine. I will keep digging and see what I can find out for you.

Revision history for this message
Anthony Stewart (madnessred) wrote :

ok, sorry about filling up the bug report, I can't find anyway to edit.
The errors we are getting are coming from WINE, a the launch_raw() function is returning True, and subprocess is not giving an exception.

The error which wine is giving is:

fixme:exec:SHELL_execute flags ignored: 0x00000100
Application could not be started, or no application associated with the specified file.
ShellExecuteEx failed: Success

On googleing I found the following that someone else was getting with wine:

sebastian@sebastian-laptop:~$ wine start 'C:\Program%Files\Alibre%Design\Program\Alibre%Design.exe'
fixme:exec:SHELL_execute flags ignored: 0x00000100
Application could not be started, or no application associated with the specified file.
ShellExecuteEx failed: Path not found

Which is the same error, and I saw something about removing % in the code.

Revision history for this message
Jan (jancborchardt-deactivatedaccount) wrote :

Great, just wanted to stop by to say thanks for helping. :)

Revision history for this message
Thiago Teixeira (tvst) wrote :

MadnessRed: First of all, thanks for helping us debug this.

Your comments seem to indicate that the issue is not with Cardapio, since:

1) Comment #9 shows that the line used by Cardapio executes just fine in a Python terminal
2) Cardapio's launch_raw returns True, implying that same line also executes fine within Cardapio

Plus, your error message "fixme:exec:SHELL_execute flags ignored: 0x00000100" is different from what Kazade experienced according to his bug report.

So, once again, I'm stumped. Which means we might as well start from the beginning, then:

1) What version of Wine are you running? Is this the stock Ubuntu 10.04 version?
2) Do you get a "File not found" error message, like Kazade talks about in his bug report?
3) Please post the following info: https://answers.launchpad.net/cardapio/+faq/1173

Thanks again!

Revision history for this message
Anthony Stewart (madnessred) wrote :

1) Wine 1.3.0
2) Yes
3) I have been using the run-in-window mode already, that how I got the terminal readout.
Here is the cardapio.log output: http://paste.ubuntu.com/486478/

Sorry for the delay in responding. Hope this helps.

Also an update, in Python this runs fine:
subprocess.Popen('env WINEPREFIX="/home/anthony/.wine" wine C:\\\\windows\\\\command\\\\start.exe /Unix /home/anthony/.wine/dosdevices/c:/users/anthony/Start\\ Menu/Programs/Spotify.lnk', shell = True, cwd = '/home/anthony')

However, with Alt+F2, this gives the File Not Found error.
env WINEPREFIX="/home/anthony/.wine" wine C:\\\\windows\\\\command\\\\start.exe /Unix /home/anthony/.wine/dosdevices/c:/users/anthony/Start\\ Menu/Programs/Spotify.lnk

The only things which could make a difference, as far as I can see are the shell = True or cwd = '/home/anthony'
If I change either of them, set shell to False, or cwd to '/' Then I get a file missing error in the terminal, not in a dialogue like I get from Cardapio or Alt + F2.

>>> subprocess.Popen('env WINEPREFIX="/home/anthony/.wine" wine C:\\\\windows\\\\command\\\\start.exe /Unix /home/anthony/.wine/dosdevices/c:/users/anthony/Start\\ Menu/Programs/Spotify.lnk', shell = False, cwd = '/home/anthony')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib/python2.6/subprocess.py", line 633, in __init__
    errread, errwrite)
  File "/usr/lib/python2.6/subprocess.py", line 1139, in _execute_child
    raise child_exception
OSError: [Errno 2] No such file or directory
>>> subprocess.Popen('env WINEPREFIX="/home/anthony/.wine" wine C:\\\\windows\\\\command\\\\start.exe /Unix /home/anthony/.wine/dosdevices/c:/users/anthony/Start\\ Menu/Programs/Spotify.lnk', shell = False, cwd = '/')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib/python2.6/subprocess.py", line 633, in __init__
    errread, errwrite)
  File "/usr/lib/python2.6/subprocess.py", line 1139, in _execute_child
    raise child_exception
OSError: [Errno 2] No such file or directory

Hope this helps.
MadnessRed

Revision history for this message
Anthony Stewart (madnessred) wrote :

Sorry, forgot to say, yes its Ubuntu 10.04, fully updated, the wine version comes from the Wine PPA.

Revision history for this message
Anthony Stewart (madnessred) wrote :

Just to let you know I will be away till Monday, but I will be happy to help when I get back.

Revision history for this message
Thiago Teixeira (tvst) wrote :

Thanks. I guess I'll just have to install the new Wine and see if I can reproduce the bug. Wish me luck :)

Revision history for this message
iCe (iceclow) wrote :

Same issue here, I have the latest wine from the wine ppa installed (1.3.3-0ubuntu1~lucidppa1) and when launching with Carpagio it raises the File Not Found Error from any of the links that start with "ENV WINEPREFIX"

Revision history for this message
Bernhard (b.a.koenig) wrote :

This problem had problems launching in cardapio: http://www.chessbase.de/download/cblight/index.asp

Revision history for this message
Bernhard (b.a.koenig) wrote :

*This program*

Revision history for this message
Jero (jbuencuerpo) wrote :

 I have wine 1.2 and the same error, not related with wine 1.3.

Revision history for this message
co0lingFir3 (coolingfire) wrote :

Same problem here with wine 1.2.1 and Cryptool:
Error: File not found

Revision history for this message
Thiago Teixeira (tvst) wrote :

Ok, I added some extra logging to Cardapio to try to fix this. Can you try the version from trunk and then post the log file here?

Trying trunk: https://answers.launchpad.net/cardapio/+faq/1352
Getting the log file: https://answers.launchpad.net/cardapio/+faq/1173

Revision history for this message
Felix Perez (felixalberto26) wrote : Re: [Bug 603485] Re: Cardapio doesn't launch Wine applications correctly

Following the bug, I noticed that launchers made by playonlinux worked well
in cardapio they had no errors and applications start without a hitch here's
Word's launcher

/usr/share/playonlinux/playonlinux --run "Microsoft Office Word 2007"

This works perfectly

Revision history for this message
Dmitry Litvin (litvin-dmitry) wrote :

Hi. I'm facing this bug with Wine 1.2.1 and different apps like MS Office 2003, Total Commander, etc.
What I tried to investigate is to catch a command line of the executed wine application. So, when starting from Cardapio, I got this:
$ps -ef | grep wine
...
dmitry 2365 1880 0 00:03 ? 00:00:00 /bin/sh -c env WINEPREFIX="/home/dmitry/.wine" wine C:\\\\windows\\\\command\\\\start.exe /Unix /home/dmitry/.wine/dosdevices/c:/users/dmitry/Start\\ Menu/Programs/Microsoft\\ Office/Microsoft\\ Office\\ InfoPath\\ 2003.lnk
...

I've also found out that such "double-escaped" command lines (with 4 backslashes) are really stored in Wine *.desktop files.

So I believe Cardapio, as a launcher application, should unescape any command obtained from *.desktop files before launching. We only face this problem with Wine just because any other "normal" *.desktop file doesn't have any backslashes in its "Exec" parameter. But for Windows-like paths, backslashes are mandatory, plus they have to be escaped with another backslashes, and Cardapio should handle this correctly.

P.S. I think when MadnessRed tested this command in Python console, Python itself unescaped the given string once before executing:
subprocess.Popen('env WINEPREFIX="/home/anthony/.wine" wine C:\\\\windows\\\\command\\\\start.exe /Unix /home/anthony/.wine/dosdevices/c:/users/anthony/Start\\ Menu/Programs/Spotify.lnk', shell = True, cwd = '/home/anthony')
But when the string is passed to this function as a variable, Python doesn't unescape it. At least I think so - I'm not a Python expert yet :)

Revision history for this message
Dmitry Litvin (litvin-dmitry) wrote :

I tried several approaches, and this hack helped:

def launch_raw(self, path, hide = True):
    ...
    subprocess.Popen(path.replace('\\\\','\\'), shell = True, cwd = self.home_folder_path)
    ...

I don't understand why, but self.unescape(path) which is equal to urllib2.unquote(path) - they both did not change the path variable :(
Though in Python console they work fine...

Revision history for this message
Dmitry Litvin (litvin-dmitry) wrote :

Here's a patch for cardapio.py version 0.9.156 (I just added one line):

def launch_raw(self, path, hide = True):
    ...
    path = path.replace('\\\\','\\')
    subprocess.Popen(path, shell = True, cwd = self.home_folder_path)
    ...

Revision history for this message
Thiago Teixeira (tvst) wrote :

Thanks for the help, Dmitry. I just committed that change to trunk, so please test it out and let me know if it works for you.

Trying trunk: https://answers.launchpad.net/cardapio/+faq/1352

I was a bit reluctant to add the change at first, as it's a bit of a hack, but decided that if it solves the problem then we might as well do it. So if anyone still experiences this bug or has a better idea about how to fix it, please post here.

Changed in cardapio:
status: Incomplete → Fix Committed
Revision history for this message
Dmitry Litvin (litvin-dmitry) wrote :

I totally agree that this is really a hack, but it helps.. If I find a way to unescape the string in a more correct way, I'll let you know.
And, the trunk version works fine for me, thank you.

Revision history for this message
Dmitry Litvin (litvin-dmitry) wrote :

Well, it looks like this method is more correct, and it works:

http://stackoverflow.com/questions/1885181/how-do-i-un-escape-a-backslash-escaped-string-in-python
http://www.velocityreviews.com/forums/t672000-unescape-escapes-in-strings.html

Both variants work fine:
    path = path.decode('string-escape')
or
    path = path.decode('string_escape')

Revision history for this message
Thiago Teixeira (tvst) wrote :

Good find! Trunk is now updated.

Revision history for this message
Patrick Gillespie (vermontpoet) wrote :

Same bug here. I'm decent with computers but not a hacker. To fix this problem, should I install the bleeding edge version (linked above) or wait for an update? Which makes more sense from the average Joe's perspective?

Revision history for this message
Thiago Teixeira (tvst) wrote :

You might as well just wait for an update. It's probably coming tomorrow night (with tons of bug fixes and new features!)

Revision history for this message
Dmitry Litvin (litvin-dmitry) wrote :

I've just made the following test: edited gnome menu and added the following launcher:
terminator -e "echo "\\\\" > ~/test.txt"

Being launched from generic Gnome Menu this simply creates a file in home folder with ONE backslash in it.
Previous version of Cardapio creates a file with TWO backslashes.
However, the fixed trunk version works correctly and creates a file with ONE backslash, so the bug existed and was fixed not only for Wine applications, but for all launchers.

Thanks again :)

Revision history for this message
Thiago Teixeira (tvst) wrote :

Dimitry: No, thank *you* for helping out :)

Patrick: The fix is now in the PPA. Just update Cardapio as usual.

Cheers.

Changed in cardapio:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Duplicates of this bug

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.