The forum

"playonlinux --run" does not pass arguments correctly

Double spaces in file names get lost

Author Replies
hasi Monday 28 September 2009 at 17:20
hasiAnonymous

When I try to pass an argument to a program installed under PlayOnLinux, two subsequent spaces in an argument are converted into one space.
Example:

playonlinux --run Word2003 test\\\\\\ \\\\\\ 1.doc
When I intercept the script "~/.PlayOnLinux/configurations/installed/Word2003", I will find that one of the two spaces between "test" and "1.doc" is missing. Word cannot open the file correctly. It works if I directly pass the filename with two spaces to the script "~/.PlayOnLinux/configurations/installed/Word2003". Therefore the error must be in the way "playonlinux --run" handles arguments. The functionality of "playonlinux --run" works well if arguments containing one space are passed.

In my case, this prevented a program from correctly opening a file given as an argument.
Best,
hasi
Aymeric P. Monday 28 September 2009 at 18:01
Aymeric P.
Admin

Hi ?

Did you try to open your file like this:

playonlinux --run "test 1.doc"

This method should work.


Former member.
hasi Tuesday 29 September 2009 at 23:26
hasiAnonymous

MulX:

Your suggested fix does not work. Not to my surprise. How would playonlinux know which program to invoke? I am getting the error message "The program you want to run is not installed. : test 1.doc".

It appears that there is a problem with the way this PlayOnLinux forum web site handles escaping. It looks different in the preview than it looks in the actual post.

Let's try it in a different way. I tried to run the following command:
"playonlinux --run Word2003 test\\ \\ 1.doc"

