Gnus development mailing list
 help / color / mirror / Atom feed
* [MAILCAP] filename quoting
@ 2001-02-27 18:23 Didier Verna
  2001-02-27 18:44 ` Didier Verna
  0 siblings, 1 reply; 7+ messages in thread
From: Didier Verna @ 2001-02-27 18:23 UTC (permalink / raw)



        On my debian system, I can't externally display images that contain
characters requiring quotation (e.g. spaces). The reason is that /etc/mailcap
(which I think is used by gnus) contains stuff like:

image/jpeg; display '%s';             <- note that %s is quoted

However, gnus also takes care of quoting the filename (with mm-quote-arg,
which shell-quote-arg under XEmacs). The filename ends up being quoted twice,
like this:

display '/foo/bar/file\\ name.jpg'


        I'd like suggestions on the better way to fix this. In order to avoid
complex trickery trying to decide whether gnus must quote the filenames, we
could provide a user-variable.

Thoughts ?

-- 
    /     /   _   _       Didier Verna       http://www.lrde.epita.fr/~didier
 - / / - / / /_/ /        EPITA / LRDE         mailto:didier@lrde.epita.fr
/_/ / /_/ / /__ /      14-16 rue Voltaire        Tel. +33 (1) 53 14 59 47
                   94276 Kremlin-Bicêtre cedex   Fax. +33 (1) 44 08 01 99



^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [MAILCAP] filename quoting
  2001-02-27 18:23 [MAILCAP] filename quoting Didier Verna
@ 2001-02-27 18:44 ` Didier Verna
  2001-02-27 22:09   ` Kai Großjohann
  0 siblings, 1 reply; 7+ messages in thread
From: Didier Verna @ 2001-02-27 18:44 UTC (permalink / raw)


I wrote:

>         I'd like suggestions on the better way to fix this. In order to
> avoid complex trickery trying to decide whether gnus must quote the
> filenames, we could provide a user-variable.
> 
> Thoughts ?

        After some more thinking, the following solution might be the simplest
one. If there's no objection, I'll apply it:


Index: mm-decode.el
===================================================================
RCS file: /usr/local/cvsroot/gnus/lisp/mm-decode.el,v
retrieving revision 6.30
diff -u -w -r6.30 mm-decode.el
--- mm-decode.el	2001/01/21 06:00:23	6.30
+++ mm-decode.el	2001/02/27 18:37:14
@@ -588,7 +588,8 @@
 	(beg 0)
 	(uses-stdin t)
 	out sub total)
-    (while (string-match "%{\\([^}]+\\)}\\|%s\\|%t\\|%%" method beg)
+    (while (string-match "%{\\([^}]+\\)}\\|%s\\|'%s'\\|%t\\|'%t'\\|%%"
+			 method beg)
       (push (substring method beg (match-beginning 0)) out)
       (setq beg (match-end 0)
 	    total (match-string 0 method)
@@ -596,10 +597,10 @@
       (cond
        ((string= total "%%")
 	(push "%" out))
-       ((string= total "%s")
+       ((or (string= total "%s") (string= total "'%s'"))
 	(setq uses-stdin nil)
 	(push (mm-quote-arg file) out))
-       ((string= total "%t")
+       ((or (string= total "%t") (string= total "'%t'"))
 	(push (mm-quote-arg (car type-list)) out))
        (t
 	(push (mm-quote-arg (or (cdr (assq (intern sub) ctl)) "")) out))))


-- 
    /     /   _   _       Didier Verna       http://www.lrde.epita.fr/~didier
 - / / - / / /_/ /        EPITA / LRDE         mailto:didier@lrde.epita.fr
/_/ / /_/ / /__ /      14-16 rue Voltaire        Tel. +33 (1) 53 14 59 47
                   94276 Kremlin-Bicêtre cedex   Fax. +33 (1) 44 08 01 99



^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [MAILCAP] filename quoting
  2001-02-27 18:44 ` Didier Verna
@ 2001-02-27 22:09   ` Kai Großjohann
  2001-02-28  8:18     ` Didier Verna
  0 siblings, 1 reply; 7+ messages in thread
From: Kai Großjohann @ 2001-02-27 22:09 UTC (permalink / raw)


On 27 Feb 2001, Didier Verna wrote:

> After some more thinking, the following solution might be the
> simplest one. If there's no objection, I'll apply it:

I'm not sure I understand the code.  I guess it looks for '%s' in the
mailcap file and then does something special.  Does it omit the call
to mm-quote-arg?  Or does it replace '%s' with %s and then do
mm-quote-arg?

I think it might forget to look for "%s" in addition to '%s' -- some
people might have the double quotes rather than single quotes.

kai
-- 
Be indiscrete.  Do it continuously.



