#681305 lynx-cur: broken handling of copiousoutput /etc/mailcap entries (e.g. for archives)

#681305#5
Date:
2012-07-12 08:35:37 UTC
From:
To:
lynx doesn't behave correctly when downloading a file (such as tar
and zip archives) that has a /etc/mailcap entry with a copiousoutput
parameter, e.g.

application/zip; unzip -l '%s'; nametemplate=%s.zip; copiousoutput

I expect the file to be downloaded. Instead, the contents are listed
on the terminal, but don't appear in the alternate screen[*] (which
lynx uses), so that they are immediately erased.

[*] when supported by the terminal, such as xterm.

So, there are 2 problems:

1. lynx doesn't offer the choice to download the file (I don't know
whether this is configurable, but giving the choice should be the
default, like with other browsers).

2. If lynx wants to support the copiousoutput entries, it should get
the results via a pipe.

Note: lynx currently freeze for tar archives, but this is a bug in
the tar mailcap entries (a Ctrl-C interrupts tar). I've reported the
bug here:

http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=681302

#681305#10
Date:
2012-08-16 09:02:06 UTC
From:
To:
this is a useful suggestion; per guidelines it should have been categorized
as wishlist

#681305#15
Date:
2012-08-16 09:02:06 UTC
From:
To:
this is a useful suggestion; per guidelines it should have been categorized
as wishlist

#681305#20
Date:
2013-01-02 19:04:35 UTC
From:
To:
This wishlist item may be more important than it seems as the bug also
breaks the w3m text browser. More than once, I've left a huge download
running and came back to find nothing but a list of files splatted to my
screen.

It just doesn't make sense that Debian's default method of handling
archives is to show the table of contents and then discard the contents.

Fortunately, a quick fix (at least for w3m) is easy. One can comment out
the broken lines in /etc/mailcap:

# It is better to not pretend to know how to deal with archives.
#application/x-tar; /bin/tar tvf -; print=/bin/tar tvf - | print
text/plain:-; copiousoutput
#application/x-gtar; /bin/tar tvzf -; print=/bin/tar tvzf - | print
text/plain:-; copiousoutput
#application/zip; unzip -l '%s'; nametemplate=%s.zip; copiousoutput

I'm sure there's a more correct fix, but I'd be surprised if this patch
causes any problems.

#681305#25
Date:
2013-01-02 20:13:03 UTC
From:
To:
This may cause problems when upgrading or removing packages.
There may be alternate workarounds; see the mailcap.order(5)
man page.

#681305#30
Date:
2013-01-08 20:27:39 UTC
From:
To:
Yes, of course my suggestion is just a temporary fix. As soon as
update-mime is rerun, /etc/mailcap is over written. The best fix would be
if the unzip and tar packages did not come with mime entries in
/usr/lib/mime/packages/.

Unfortunately, it seems a local administrator has no way to make a
permanent fix in Debian. The order of entries can be changed with
mailcap.order, but that does not appear to do what we want, which is to
remove all mailcap entries for the archive mimetypes.

Please let me know if I am wrong about this.