Page 1 of 1

Script, FF incompatibility

Posted: 21 Jul 2014, 15:54
by Ed_P
I have a script that invokes Firefox with a URL that Firefox rejects because the script passes the URL misformed. How do I get the script to pass what I give it?

Code: Select all

firefox "/mnt/sda5/Users/Ed/My Webpages/EdsxoapWeatherData.html?b=FF" 2>/dev/null &
exit 0

Code: Select all

File not found

Firefox can't find the file at /mnt/sda5/Users/Ed/My Webpages/EdsxoapWeatherData.html?b=FF.
And the reason is the URL in the URL field is:

Code: Select all

file:///mnt/sda5/Users/Ed/My%20Webpages/EdsxoapWeatherData.html%3Fb=FF
If I manually change the %3F back to ? or manually paste the URL into FireFox's URL field it works fine.

Re: Script, FF incompatibility

Posted: 21 Jul 2014, 16:36
by Bogomips
Don't know if this will help:

Code: Select all

guest@porteus:~$ ff='mnt/sda5/Users/Ed/My%20Webpages/EdsxoapWeatherData.html%3Fb=FF'
guest@porteus:~$ echo $ff
mnt/sda5/Users/Ed/My%20Webpages/EdsxoapWeatherData.html%3Fb=FF
guest@porteus:~$ ls $ff
/bin/ls: cannot access mnt/sda5/Users/Ed/My%20Webpages/EdsxoapWeatherData.html%3Fb=FF: No such file or directory
guest@porteus:~$ firefox $ff