^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [MAILCAP] filename quoting
  2001-02-27 22:09   ` Kai Großjohann
@ 2001-02-28  8:18     ` Didier Verna
  2001-02-28 15:41       ` Kai Großjohann
  0 siblings, 1 reply; 7+ messages in thread
From: Didier Verna @ 2001-02-28  8:18 UTC (permalink / raw)
  Cc: Gnus Beta Testers

Kai.Grossjohann@CS.Uni-Dortmund.DE (Kai Großjohann) wrote:

> I'm not sure I understand the code.  I guess it looks for '%s' in the
> mailcap file and then does something special.  Does it omit the call
> to mm-quote-arg?  Or does it replace '%s' with %s and then do
> mm-quote-arg?

        Previously, the code was only scanning %s's and replacing occurences
with the mm-quoted filename. Hence you could get 'quoted-filename'. With my
patch, it also looks for '%s', in which case the quotes will be eaten,
resulting in just the quoted-filename.

> I think it might forget to look for "%s" in addition to '%s' -- some
> people might have the double quotes rather than single quotes.

        I guess you're probably right.

        What still bothers me in this solution is that we're somewhat doing
the shell's job in understanding and processing its quoting syntax. That still
remains affordable in those simple cases, however.

-- 
    /     /   _   _       Didier Verna       http://www.lrde.epita.fr/~didier
 - / / - / / /_/ /        EPITA / LRDE         mailto:didier@lrde.epita.fr
/_/ / /_/ / /__ /      14-16 rue Voltaire        Tel. +33 (1) 53 14 59 47
                   94276 Kremlin-Bicêtre cedex   Fax. +33 (1) 44 08 01 99



^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [MAILCAP] filename quoting
  2001-02-28  8:18     ` Didier Verna
@ 2001-02-28 15:41       ` Kai Großjohann
  2001-02-28 16:10         ` Toby Speight
  0 siblings, 1 reply; 7+ messages in thread
From: Kai Großjohann @ 2001-02-28 15:41 UTC (permalink / raw)


On 28 Feb 2001, Didier Verna wrote:

> What still bothers me in this solution is that we're somewhat doing
> the shell's job in understanding and processing its quoting
> syntax. That still remains affordable in those simple cases,
> however.

Yes.  There needs to be an agreement between different programs on
what should be in ~/.mailcap.  Maybe comp.mail.mime is the right place
to discuss that?

Failing any other possibility, we could either decide to do whatever
the metamail package does, or we could decide to do the Right Thing
(tm) -- having Gnus quote the file names.

Thoughts?

kai
-- 
Be indiscrete.  Do it continuously.



^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [MAILCAP] filename quoting
  2001-02-28 15:41       ` Kai Großjohann
@ 2001-02-28 16:10         ` Toby Speight
  2001-02-28 20:06           ` Kai Großjohann
  0 siblings, 1 reply; 7+ messages in thread
From: Toby Speight @ 2001-02-28 16:10 UTC (permalink / raw)


0> In article <vafy9uqu85h.fsf@lucy.cs.uni-dortmund.de>,
0> Kai Großjohann <URL:mailto:Kai.Grossjohann@CS.Uni-Dortmund.DE> ("Kai") wrote:

Kai> Failing any other possibility, we could either decide to do
Kai> whatever the metamail package does, or we could decide to do the
Kai> Right Thing (tm) -- having Gnus quote the file names.

I'm not sure what you mean here.  If you mean that Gnus should transform
filenames to something innocuous to the shell and use the transformed
name everywhere, rather than attempting to cope with all the shells'
variations, then I'm all for it.  For example, we could use URL-style
hexadecimal encoding for "dangerous" characters.



^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [MAILCAP] filename quoting
  2001-02-28 16:10         ` Toby Speight
@ 2001-02-28 20:06           ` Kai Großjohann
  0 siblings, 0 replies; 7+ messages in thread
From: Kai Großjohann @ 2001-02-28 20:06 UTC (permalink / raw)
  Cc: The Gnus Mailing List

On 28 Feb 2001, Toby Speight wrote:
> 0> In article <vafy9uqu85h.fsf@lucy.cs.uni-dortmund.de>, Kai
> 0> Großjohann <URL:mailto:Kai.Grossjohann@CS.Uni-Dortmund.DE>
> 0> ("Kai") wrote:
> 
> Kai> Failing any other possibility, we could either decide to do
> Kai> whatever the metamail package does, or we could decide to do
> Kai> the Right Thing (tm) -- having Gnus quote the file names.
> 
> I'm not sure what you mean here.  If you mean that Gnus should
> transform filenames to something innocuous to the shell and use the
> transformed name everywhere, rather than attempting to cope with all
> the shells' variations, then I'm all for it.  For example, we could
> use URL-style hexadecimal encoding for "dangerous" characters.

This is not what I meant, but it's a great suggestion!  Let's do it!
It's obviously the right way to do it.

Thanks for the suggestion!

kai
-- 
Be indiscrete.  Do it continuously.



^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2001-02-28 20:06 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-02-27 18:23 [MAILCAP] filename quoting Didier Verna
2001-02-27 18:44 ` Didier Verna
2001-02-27 22:09   ` Kai Großjohann
2001-02-28  8:18     ` Didier Verna
2001-02-28 15:41       ` Kai Großjohann
2001-02-28 16:10         ` Toby Speight
2001-02-28 20:06           ` Kai Großjohann

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).