Re: Long urls - update

2013-04-02 Thread Luis Mochan
Hello James,
> You are not using the program correctly. extract_urlview has worked
> perfectly with mutt, for me, for probably about 2 years now. Why bother
> trying to integrate it into your shell script, just use it as a
> stand-alone program and don't use urlview at all.
> 
> the contents of my ~/.extract_urlview:
> COMMAND firefox %s &
> ...
As there are so many types of URLs, and I am not sure whether my
browser can handle all of them correctly, I wanted to continue using
the same handler that urlview, the program I used until a few days
ago, used. I guess your suggestion would work for most, or maybe all
of the cases, and the complexity of /etc/urlview/url_handler.sh may be
unnecessary, but now it is working and, at the end, the fix was
trivial, i.e. changing 'COMMAND /etc/urlview/url_handler.sh' into
'COMMAND /etc/urlview/url_handler.sh %s'.
Thanks and regards,
Luis


-- 

  o
W. Luis Mochán,  | tel:(52)(777)329-1734 /<(*)
Instituto de Ciencias Físicas, UNAM  | fax:(52)(777)317-5388 `>/   /\
Apdo. Postal 48-3, 62251 |   (*)/\/  \
Cuernavaca, Morelos, México  | moc...@fis.unam.mx   /\_/\__/
GPG: DD344B85,  2ADC B65A 5499 C2D3 4A3B  93F3 AE20 0F5E DD34 4B85




signature.asc
Description: Digital signature


Re: Long urls - update

2013-04-02 Thread Luis Mochan
Dear Kyle,
> ...
> > /etc/urlhandler/url_handler.sh is a shell script that obtains its 
> > url doing '$url=$1'.
> 
> Ahh, indeed, that could cause a problem. Variables are substituted 
> simply, in an "as if typed" manner. Take this simple example:
> ...
Thanks for your explanation. As I wrote last night, the problem
seems to have been solved (following one of your early suggestions).
Best regards,
Luis

-- 

  o
W. Luis Mochán,  | tel:(52)(777)329-1734 /<(*)
Instituto de Ciencias Físicas, UNAM  | fax:(52)(777)317-5388 `>/   /\
Apdo. Postal 48-3, 62251 |   (*)/\/  \
Cuernavaca, Morelos, México  | moc...@fis.unam.mx   /\_/\__/
GPG: DD344B85,  2ADC B65A 5499 C2D3 4A3B  93F3 AE20 0F5E DD34 4B85




signature.asc
Description: Digital signature


Re: Long urls - update

2013-04-02 Thread Kyle Wheeler
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA256

On Monday, April  1 at 07:30 PM, quoth Luis Mochan:
> I tried now your fix, and it didn't work for me; my browser doesn't 
> find the resulting pages when the url has ampersands that are 
> converted to %26 (probably because the % itself is further encoded 
> as %25 before been sent to the server by the browser (?))

What?!? That's *really* strange. Is extract_url.pl double-encoding the 
percent, or is some script in between doing that?

> I don't know much about shell programming, but I found that 
> /etc/urlhandler/url_handler.sh is a shell script that obtains its 
> url doing '$url=$1'.

Ahh, indeed, that could cause a problem. Variables are substituted 
simply, in an "as if typed" manner. Take this simple example:

   # foo=bar
   # echo $foo
   bar

Fairly straightforward. BUT, if we use an ampersand:

   # foo=bar&baz
   [1] 20113
   baz: command not found
   [1]+  Donefoo=bar
   # echo $foo

   #

You see, the ampersand did two things there: first, it created a 
sub-shell to execute 'foo=bar' in the background, and then attempted 
to execute 'baz' as if it were a command. What that shell script 
*should* have done is quote the argument, like this:

   url="$1"

To return to my example:

   # foo="bar&baz"
   # echo $foo
   bar&baz

> I don't understand why echo by itself yields the correct result 
> (above) while echo through a bash script yields the truncated 
> result.

It's because of the incorrectly quoted variable assignment, which is 
cutting off the URL at the ampersand.

~Kyle
- -- 
Always forgive your enemies; nothing annoys them so much.
 -- Oscar Wilde
-BEGIN PGP SIGNATURE-
Comment: Thank you for using encryption!

iQIcBAEBCAAGBQJRWvELAAoJECuveozR/AWeW+QP/0a/uhmbPio/web5Fu4zbcS8
VFj5/FJR1ql/0Wfrs9eL/JPb06cyvGm8M2xrLq/eVwuvMc4gPzIKwtqEwutanVh8
1JvUWCYFlQxqwYW5H4EKT9y6zCkqgJenisXdD0T9EbWO13fleDnlBXki5o63WPyb
GzPA11TuHOXIq6cxcMWfx6tt8DgtkIj36Jk5bpcS0/mE1s+nthsTCGILhM3PVU5k
ejLlFUFY1L7YUePqYpqhyCA/akMOvpcbMPdxw701WWMcr1UGi9Netu/otpZTPrz0
XiS2XvdzggCMwIRBJU5buhT9HpOOjmH2qPXIr0WDW3S6MKquAvm8agHvtkgXEqNI
0vGZ/KqKoNUBUJUgjOaFW9zZFvUHrYhzfsdFHjspglVbPMreqw3DggZErUa0Eifm
q1j0dYsOZ/xmmp3iFO38iYfc5NBTJcXuBZIDS+scRJw4ZFhfedEBJcskEX7Jcxnu
l9bwwa+nIxEidUou87EcKslzDB/lux0ihdsZzSRQNmpV82FW59kCqkcY0brLJoeh
GgJgtHk4tFe2Vw4cN4uAw8EpvxnmAP/lDCmTwUVcdKbvy+p8f49vvElpUC+eWnq/
vQuynegYN/GQyj0CQJxU25m35UhKG7X+XzYOKojmnxG9E9O94YANZ5NBxRUuyR8K
ntttDNCaEt6oARXNCp2H
=MZB4
-END PGP SIGNATURE-


Re: Long urls - update

2013-04-02 Thread James Griffin
Mon  1.Apr'13 at  8:14:35 -0600 Luis Mochan
> > By the way, the author of the program, Kyle Wheeler, wrote to me that
> > he expects that adding the line
> >  COMMAND /etc/urlview/url_handler.sh '%s'
> > to the configuration file ~/.extract_urlview would be enough to solve
> > the problem (with %s between quotes). I believe I had tried that and
> > that it didn't work, but now I'm not completely sure. You could try it. 
> 
> Well I tried it and it doesn't work without the patch; it is not
> enough to add '%s' to COMMAND.  
> Regards,
> Luis

You are not using the program correctly. extract_urlview has worked
perfectly with mutt, for me, for probably about 2 years now. Why bother
trying to integrate it into your shell script, just use it as a
stand-alone program and don't use urlview at all.

the contents of my ~/.extract_urlview:


COMMAND firefox %s &
SHORTCUT
PERSISTENT

That's it! The ampersand ensures Firefox runs in the background. Nothing
else needed.

-- 
James Griffin:  jmz at kontrol.kode5.net 
jmzgriffin at gmail.com

A4B9 E875 A18C 6E11 F46D  B788 BEE6 1251 1D31 DC38