(process:3903): GLib-CRITICAL **: g_slice_set_config: assertion `sys_page_size == 0' failed
^C
Couldn't get error msg. Because of 100% cpu, terminated it.

Re: Script, FF incompatibility

Posted: 21 Jul 2014, 18:21
by brokenman
Look into escape characters. You need to escape the question mark character.

Re: Script, FF incompatibility

Posted: 21 Jul 2014, 18:49
by Ed_P
Thank Bogomips. I tried that approach but it didn't get far.

Code: Select all

ff="/mnt/sda5/Users/Ed/My%20Webpages/EdsxoapWeatherData.html?b=FF"
echo $ff
firefox $ff 2>/dev/null &
exit

Code: Select all

guest@porteus:~$ weather.sh
"/mnt/sda5/Users/Ed/My Webpages/EdsxoapWeatherData.html?b=FF"
guest@porteus:~$ weather.sh
/mnt/sda5/Users/Ed/My%20Webpages/EdsxoapWeatherData.html?b=FF
And while the variable works FireFox doesn't like it still.

I tried \? and '?' brokenman but that didn't work either.

Re: Script, FF incompatibility

Posted: 21 Jul 2014, 20:18
by Bogomips
Your example uses double quotes ("). How about single quotes (') as in my example?

Re: Script, FF incompatibility

Posted: 21 Jul 2014, 21:45
by Ed_P
Bogomips wrote:Your example uses double quotes ("). How about single quotes (') as in my example?

Code: Select all

ff='/mnt/sda5/Users/Ed/My Webpages/EdsxoapWeatherData.html?b=FF'
echo $ff
firefox $ff 2>/dev/null &
exit

Code: Select all

guest@porteus:~$ weather.sh
/mnt/sda5/Users/Ed/My Webpages/EdsxoapWeatherData.html?b=FF
FF URL

Code: Select all

file:///mnt/sda5/Users/Ed/My

Re: Script, FF incompatibility

Posted: 21 Jul 2014, 22:51
by Bogomips
Have script problem somewhat similar to yours. Can get blanks through, but special characters a barrier so far.

Code: Select all

guest@porteus:~$     ff='/mnt/sda5/Users/Ed/My Webpages/EdsxoapWeatherData.html?b=FF'
guest@porteus:~$     echo $ff
/mnt/sda5/Users/Ed/My Webpages/EdsxoapWeatherData.html?b=FF
guest@porteus:~$     echo "$ff"
/mnt/sda5/Users/Ed/My Webpages/EdsxoapWeatherData.html?b=FF
Another variant: firefox "$ff" 2>/dev/null &

Re: Script, FF incompatibility

Posted: 21 Jul 2014, 23:38
by Ed_P
Bogomips wrote:Another variant: firefox "$ff" 2>/dev/null &

Code: Select all

ff='/mnt/sda5/Users/Ed/My Webpages/EdsxoapWeatherData.html?b=FF'
echo $ff
firefox "$ff" 2>/dev/null &
exit

Code: Select all

guest@porteus:~$ weather.sh
/mnt/sda5/Users/Ed/My Webpages/EdsxoapWeatherData.html?b=FF
And the FF URL result is the same.

Code: Select all

file:///mnt/sda5/Users/Ed/My%20Webpages/EdsxoapWeatherData.html%3Fb=FF
In that the echos work OK I'm leaning more toward this being a Linux/Porteus FireFox problem.

Re: Script, FF incompatibility

Posted: 22 Jul 2014, 05:00
by Ed_P
I gave up and took a different approach to resolve the problem. I tried ", ', \, \x3F in various combinations and none worked. So I changed the webpage's html code.

Code: Select all

 var _parm = location.href;
 var _parm = _parm.indexOf("?");
 if (_parm != -1) {
    _url = 'USNY1645.xml';
 }
 if (navigator.appName == "Netscape") {
    _url = 'USNY1645.xml';
 }
It no longer needs a start parameter when run in Firefox. I hope that option is available to you also Bogomips.

Re: Script, FF incompatibility

Posted: 22 Jul 2014, 19:32
by Bogomips
Ed_P wrote:I have a script that invokes Firefox with a URL that Firefox rejects because the script passes the URL misformed. How do I get the script to pass what I give it?

Code: Select all

firefox "/mnt/sda5/Users/Ed/My Webpages/EdsxoapWeatherData.html?b=FF" 2>/dev/null &
exit 0

Code: Select all

File not found

Firefox can't find the file at /mnt/sda5/Users/Ed/My Webpages/EdsxoapWeatherData.html?b=FF.
And the reason is the URL in the URL field is:

Code: Select all

file:///mnt/sda5/Users/Ed/My%20Webpages/EdsxoapWeatherData.html%3Fb=FF
If I manually change the %3F back to ? or manually paste the URL into FireFox's URL field it works fine.
Hi Ed_P

My script is not to do with FF, but with splitting up big movie files for the cloud.
Ed_P wrote: In that the echos work OK I'm leaning more toward this being a Linux/Porteus FireFox problem.
Also of that opinion.

Looks like we've been going round the houses. This is URL format:

Code: Select all

file:///mnt/sda5/Users/Ed/My%20Webpages/EdsxoapWeatherData.html%3Fb=FF
This is same URL decoded:

Code: Select all

file:///mnt/sda5/Users/Ed/My Webpages/EdsxoapWeatherData.html?b=FF
Yesterday tried:

Code: Select all

guest@porteus:~$ ff='/mnt/sda5/Users/Ed/My Webpages/EdsxoapWeatherData.html?b=FF'
guest@porteus:~$ echo $ff
/mnt/sda5/Users/Ed/My Webpages/EdsxoapWeatherData.html?b=FF
firefox $ff
FF decided to create a URL like so: http://www.mnt.com/mnt/sda5/Users/Ed/My Webpages/EdsxoapWeatherData.html?b=FF
Today did:

Code: Select all

guest@porteus:~$ ff='/mnt/sda5/Users/Ed/My Webpages/EdsxoapWeatherData.html?b=FF'
guest@porteus:~$     echo $ff
/mnt/sda5/Users/Ed/My Webpages/EdsxoapWeatherData.html?b=FF
guest@porteus:~$ firefox "$ff"
and got something else:

Code: Select all

file:///mnt/sda5/Users/Ed/My%20Webpages/EdsxoapWeatherData.html%3Fb=FF

File not found

Firefox can't find the file at /mnt/sda5/Users/Ed/My Webpages/EdsxoapWeatherData.html?b=FF.
However sometimes a distinction has to be made between CLI in interactive mode and in a script, batch mode, as sometimes programs behave differently depending on the mode.

Code: Select all

guest@porteus:~$ firefox -h

(process:2854): GLib-CRITICAL **: g_slice_set_config: assertion `sys_page_size == 0' failed
Usage: firefox [ options ... ] [URL]
FF expects a URL. However before surmising a FF defect, FF has to be invoked with a proper URL, where special characters are properly encoded, as opposed to what goes in the navigator bar.

Code: Select all

ff='file:///mnt/sda5/Users/Ed/My%20Webpages/EdsxoapWeatherData.html%3Fb=FF'
firefox "$ff"
End of Story. ;)

Re: Script, FF incompatibility

Posted: 23 Jul 2014, 02:47
by Ed_P
Bogomips wrote:FF expects a URL. However before surmising a FF defect, FF has to be invoked with a proper URL, where special characters are properly encoded, as opposed to what goes in the navigator bar.

Code: Select all

ff='file:///mnt/sda5/Users/Ed/My%20Webpages/EdsxoapWeatherData.html%3Fb=FF'
firefox "$ff"
End of Story. ;)

Code: Select all

ff='/mnt/sda5/Users/Ed/My Webpages/EdsxoapWeatherData.html%3Fb=FF'
echo $ff
( firefox "${ff}" 2>/dev/null & )
exit

Code: Select all

guest@porteus:~$ weather.sh
/mnt/sda5/Users/Ed/My Webpages/EdsxoapWeatherData.html%3Fb=FF
guest@porteus:~$ 

Code: Select all

File not found

Firefox can't find the file at /mnt/sda5/Users/Ed/My Webpages/EdsxoapWeatherData.html%3Fb=FF.
And FF's URL box shows:

Code: Select all

file:///mnt/sda5/Users/Ed/My%20Webpages/EdsxoapWeatherData.html%253Fb=FF
What makes this even more interesting, the "?b=FF" URL doesn't work in Internet Explorer either. Remove the "?b=FF" and the URL works fine in IE. :shock:

Re: Script, FF incompatibility

Posted: 23 Jul 2014, 03:54
by brokenman
What is the output of:

Code: Select all

xdg-mime query filetype "/mnt/sda5/Users/Ed/My Webpages/EdsxoapWeatherData.html%3Fb=FF"
gvfs-open "/mnt/sda5/Users/Ed/My Webpages/EdsxoapWeatherData.html%3Fb=FF"
ls -l "/mnt/sda5/Users/Ed/My Webpages"

Re: Script, FF incompatibility

Posted: 23 Jul 2014, 17:20
by Ed_P

Code: Select all

guest@porteus:~$ xdg-mime query filetype "/mnt/sda5/Users/Ed/My Webpages/EdsxoapWeatherData.html%3Fb=FF"
xdg-mime: file '/mnt/sda5/Users/Ed/My Webpages/EdsxoapWeatherData.html%3Fb=FF' does not exist

guest@porteus:~$ xdg-mime query filetype "/mnt/sda5/Users/Ed/My Webpages/EdsxoapWeatherData.html"
text/html; charset=us-ascii

guest@porteus:~$ gvfs-open "/mnt/sda5/Users/Ed/My Webpages/EdsxoapWeatherData.html%3Fb=FF"
bash: gvfs-open: command not found

guest@porteus:~$ ls -l "/mnt/sda5/Users/Ed/My Webpages"
total 1581
-rwxrwxrwx 1 root root  44888 Jul  8  2013 111&110.png*
drwxrwxrwx 1 root root   4096 Feb 15  2012 Clock/
-rwxrwxrwx 2 root root  24982 Nov  7  2010 Comics.html*
-rwxrwxrwx 2 root root   5294 Jul 22 18:20 EdsxoapWeatherData\ -\ Copy.html*
-rwxrwxrwx 2 root root   5229 Jul 23 00:42 EdsxoapWeatherData.html*
-rwxrwxrwx 1 root root   2077 Jul  8 13:25 EdsxoapWeatherData.xml*
-rwxrwxrwx 2 root root    145 Jul 20 19:05 EdsxoapWeatherDatasites.txt*
drwxrwxrwx 1 root root   4096 Feb 15  2012 Games/
-rwxrwxrwx 2 root root   6520 Jul 19  2005 Map.html*
drwxrwxrwx 1 root root   4096 Feb 15  2012 Moon/
-rwxrwxrwx 2 root root    115 May 29 19:36 My\ Webpages\ IE\ change.txt*
drwxrwxrwx 1 root root      0 May 16 13:15 RR\ Homepage/
-rwxrwxrwx 2 root root    690 Jun 22  2011 ResetWndw.htm*
-rwxrwxrwx 2 root root   2019 Aug 26  2007 SkyWatch.html*
-rwxrwxrwx 2 root root   2167 Oct 18  2008 TWC\ navigation.html*
-rwxrwxrwx 2 root root   5731 Aug  5  2013 TWC\ weather\ -\ Ed's\ X\ version.html*
-rwxrwxrwx 2 root root   2478 Aug 28  2012 TWC\ weather\ -\ Ed's\ version.html*
 :
etc
 :
guest@porteus:~$ 

Code: Select all

guest@porteus:~$ gvfs -open "/mnt/sda5/Users/Ed/My Webpages/EdsxoapWeatherData.html%3Fb=FF"
bash: gvfs: command not found

guest@porteus:~$ su
Password: 
root@porteus:/home/guest# gvfs -open "/mnt/sda5/Users/Ed/My Webpages/EdsxoapWeatherData.html%3Fb=FF"
bash: gvfs: command not found
root@porteus:/home/guest#