Note that there are 2 spaces between "test" and "1.doc". (I am escaping the spaces here, as this is not a proportional font.

Best,
hasi
Aymeric P. Monday 5 October 2009 at 7:39
Aymeric P.
Admin

Indeed I forget the program name ...
Is this command line work ?
playonlinux --run Word2003 "test 1.doc"

Former member.
hasi Sunday 11 October 2009 at 14:28
hasiAnonymous

How would that be different from what I did? Whether the spaces are escaped with a backslash or with quotes does not make a difference in bash. I think I already proved that there is a bug in playonlinux. Try passing a file name with two subsequent spaces and you will probably see that it does not work correctly. What else can I do to make my point?
If you pass a file name with two spaces via "playonlinux --run", you will see that only one space gets passed to the playonlinux script that opens the installed application.
hasi Sunday 18 October 2009 at 3:04
hasiAnonymous

Since nobody here seems to care about this reproducible bug, I went ahead and tried to fix it myself. Definitely, the line with the bug is in the part that handles the "--run" option:
Arg=$(echo $@ | cut -b7-)A simple test will show that echoing $@ turns multiple spaces into single spaces. This leads to the problem described in my first posting in this thread. The problem can be fixed by introducing quotation marks as follows:
Arg=$(echo "$@" | cut -b7-)This preserves all spaces and removes the problem. I did a few tests, and it seemed to work well. However, I am actually not a very skilled bash programmer, nor am I very familiar with the specifics of the playonlinux project, so experts, please check this.
Thanks very much.
Best,
hasi
NSLW Sunday 18 October 2009 at 11:42
NSLW

Why use
playonlinux --run Word2003 test\\\\\\ \\\\\\ 1.docto open documents?

Isn't it better to

1) modify launcher to look something like this:
#!/bin/bash
PATH="$HOME/.PlayOnLinux/WineVersions/1.1.31/usr/bin/:$PATH"
export WINEPREFIX="$HOME/.PlayOnLinux/wineprefix/Office2007"
export WINEDEBUG="-all"
cd "$HOME/.PlayOnLinux/wineprefix/Office2007/drive_c/Program Files/Microsoft Office/Office12"
docname=${1##*/}
docpath=${1%/*}
cd "$docpath"
wine "$HOME/.PlayOnLinux/wineprefix/Office2007/drive_c/Program Files/Microsoft Office/Office12/WINWORD.EXE" "$docname"

It's Office 2007 example but will work also on Office 2003.

2) then choose "~/.PlayOnLinux/configurations/installed/Microsoft Office Word 2007" to open .doc files
hasi Sunday 18 October 2009 at 15:45
hasiAnonymous

@NSLW: Are you suggesting that I modify my launchers like this, or are you suggesting that all pol launchers will be modified for future deployments? I am not writing here to fix my problem (which I can take care of on my own). I am writing to improve PlayOnLinux. <br>
Of course, I can change launchers, and that's actually what I did when I found out that the "playonlinux --run" functionality is broken. Based, on your feedback, the correct consequence would be to retire the "--run" option of pol. If it is not to be retired, it should be fixed rather than be kept in a broken way. <br>
The reason I have been using it historically, is that when I got to know pol, I didn't know the details, and I didn't know the launcher scripts. However, I did find out about the "--run" functionality, and that's what I used.
NSLW Sunday 18 October 2009 at 17:31
NSLW

@NSLW: Are you suggesting that I modify my launchers like this, or are you suggesting that all pol launchers will be modified for future deployments?

Quote from hasi

I think it is impossible to use --run to open e.g. doc files in nautilus. I already modified Office 2007 launchers so no need to do this in this case.

Based, on your feedback, the correct consequence would be to retire the "--run" option of pol. If it is not to be retired, it should be fixed rather than be kept in a broken way. <br>

Quote from hasi

I cannot do neither of them directly.
hasi Sunday 18 October 2009 at 21:51
hasiAnonymous

Well, I simply wanted to point out that there is a reproducible bug in playonlinux, and I even came up with a fix. Someone more experienced has to check whether this fix is good, or if the quotation marks in the original code were left away for a reason which I do not know. <br>

When there is a bug in the documented functionality, it needs to be fixed in my opinion. Just stating "it does not work in nautilus anyway" is not enough. By the way, I don't care about nautilus, as I am a KDE user. I am just trying to help making pol as good as it can be.
NSLW Sunday 18 October 2009 at 22:06
NSLW

I am just trying to help making pol as good as it can be.

Quote from hasi

It's good but you'll understand that the one who has direct influence on next releases doesn't care about bug reported by you.
hasi Monday 19 October 2009 at 5:50
hasiAnonymous

OK, thank you. This will be my last interaction with the playonlinux project. <br>
I think this is really sloppy and unprofessional. I have interacted with several open source projects before, and something like this hasn't happened to me, yet: being told by project officials that they are not interested in my bug, although it is reproducible and although I have suggested a fix. In most other projects I know, the developers are interested in fixing bugs, and interested in creating applications that make users happy. <br>
I understand that I am not welcome here. <br>
Goodbye.
NSLW Monday 19 October 2009 at 9:05
NSLW

yet: being told by project officials that they are not interested in my bug

Quote from hasi

I didn't say I'm not interested but I've got the same little power as you in fixing that bug and because I know how here are bug fixed I share information about that with you.

I understand that I am not welcome here.

Quote from hasi

Nobody has said you're unwelcome here, certainly not me.
Quentin PÂRIS Tuesday 20 October 2009 at 20:35
Quentin PÂRIS
Admin

What did you say NSLW ?

Why should'nt I care about bugs reported by members ? I have simply no time at the moment because of my homeworks.

I'd like you not to speak for me ...
NSLW Wednesday 21 October 2009 at 10:37
NSLW

Why should'nt I care about bugs reported by members ?

Quote

Sorry, maybe I used wrong words. I should better say that you pay less attention to that.

I'd like you not to speak for me ...

Quote

Yes of course.
strider Sunday 13 December 2009 at 15:42
strider

This thread is simply awesome. Hasi, you are more than welcome to contribute on the Lutris project, any contribution or suggestion will receive high attention from me.
There is a decent bugtracker and source control system (Launchpad) and you are free to make your own branches. Any change made in your branches are very likely to be integrated in the main trunk.