using pre run scripts #49

Closed
nerijus opened this Issue Dec 23, 2014 · 21 comments

Projects

None yet

2 participants

@nerijus
nerijus commented Dec 23, 2014

I tried to add in Scripts->Pre run:
/usr/bin/fuseiso /path/to/image.iso /mnt/cdrom
but the image is not mounted. Although it is mounted when I execute this command in a terminal. Then I created a text file with the above command, pasted the command and made the file executable. If I add path to the script to Scripts->Pre run, it works. Could it be possible to make such mount command runnable without putting it into script?

@brezerk
Owner
brezerk commented Dec 23, 2014

well. In general, setting Pre run to "/usr/bin/fuseiso /path/to/image.iso /mnt/cdrom" should work.

    run_string.append(" /bin/sh -c \"");
    run_string.append(script_path);
    run_string.append("\" 2>&1");

So it will be converted to string like:

/bin/sh -c "/usr/bin/fuseiso /path/to/image.iso /mnt/cdrom"

Note, that if you are using quotes inside 'Pre run', it will break the logic.

Anyway I will need more details: Try to enable q4wine's logging subsystem, you should get the error message if 'Pre run' fails.

@nerijus
nerijus commented Dec 23, 2014

From the log:
App STDOUT and STDERR output:
/bin/sh: /usr/bin/fuseiso /mnt/d/Games/DidzLenkt.iso /mnt/cdrom: Toks failas ar aplankas neegzistuoja

it means file or directory does not exist.

@brezerk
Owner
brezerk commented Dec 24, 2014

hm. ok. can you show me full run string please? (should be displayed in log as well)

@nerijus
nerijus commented Dec 25, 2014

All output with LANG=C:
Exit code:
32512
App STDOUT and STDERR output:
/bin/sh: /usr/bin/fuseiso /mnt/d/Games/DidzLenkt.iso /mnt/cdrom: No such file or directory

But, when I run /usr/bin/fuseiso /mnt/d/Games/DidzLenkt.iso /mnt/cdrom or /bin/sh -c "/usr/bin/fuseiso /mnt/d/Games/DidzLenkt.iso /mnt/cdrom" from the terminal, it works.

@nerijus
nerijus commented Dec 25, 2014

I modified the source to output run_string too:

--- wineobject.cpp.orig 2013-12-16 23:02:55.000000000 +0200
+++ wineobject.cpp  2014-12-25 13:39:12.045774874 +0200
@@ -390,6 +390,10 @@
             stdout.append("\n");
             stdout.append(QString("%1").arg(status));
             stdout.append("\n");
+            stdout.append("Run string:");
+            stdout.append("\n");
+            stdout.append(run_string);
+            stdout.append("\n");
             stdout.append("App STDOUT and STDERR output:");
             stdout.append("\n");
             stdout.append(app_stdout);

The log output is:
Exit code:
32512
Run string:
env WINEPREFIX='/home/user/.wine' WINESERVER='/usr/bin/wineserver' WINELOADER='/usr/bin/wine' WINEDLLPATH='' /bin/sh -c "'/usr/bin/fuseiso /mnt/d/Games/DidzLenkt.iso /mnt/cdrom'" 2>&1
App STDOUT and STDERR output:
/bin/sh: /usr/bin/fuseiso /mnt/d/Games/DidzLenkt.iso /mnt/cdrom: No such file or directory

@nerijus
nerijus commented Dec 25, 2014

The version is from Fedora 21 - q4wine-1.1-5.r2.fc21.i686

@brezerk
Owner
brezerk commented Dec 25, 2014

yep. I see.

 /bin/sh -c "'/usr/bin/fuseiso /mnt/d/Games/DidzLenkt.iso /mnt/cdrom'"
/bin/sh: /usr/bin/fuseiso /mnt/d/Games/DidzLenkt.iso /mnt/cdrom: No such file or directory
 /bin/sh -c "/usr/bin/fuseiso /mnt/d/Games/DidzLenkt.iso /mnt/cdrom"
