New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

using pre run scripts #49

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

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

This comment has been minimized.

Show comment
Hide comment
@brezerk

brezerk Dec 23, 2014

Owner

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.

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

This comment has been minimized.

Show comment
Hide comment
@nerijus

nerijus 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.

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

This comment has been minimized.

Show comment
Hide comment
@brezerk

brezerk Dec 24, 2014

Owner

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

Owner

brezerk commented Dec 24, 2014

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

@nerijus

This comment has been minimized.

Show comment
Hide comment
@nerijus

nerijus 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 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

This comment has been minimized.

Show comment
Hide comment
@nerijus

nerijus 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 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

This comment has been minimized.

Show comment
Hide comment
@nerijus

nerijus Dec 25, 2014

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

nerijus commented Dec 25, 2014

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

@brezerk

This comment has been minimized.

Show comment
Hide comment
@brezerk

brezerk Dec 25, 2014

Owner

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
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

This comment has been minimized.

Show comment
Hide comment
@brezerk

brezerk Dec 25, 2014

Owner

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

Owner

brezerk commented Dec 25, 2014

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

@brezerk

This comment has been minimized.

Show comment
Hide comment
@brezerk

brezerk Dec 25, 2014

Owner

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.

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

This comment has been minimized.

Show comment
Hide comment
@nerijus

nerijus 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

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

This comment has been minimized.

Show comment
Hide comment
@brezerk

brezerk Dec 25, 2014

Owner

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.

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

This comment has been minimized.

Show comment
Hide comment
@nerijus

nerijus 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?

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

This comment has been minimized.

Show comment
Hide comment
@brezerk

brezerk Dec 25, 2014

Owner

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

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

This comment has been minimized.

Show comment
Hide comment
@nerijus

nerijus 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 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

This comment has been minimized.

Show comment
Hide comment
@nerijus

nerijus 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.

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

This comment has been minimized.

Show comment
Hide comment
@brezerk

brezerk Dec 25, 2014

Owner

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.

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

This comment has been minimized.

Show comment
Hide comment
@nerijus

nerijus Dec 26, 2014

With a new source it seems OK now.

nerijus commented Dec 26, 2014

With a new source it seems OK now.

@nerijus

This comment has been minimized.

Show comment
Hide comment
@nerijus

nerijus 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.

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

This comment has been minimized.

Show comment
Hide comment
@brezerk

brezerk Dec 26, 2014

Owner

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
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

This comment has been minimized.

Show comment
Hide comment
@nerijus

nerijus Dec 26, 2014

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

nerijus commented Dec 26, 2014

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

@brezerk

This comment has been minimized.

Show comment
Hide comment
@brezerk

brezerk Dec 26, 2014

Owner

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

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