Closed Bug 292469 Opened 20 years ago Closed 20 years ago

Can't run XULRunner applications from a path with spaces in it

Categories

(Toolkit Graveyard :: XULRunner, defect)

x86
Windows 2000
defect
Not set
major

Tracking

(Not tracked)

RESOLVED FIXED
mozilla1.8beta2

People

(Reporter: mcsmurf, Assigned: darin.moz)

Details

Attachments

(1 file)

I wanted to start a XULRunner app from scratch, the path to the XULRunner app had spaces in it, so i used something like this to start it (WinDbg confirms this): D:\mozilla\tree-main\mozilla\obj-xul\dist\bin\xulrunner.exe -app "D:\my app\application.ini" First it finds the app, but after the internal restart of xulrunner it just dumps "Error: Invalid or missing application data!" to console. WinDbg told me that XULRunner restarts itself like this: D:\mozilla\TREE-M~1\mozilla\obj-xul\dist\bin\XULRUN~1.exe -app D:\my app\application.ini Note the missing quotes. If i first start the app from a path without spaces and then move the app to a path with spaces, everything is fine (i guess because then a profile has already been created and there is no need to restart XULRunner internally).
It seems like this might be an issue for Firefox as well. Try passing a file path to Firefox on the command line. It should suffer the same problem. mkdir test .\firefox.exe -profile test "c:\my test\file.html" In firefox with a new profile, I get two tabs: one tries to load "c:\my" and the other tries to load "test/file.html" as a URL relative to the current directory.
This is likely to be less noticed in Firefox since people rarely pass URLs to Firefox on the command line, and they even more rarely do so when Firefox needs to restart itself. -> me
Assignee: nobody → darin
Confirming, i also see that problem with Firefox. Also i get another strange problem with FF trunk here, it alerts that D:/my/ cannot be found, if you OK that you dont get any window, but firefox.exe keeps running in background. I'll put that issue to another bug.
When creating gRestartArgv, I think we probably want to add quotes around elements that have spaces in them. It looks like the MS CRT code that generates __argv and __argc will strip the quotes (see parse_cmdline in stdargv.c). This may be the right thing to do for argv[0] instead of what is done here: http://lxr.mozilla.org/seamonkey/source/toolkit/xre/nsAppRunner.cpp#974
Status: NEW → ASSIGNED
Frank: if the patch for this bug fixes that other problem with firefox, then maybe no need for another bug.
(In reply to comment #5) > Frank: if the patch for this bug fixes that other problem with firefox, then > maybe no need for another bug. That bug also happens if you pass something like D:\nofilehere. But i just saw, the FF window launches some seconds later (so some delay)...
Attached patch v1 patchSplinter Review
This seems to do the trick.
Attachment #182289 - Flags: first-review?(benjamin)
BTW, I decided not to bother with changing the code that makes exePath use the short path form. I figure that that code works so why tempt fate.
Comment on attachment 182289 [details] [diff] [review] v1 patch I'm really confused as to why this is necessary. If we are relaunching with a remotely unix-like execv, we shouldn't need the quotes, because we aren't being passed through the shell escaping mechanisms.
Bsmedberg: The problem is that microsoft's execv seems to assume that arguments do not have spaces in them. It's a really broken assumption. Just take a look at the implementation of execv when you get a chance (included with any copy of visual studio). It just concatenates the arguments together before calling CreateProcess! So, without quoting, there is no way to discern argument boundaries. Fortunately, when constructing __argv, the MS CRT strips double quotes. So, we can double quote any parameters passed to execv if we want them to appear as single entries in __argv.
Comment on attachment 182289 [details] [diff] [review] v1 patch Wow, ok. The windows POSIX subsystem isn't as capable as I had thought. Please add a comment to this hack to indicate why it's necessary, and reference this bug. Also, we should check with mkaply, since this same hack might be necessary for OS/2.
Attachment #182289 - Flags: first-review?(benjamin) → first-review+
Comment on attachment 182289 [details] [diff] [review] v1 patch This patch affects Firefox too, but shows up more easily under XULRunner.
Attachment #182289 - Flags: approval1.8b3?
Attachment #182289 - Flags: approval1.8b2?
Severity: normal → major
Target Milestone: --- → mozilla1.8beta2
Comment on attachment 182289 [details] [diff] [review] v1 patch a=chofmann
Attachment #182289 - Flags: approval1.8b2? → approval1.8b2+
Attachment #182289 - Flags: approval1.8b3?
Checked in by darin at 2005-05-17 14:55, resolving.
Status: ASSIGNED → RESOLVED
Closed: 20 years ago
Resolution: --- → FIXED
BTW: I asked mkaply about OS/2, he said everything is ok there (it only opens one tab with c:\my test\file.html in it.
Product: Toolkit → Toolkit Graveyard
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: