Script, FF incompatibility

Post here if you are a new Porteus member and you're looking for some help.
User avatar
Ed_P
Contributor
Contributor
Posts: 8341
Joined: 06 Feb 2013, 22:12
Distribution: Cinnamon 5.01 ISO
Location: Western NY, USA

Script, FF incompatibility

Post#1 by Ed_P » 21 Jul 2014, 15:54

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

Bogomips
Full of knowledge
Full of knowledge
Posts: 2564
Joined: 25 Jun 2014, 15:21
Distribution: 3.2.2 Cinnamon & KDE5
Location: London

Re: Script, FF incompatibility

Post#2 by Bogomips » 21 Jul 2014, 16:36

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.
Linux porteus 4.4.0-porteus #3 SMP PREEMPT Sat Jan 23 07:01:55 UTC 2016 i686 AMD Sempron(tm) 140 Processor AuthenticAMD GNU/Linux
NVIDIA Corporation C61 [GeForce 6150SE nForce 430] (rev a2) MemTotal: 901760 kB MemFree: 66752 kB

User avatar
brokenman
Site Admin
Site Admin
Posts: 6105
Joined: 27 Dec 2010, 03:50
Distribution: Porteus v4 all desktops
Location: Brazil

Re: Script, FF incompatibility

Post#3 by brokenman » 21 Jul 2014, 18:21

Look into escape characters. You need to escape the question mark character.
How do i become super user?
Wear your underpants on the outside and put on a cape.

User avatar
Ed_P
Contributor
Contributor
Posts: 8341
Joined: 06 Feb 2013, 22:12
Distribution: Cinnamon 5.01 ISO
Location: Western NY, USA

Re: Script, FF incompatibility

Post#4 by Ed_P » 21 Jul 2014, 18:49

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

Bogomips
Full of knowledge
Full of knowledge
Posts: 2564
Joined: 25 Jun 2014, 15:21
Distribution: 3.2.2 Cinnamon & KDE5
Location: London

Re: Script, FF incompatibility

Post#5 by Bogomips » 21 Jul 2014, 20:18

Your example uses double quotes ("). How about single quotes (') as in my example?
Linux porteus 4.4.0-porteus #3 SMP PREEMPT Sat Jan 23 07:01:55 UTC 2016 i686 AMD Sempron(tm) 140 Processor AuthenticAMD GNU/Linux
NVIDIA Corporation C61 [GeForce 6150SE nForce 430] (rev a2) MemTotal: 901760 kB MemFree: 66752 kB

User avatar
Ed_P
Contributor
Contributor
Posts: 8341
Joined: 06 Feb 2013, 22:12
Distribution: Cinnamon 5.01 ISO
Location: Western NY, USA

Re: Script, FF incompatibility

Post#6 by Ed_P » 21 Jul 2014, 21:45

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
Ed

Bogomips
Full of knowledge
Full of knowledge
Posts: 2564
Joined: 25 Jun 2014, 15:21
Distribution: 3.2.2 Cinnamon & KDE5
Location: London

Re: Script, FF incompatibility

Post#7 by Bogomips » 21 Jul 2014, 22:51

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 &
Linux porteus 4.4.0-porteus #3 SMP PREEMPT Sat Jan 23 07:01:55 UTC 2016 i686 AMD Sempron(tm) 140 Processor AuthenticAMD GNU/Linux
NVIDIA Corporation C61 [GeForce 6150SE nForce 430] (rev a2) MemTotal: 901760 kB MemFree: 66752 kB

User avatar
Ed_P
Contributor
Contributor
Posts: 8341
Joined: 06 Feb 2013, 22:12
Distribution: Cinnamon 5.01 ISO
Location: Western NY, USA

Re: Script, FF incompatibility

Post#8 by Ed_P » 21 Jul 2014, 23:38

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

User avatar
Ed_P
Contributor
Contributor
Posts: 8341
Joined: 06 Feb 2013, 22:12
Distribution: Cinnamon 5.01 ISO
Location: Western NY, USA

Re: Script, FF incompatibility

Post#9 by Ed_P » 22 Jul 2014, 05:00

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

Bogomips
Full of knowledge
Full of knowledge
Posts: 2564
Joined: 25 Jun 2014, 15:21
Distribution: 3.2.2 Cinnamon & KDE5
Location: London

Re: Script, FF incompatibility

Post#10 by Bogomips » 22 Jul 2014, 19:32

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. ;)
Linux porteus 4.4.0-porteus #3 SMP PREEMPT Sat Jan 23 07:01:55 UTC 2016 i686 AMD Sempron(tm) 140 Processor AuthenticAMD GNU/Linux
NVIDIA Corporation C61 [GeForce 6150SE nForce 430] (rev a2) MemTotal: 901760 kB MemFree: 66752 kB

User avatar
Ed_P
Contributor
Contributor
Posts: 8341
Joined: 06 Feb 2013, 22:12
Distribution: Cinnamon 5.01 ISO
Location: Western NY, USA

Re: Script, FF incompatibility

Post#11 by Ed_P » 23 Jul 2014, 02:47

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

User avatar
brokenman
Site Admin
Site Admin
Posts: 6105
Joined: 27 Dec 2010, 03:50
Distribution: Porteus v4 all desktops
Location: Brazil

Re: Script, FF incompatibility

Post#12 by brokenman » 23 Jul 2014, 03:54

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"
How do i become super user?
Wear your underpants on the outside and put on a cape.

User avatar
Ed_P
Contributor
Contributor
Posts: 8341
Joined: 06 Feb 2013, 22:12
Distribution: Cinnamon 5.01 ISO
Location: Western NY, USA

Re: Script, FF incompatibility

Post#13 by Ed_P » 23 Jul 2014, 17:20

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

Post Reply