View previous topic :: View next topic |
Author |
Message |
ishanarora n00b
Joined: 13 Jul 2007 Posts: 40
|
Posted: Tue Aug 26, 2008 10:27 pm Post subject: startx ignores spaces in client arguments |
|
|
Hi all,
This is what I type in bash Code: | startx `which wine` "C:\\Program Files\\Ubisoft\\Prince of Persia Warrior Within\\PrinceOfPersia.exe" -- :1 | and this is what output I get Code: | xauth: creating new authority file /home/ishanarora/.serverauth.654
X Window System Version 1.3.0
Release Date: 19 April 2007
X Protocol Version 11, Revision 0, Release 1.3
Build Operating System: UNKNOWN
Current Operating System: Linux calculus 2.6.25-gentoo-r7 #6 SMP Wed Aug 13 08:59:09 IST 2008 i686
Build Date: 01 August 2008
Before reporting problems, check http://wiki.x.org
to make sure that you have the latest version.
Module Loader present
Markers: (--) probed, (**) from config file, (==) default setting,
(++) from command line, (!!) notice, (II) informational,
(WW) warning, (EE) error, (NI) not implemented, (??) unknown.
(==) Log file: "/var/log/Xorg.1.log", Time: Wed Aug 27 03:44:20 2008
(==) Using config file: "/etc/X11/xorg.conf"
(II) Module already built-in
xinit: Resource temporarily unavailable (errno 11): Cannot register with ConsoleKit: org.freedesktop.CkConnector.Error: Unable to open session: The name org.freedesktop.ConsoleKit was not provided by any .service files
wine: cannot find 'C:\Program'
waiting for X server to shut down FreeFontPath: FPE "/usr/share/fonts/misc/" refcount is 2, should be 1; fixing.
|
Notice this line wine: cannot find 'C:\Program'
Basically startx broke my client arguments into more than 1 where ever it had spaces. Am I missing something here? Any help is appreciated. Thanks. |
|
Back to top |
|
|
Maliwik Apprentice
Joined: 14 Apr 2008 Posts: 252 Location: Wisconsin, U.S. of A.
|
Posted: Tue Aug 26, 2008 11:04 pm Post subject: |
|
|
Before each space in the argument, put a backslash \ just like you did before each directory end. This means that it'll use the explicit character located right after the backslash (even a space). _________________
freelight wrote: | I have a severe case of procrastinitis. |
|
|
Back to top |
|
|
ishanarora n00b
Joined: 13 Jul 2007 Posts: 40
|
Posted: Tue Aug 26, 2008 11:28 pm Post subject: |
|
|
tried this
Code: | startx `which wine` "C:\\Program\ Files\\Ubisoft\\Prince\ of\ Persia\ Warrior\ Within\\PrinceOfPersia.exe" -- :1 |
output
Code: | xauth: creating new authority file /home/ishanarora/.serverauth.8622
X Window System Version 1.3.0
Release Date: 19 April 2007
X Protocol Version 11, Revision 0, Release 1.3
Build Operating System: UNKNOWN
Current Operating System: Linux calculus 2.6.25-gentoo-r7 #6 SMP Wed Aug 13 08:59:09 IST 2008 i686
Build Date: 01 August 2008
Before reporting problems, check http://wiki.x.org
to make sure that you have the latest version.
Module Loader present
Markers: (--) probed, (**) from config file, (==) default setting,
(++) from command line, (!!) notice, (II) informational,
(WW) warning, (EE) error, (NI) not implemented, (??) unknown.
(==) Log file: "/var/log/Xorg.1.log", Time: Wed Aug 27 04:51:36 2008
(==) Using config file: "/etc/X11/xorg.conf"
(II) Module already built-in
xinit: Resource temporarily unavailable (errno 11): Cannot register with ConsoleKit: org.freedesktop.CkConnector.Error: Unable to open session: The name org.freedesktop.ConsoleKit was not provided by any .service files
wine: cannot find 'C:\Program\'
waiting for X server to shut down FreeFontPath: FPE "/usr/share/fonts/misc/" refcount is 2, should be 1; fixing.
|
didn't work. As far as I know anything in qoutes is taken as is. Without qoutes '\ ' means a space. |
|
Back to top |
|
|
Maliwik Apprentice
Joined: 14 Apr 2008 Posts: 252 Location: Wisconsin, U.S. of A.
|
Posted: Tue Aug 26, 2008 11:36 pm Post subject: |
|
|
Sorry, I just now realized what you were trying to do.
Try giving the absolute path to the .exe file. Something along the lines of "~/.wine/drive_c/Program Files/Ubisoft/Prince of Persia Warrior Within/PrinceOfPersia.exe" -- :1
C:\ is a virtual directory which doesn't actually exist on the computer. The real directory is usually drive_c or whichever drive you set it as. Wine just reads the directory AFTER it's running as C:\. _________________
freelight wrote: | I have a severe case of procrastinitis. |
|
|
Back to top |
|
|
ishanarora n00b
Joined: 13 Jul 2007 Posts: 40
|
Posted: Wed Aug 27, 2008 2:46 pm Post subject: |
|
|
I have tried it all.
It is clear from the output, that startx is splitting arguments at whitespaces. Btw, wine supports Windows like paths, i.e. Code: | wine "C:\\Program\ Files\\Ubisoft\\Prince\ of\ Persia\ Warrior\ Within\\PrinceOfPersia.exe" | works.
Let me state it a little more generally. I want to run a program with arguments that contain spaces. This is easy, as I can put the agruments in qoutes and spaces are included. Now I want to run this program with same arguments, but as a startx client. Here startx doesnt seem to respect the spaces in arguments. Please help. |
|
Back to top |
|
|
Tin Guru
Joined: 22 Dec 2005 Posts: 305 Location: Namur, Belgium
|
Posted: Wed Aug 27, 2008 3:46 pm Post subject: |
|
|
Try to put some single quotes instead of double one.
I encounter quite the same problem because if the line is "interpreted' multiple times, your backslash+space will disappear at the first one, so the second interpretation stop at the first space. _________________ Tin, the gentoobie |
|
Back to top |
|
|
ishanarora n00b
Joined: 13 Jul 2007 Posts: 40
|
Posted: Wed Aug 27, 2008 4:54 pm Post subject: |
|
|
Tin wrote: | Try to put some single quotes instead of double one.
I encounter quite the same problem because if the line is "interpreted' multiple times, your backslash+space will disappear at the first one, so the second interpretation stop at the first space. |
That didn't work either. First I tried this Code: | startx `which wine` 'C:\\Program Files\\Ubisoft\\Prince of Persia Warrior Within\\PrinceOfPersia.exe' -- :1 | and this is the output I got Code: | xauth: creating new authority file /home/ishanarora/.serverauth.1595
X Window System Version 1.3.0
Release Date: 19 April 2007
X Protocol Version 11, Revision 0, Release 1.3
Build Operating System: UNKNOWN
Current Operating System: Linux calculus 2.6.25-gentoo-r7 #6 SMP Wed Aug 13 08:59:09 IST 2008 i686
Build Date: 01 August 2008
Before reporting problems, check http://wiki.x.org
to make sure that you have the latest version.
Module Loader present
Markers: (--) probed, (**) from config file, (==) default setting,
(++) from command line, (!!) notice, (II) informational,
(WW) warning, (EE) error, (NI) not implemented, (??) unknown.
(==) Log file: "/var/log/Xorg.1.log", Time: Wed Aug 27 22:08:29 2008
(==) Using config file: "/etc/X11/xorg.conf"
(II) Module already built-in
xinit: Resource temporarily unavailable (errno 11): Cannot register with ConsoleKit: org.freedesktop.CkConnector.Error: Unable to open session: The name org.freedesktop.ConsoleKit was not provided by any .service files
wine: cannot find 'C:\\Program'
waiting for X server to shut down FreeFontPath: FPE "/usr/share/fonts/misc/" refcount is 2, should be 1; fixing.
|
So I understand single qoutes preserve double backslash. So I tried this Code: | startx `which wine` 'C:\Program Files\Ubisoft\Prince of Persia Warrior Within\PrinceOfPersia.exe' -- :1 | and this is the output I got Code: | xauth: creating new authority file /home/ishanarora/.serverauth.1838
X Window System Version 1.3.0
Release Date: 19 April 2007
X Protocol Version 11, Revision 0, Release 1.3
Build Operating System: UNKNOWN
Current Operating System: Linux calculus 2.6.25-gentoo-r7 #6 SMP Wed Aug 13 08:59:09 IST 2008 i686
Build Date: 01 August 2008
Before reporting problems, check http://wiki.x.org
to make sure that you have the latest version.
Module Loader present
Markers: (--) probed, (**) from config file, (==) default setting,
(++) from command line, (!!) notice, (II) informational,
(WW) warning, (EE) error, (NI) not implemented, (??) unknown.
(==) Log file: "/var/log/Xorg.1.log", Time: Wed Aug 27 22:08:29 2008
(==) Using config file: "/etc/X11/xorg.conf"
(II) Module already built-in
xinit: Resource temporarily unavailable (errno 11): Cannot register with ConsoleKit: org.freedesktop.CkConnector.Error: Unable to open session: The name org.freedesktop.ConsoleKit was not provided by any .service files
wine: cannot find 'C:\Program'
waiting for X server to shut down FreeFontPath: FPE "/usr/share/fonts/misc/" refcount is 2, should be 1; fixing.
|
Which is the same as the original problem.
Btw I did mention before that this has nothing to do with anything but startx. So you people could give it a try using any program that takes arguments with spaces. It would be nice if you tried your solutions before submitting them here, since this would save the time it takes me to reply
And if you do try it yourself, remember that startx requires you to pass the full path pf the client executable. |
|
Back to top |
|
|
ishanarora n00b
Joined: 13 Jul 2007 Posts: 40
|
Posted: Wed Aug 27, 2008 5:05 pm Post subject: |
|
|
Just a reference to what all I have tried so far.
No qoutes (using backslash)
Double qoutes
Single qoutes
Single qoutes in double qoutes
Double qoutes in single qoutes
And a lot of them. It seems like startx intensionally breaks the arguments at spaces. I looked up the code for startx and I found that it uses xinit internally. I am not much of a bash coder so I dont know if the argument splitting happened in startx or xinit. And no xinit is not coded in bash so it is not even readable. And I dont dare to see its code. Can someone try the same with xinit and tell me if it is a problem with xinit or startx |
|
Back to top |
|
|
ishanarora n00b
Joined: 13 Jul 2007 Posts: 40
|
Posted: Wed Aug 27, 2008 5:19 pm Post subject: |
|
|
Ok the problem is with startx. I just checked it. This is what I tried. I created a bash script
Code: | #!/bin/sh
clientargs="$@"
echo $clientargs |
And this script also has all the problems of startx. Try this script with an argument "a a" and you will get an output "a a".
Anybody knows how to tackle it the right way in bash |
|
Back to top |
|
|
mv Watchman
Joined: 20 Apr 2005 Posts: 6749
|
Posted: Wed Aug 27, 2008 6:06 pm Post subject: |
|
|
The only way to prevent the shell splitting at spaces in is to change IFS. So you might want to try Code: | IFS='' startx `which wine` "C:\\Program Files\\Ubisoft\\Prince of Persia Warrior Within\\PrinceOfPersia.exe" -- :1 | However, be warned that changing IFS is a good way to break unexpected things in any shell code, so don't blame me if this command has unexpected side effects, and startx formats your harddisks instead...
Edit: It is more compatible to use `command -v wine` instead of `which wine` |
|
Back to top |
|
|
ishanarora n00b
Joined: 13 Jul 2007 Posts: 40
|
Posted: Wed Aug 27, 2008 6:45 pm Post subject: |
|
|
mv wrote: | The only way to prevent the shell splitting at spaces in is to change IFS. So you might want to try Code: | IFS='' startx `which wine` "C:\\Program Files\\Ubisoft\\Prince of Persia Warrior Within\\PrinceOfPersia.exe" -- :1 | However, be warned that changing IFS is a good way to break unexpected things in any shell code, so don't blame me if this command has unexpected side effects, and startx formats your harddisks instead...
Edit: It is more compatible to use `command -v wine` instead of `which wine` |
Code: | IFS='' startx `which wine` "C:\\Program Files\\Ubisoft\\Prince of Persia Warrior Within\\PrinceOfPersia.exe" -- :1 |
Doesn't seem to help. I'll try to dig a little up later on. For now I am using xinit which works perfectly, but I am missing out on default parametrs startx passes.
Thanks for the suggestion about command -v |
|
Back to top |
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|