Gnus development mailing list
 help / color / mirror / Atom feed
* Simple "view this image externally" question
@ 2009-07-09 21:03 Paul R
  2009-07-09 23:35 ` Katsumi Yamaoka
  0 siblings, 1 reply; 5+ messages in thread
From: Paul R @ 2009-07-09 21:03 UTC (permalink / raw)
  To: ding

Hi,

I can't display externally any image when the name contains space.
I haven't investigated much but I suspect the default viewer ("display",
from image-magick) to be run without quoting the temp file name nor
escaping spaces. I had a quick look at gnus and multimedia customization
but I did not find any variable that could fix that.

As an interesting data point, dired does not suffer from this problem
when using dired-display-image-externaly (or so...).

Could some kind and knowlegable soul do something about that please ?

-- 
  Paul



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

* Re: Simple "view this image externally" question
  2009-07-09 21:03 Simple "view this image externally" question Paul R
@ 2009-07-09 23:35 ` Katsumi Yamaoka
  2009-07-10 19:40   ` Ted Zlatanov
  2009-07-13  9:40   ` Paul R
  0 siblings, 2 replies; 5+ messages in thread
From: Katsumi Yamaoka @ 2009-07-09 23:35 UTC (permalink / raw)
  To: ding

>>>>> Paul R wrote:
> I can't display externally any image when the name contains space.
> I haven't investigated much but I suspect the default viewer ("display",
> from image-magick) to be run without quoting the temp file name nor
> escaping spaces. I had a quick look at gnus and multimedia customization
> but I did not find any variable that could fix that.

> As an interesting data point, dired does not suffer from this problem
> when using dired-display-image-externaly (or so...).

> Could some kind and knowlegable soul do something about that please ?

I don't know what `dired-display-image-externaly' is, but one
possibility is that the program Gnus uses to display images is
a shell script.  Is it the real "display" executable?  To verify
it, try evaluating the following forms (for example):

(mailcap-mime-info "image/png")
 => "display %s"

(executable-find "display")
 => "/usr/local/bin/display"

And examine the type of the program:

% file /usr/local/bin/display
 => /usr/local/bin/display: ELF 32-bit LSB executable,...

Gnus should quote space as follows:

(mm-mailcap-command "display %s" "file name.png"
		    '("image/png" (name . "file name.png")))
 => "display file\\ name.png"

However, if "display" is a shell script, the quotes in the file
name likely get disappeared when the shell script passes it to
the real command.

Maybe one solution is to make the ~/.mailcap file have the entry
like:

image/*; /usr/local/bin/display %s

To reflect it immediately, use `M-x mailcap-parse-mailcaps RET'.



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

* Re: Simple "view this image externally" question
  2009-07-09 23:35 ` Katsumi Yamaoka
@ 2009-07-10 19:40   ` Ted Zlatanov
  2009-07-13  1:16     ` Katsumi Yamaoka
  2009-07-13  9:40   ` Paul R
  1 sibling, 1 reply; 5+ messages in thread
From: Ted Zlatanov @ 2009-07-10 19:40 UTC (permalink / raw)
  To: ding

On Fri, 10 Jul 2009 08:35:28 +0900 Katsumi Yamaoka <yamaoka@jpl.org> wrote: 

KY> Gnus should quote space as follows:

KY> (mm-mailcap-command "display %s" "file name.png"
KY> 		    '("image/png" (name . "file name.png")))
KY>  => "display file\\ name.png"

KY> However, if "display" is a shell script, the quotes in the file
KY> name likely get disappeared when the shell script passes it to
KY> the real command.

Do you mean that if the image is named "; rm -rf /" Gnus will run
"display ; rm -rf /"?

Ted




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

* Re: Simple "view this image externally" question
  2009-07-10 19:40   ` Ted Zlatanov
@ 2009-07-13  1:16     ` Katsumi Yamaoka
  0 siblings, 0 replies; 5+ messages in thread
From: Katsumi Yamaoka @ 2009-07-13  1:16 UTC (permalink / raw)
  To: ding

>>>>> Ted Zlatanov wrote:
> Do you mean that if the image is named "; rm -rf /" Gnus will run
> "display ; rm -rf /"?

It won't happen for good or for evil at least in the UNIX-like
system.  When playing a part using an external command, Gnus
writes its contents to a temp file and passes the temp file name
to the command.  The temp file name is generated based on the one
that is the right side of "/".  Cf.:

(defun gnus-insert-mime-button (handle gnus-tmp-id &optional displayed)
	     ""))
[...]
    (when (string-match ".*/" gnus-tmp-name)
      (setq gnus-tmp-name (replace-match "" t t gnus-tmp-name)))

Similarly the file name "; rm -fr /home/who/Mail" will cause no
harm.  I don't know what DOS machines do with the name `c:\', though.



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

* Re: Simple "view this image externally" question
  2009-07-09 23:35 ` Katsumi Yamaoka
  2009-07-10 19:40   ` Ted Zlatanov
@ 2009-07-13  9:40   ` Paul R
  1 sibling, 0 replies; 5+ messages in thread
From: Paul R @ 2009-07-13  9:40 UTC (permalink / raw)
  To: ding

Hi Katsumi,

Katsumi> I don't know what `dired-display-image-externaly' is, but one
Katsumi> possibility is that the program Gnus uses to display images is
Katsumi> a shell script. Is it the real "display" executable? To verify
Katsumi> it, try evaluating the following forms (for example):
Katsumi> [...]

Thank you for the recipe. It appears that (mailcap-mime-info
"image/png") yields "display 'png:%s'" and 'display' is a regular ELF
32-bit LSB executable. I will investigate more and report here.

-- 
  Paul



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

end of thread, other threads:[~2009-07-13  9:40 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-07-09 21:03 Simple "view this image externally" question Paul R
2009-07-09 23:35 ` Katsumi Yamaoka
2009-07-10 19:40   ` Ted Zlatanov
2009-07-13  1:16     ` Katsumi Yamaoka
2009-07-13  9:40   ` Paul R

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