Re: [ANNOUNCE] mutt 1.5.16 released
On 2007-06-17 10:20:43 -0600, Kyle Wheeler wrote:
> Well, he may not (and, if he doesn't use OSX, he shouldn't have to),
> but I can:
>
> image/*; open %s; copiousoutput; nametemplate=%s.jpg
> text/html; elinks -dump -force-html %s; needsterminal; copiousoutput;
> application/pdf; open %s; copiousoutput; nametemplate=%s.pdf
> application/msword; open %s; copiousoutput; nametemplate=%s.doc
> application/excel; open %s; copiousoutput; nametemplate=%s.xls
Before giving rules, perhaps you should make sure that they really
work everywhere. I can tell you that this doesn't work on my machine,
at least for PDF. You have a race condition here: the "open" command
can return before the application (here, Preview) loads the file. And
as just after "open" returns, Mutt zeros the file and removes it, the
application can get nothing or corrupt data to load. The fact that
my machine is a fast bi-processor machine can have an impact on the
probability of failure. But I suggest that you try that on such a
machine (if you can) with Preview already loaded.
Another point is that the "open" command is under-specified (and doesn't
always use the extension to determine the filetype). So, using "open"
without more checking concerning what the file really contains to make
sure the wanted application is launched is a bit weak on the security
side.
> Now, granted, I have a few more entries in there than just that, and
> I have a bunch of test= settings so that I can use my mailcap
> unchanged across lots of different computers, but those entries
> above will work just fine, with nary a line of code in sight.
I also need a mailcap that works on various machines, where the
current environment is an X11 one or not (hence the test of the
DISPLAY environment variable).
> Granted, I also *assume* that elinks exists and is installed, but since I'm
> the guy that installed it, I think that's safe to assume. But its easy to
> add test= entries, like so:
>
> text/html; elinks -dump -force-html %s; needsterminal; copiousoutput;
> test=type elinks &> /dev/null
> text/html; links -dump -force-html %s; needsterminal; copiousoutput;
> test=type links &> /dev/null
> text/html; lynx -dump -force-html %s; needsterminal; copiousoutput;
> test=type lynx &> /dev/null
>
> Is that code? I don't think so, but... maybe to some people it seems like
> code.
I don't see why
type lynx &> /dev/null
isn't regarded as code while
vi "$@"; true
would be regarded as code.
--
Vincent Lefèvre <vincent@xxxxxxxxxx> - Web: <http://www.vinc17.org/>
100% accessible validated (X)HTML - Blog: <http://www.vinc17.org/blog/>
Work: CR INRIA - computer arithmetic / Arenaire project (LIP, ENS-Lyon)