Can`t open image file: No such file or directory
@brezerk
Owner
brezerk commented Dec 25, 2014

So the problem that there are double quotes... Let me take a look on source code.

@brezerk
Owner
brezerk commented Dec 25, 2014

Yeah. It seems to be safe to remove " quotes in 378-380 lines:

    run_string.append(" /bin/sh -c ");
    run_string.append(script_path);
    run_string.append(" 2>&1");

Fixed in trunk: e3c6e5e

Try the solution. Reopen ticket if needed. Thanks for the bug report.

@brezerk brezerk closed this Dec 25, 2014
@nerijus
nerijus commented Dec 25, 2014

Something is still wrong. With the above patch I do not get Run string output anymore (which I added) and the log is:

Exec string:
/usr/bin/env  WINEPREFIX='/home/user/.wine'  WINESERVER='/usr/bin/wineserver'  WINELOADER='/usr/bin/wine'  WINEDLLPATH=''  /bin/sh -c "cd '/mnt/ntfs/Program Files/Snowball Interactive/BigRace(Lithuanian)/' &&   '/usr/bin/wine'   'BG_Start.exe'  2>&1 "
Exit code:
10
App STDOUT and STDERR output:
Can't load version information. Check prefix and/or version settings.

But the iso file is mounted.

Then I clear the pre run script in the app options, and try to launch it again. The log:

Exit code:
512
Run string:
 env  WINEPREFIX='/home/user/.wine'  WINESERVER='/usr/bin/wineserver'  WINELOADER='/usr/bin/wine'  WINEDLLPATH=''  /bin/sh -c  2>&1
App STDOUT and STDERR output:
/bin/sh: -c: option requires an argument
@brezerk
Owner
brezerk commented Dec 25, 2014

The last message is a message from post mount script. It is fixed in the same commit above: e3c6e5e Please, try to build git head sources.

@nerijus
nerijus commented Dec 25, 2014

I'll try, but I see a bug in the following logic:

+ if (pre_run){
+ stdout.append("Prerun Exec string:");
+ } else {
+ stdout.append("Postrun Exec string:");
+ }
+ stdout.append("\n");
+ stdout.append(run_string);
+ stdout.append("\n");

What if both prerun and postrun exist? What if both are empty?

@brezerk
Owner
brezerk commented Dec 25, 2014

nope. pre and post run calsl this function separately. if pre/post run is empty, then this function will be not called at all.

@nerijus
nerijus commented Dec 25, 2014

With empty prerun:

Exec string:
/usr/bin/env  WINEPREFIX='/home/user/.wine'  WINESERVER='/usr/bin/wineserver'  WINELOADER='/usr/bin/wine'  WINEDLLPATH=''  /bin/sh -c "cd '/mnt/ntfs/Program Files/Snowball Interactive/BigRace(Lithuanian)/' &&   '/usr/bin/wine'   'BG_Start.exe'  2>&1 "
Exit code:
10
App STDOUT and STDERR output:
Can't load version information. Check prefix and/or version settings.

It is on another PC than the bug was reported with, so it may be some other problem. I can run wine from command line.

@nerijus
nerijus commented Dec 25, 2014

If I delete /home/user/.config/q4wine, the first time wizard launches (btw, it is called First startup wizRAd, should be wizARd), in Step 3 the first 3 paths are filled, but wine libs (32 bit) and wine libs (64 bit) are empty. I fill 32 bit as /usr/lib/wine, leave 64 bit empty (my system is 32 bit), but after the wizard finishes it reports:

Error while loading application settings. wine's library path for 32 and 64 bit is not set.
Please, go to the q4wine options dialog and set at least one path.

In the Options->General all the paths are empty.

@brezerk
Owner
brezerk commented Dec 25, 2014

hm. yeah, your configuration seems to miss WINEDLLPATH=''.

please open another issue, and add some info: wine version + a list of wine pgk's owned files on your system. thanks.

@brezerk brezerk added the Bug label Dec 26, 2014
@brezerk brezerk self-assigned this Dec 26, 2014
@nerijus
nerijus commented Dec 26, 2014

With a new source it seems OK now.

@nerijus
nerijus commented Dec 26, 2014

One more problem. If I put path with spaces and () in a pre run script:
/usr/bin/fuseiso /mnt/ntfs/Program Files/Snowball Interactive/BigRace(Lithuanian)/DidzLenkt.iso /mnt/cdrom
I get in the log:

Prerun Exec string:
 env  WINEPREFIX='/home/user/.wine'  WINESERVER='/usr/bin/wineserver'  WINELOADER='/usr/bin/wine'  WINEDLLPATH='/usr/lib/wine'  /bin/sh -c '/usr/bin/fuseiso /mnt/ntfs/Program Files/Snowball Interactive/BigRace(Lithuanian)/DidzLenkt.iso /mnt/cdrom' 2>&1
Exit code:
256
App STDOUT and STDERR output:
/bin/sh: -c: eilutė 0: sintaksės klaida prie netikėtos leksemos: „(“
/bin/sh: -c: eilutė 0: `/usr/bin/fuseiso /mnt/ntfs/Program Files/Snowball Interactive/BigRace(Lithuanian)/DidzLenkt.iso /mnt/cdrom'

sintaksės klaida means syntax error.
If the iso file path is without spaces and (), it works.

@brezerk
Owner
brezerk commented Dec 26, 2014

there is nothing I can do with this :)

try to escape spaces and braces with \ i.e.:

 /mnt/ntfs/Program\ Files/Snowball\ Interactive/BigRace\(Lithuanian\)/DidzLenkt.iso

or add quotes

/usr/bin/fuseiso "/mnt/ntfs/Program Files/Snowball Interactive/BigRace(Lithuanian)/DidzLenkt.iso" /mnt/cdrom
@nerijus
nerijus commented Dec 26, 2014

Quotes are OK, sorry forgot to try them. Thank you very much for fixing this bug.

@brezerk
Owner
brezerk commented Dec 26, 2014

Ur'welcome. Thanks for the reports and your help :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment