Package: fbi
Version: 2.09-1+b1
Severity: minor
Tags: patch

Hello,

This bug report is a summary of bugs 537696, 644996, 644997 and 683462
exhibiting variations of the same problem.

Fbi is an application that applies only to the linux console with a
kernel that supports framebuffer device. He does not accept to run in
pseudo-terminals (pts, tmux, screen...), over SSH or without the framebuffer
device.

So programs that bases on the mime type and mailcap could easily call Fbi in
the wrong context. Currently the mailcap is:

   image/jpeg; fbi '%s'; test=test -z "$DISPLAY"; needsterminal;


The proposed solutions are: 

a) (537696: Trent W. Buck)

   A crappy but simple extension is to check for the screen session (STY) as
   is done for the X session (DISPLAY):

   image/jpeg; fbi '%s'; test=test -z "$DISPLAY$STY"; needsterminal;


b) (537696: Trent W. Buck)

   test -z "$DISPLAY" &&
      ( test 0 -eq $EUID ||
       fgrep -qx `tty | cut -d/ -f3` /etc/securetty )

   This case needs some other change, as running fbgs as root in an xterm
   doesn't work either (Vincent Lefevre).


d) (644997: Vincent Lefevre)

   Fbi should provide a binary that would only test whether fbi can work by
   doing a "ioctl VT_GETSTATE". That would avoid guessing what test to use and
   would be more reliable.


Personal conclusion:

(a) is to be rejected, (b) is a good start but (c) is better. (d) seems to be
the ideal solution (add a Fbi "--testmailcap" option), but it would be better
to find a solution independent of the software (another example: links -g).

I therefore propose as a first step the following solution, an improvement
of (c), which takes into account whether the framebuffer device is available
(change mailcap file fbi.mime of the package):

   image/*; fbi '%s'; test=test -z "$DISPLAY" -a "$TERM" = linux -a -c 
/dev/fb0; needsterminal;

Regards,


-- System Information:
Debian Release: jessie/sid
  APT prefers testing-updates
  APT policy: (500, 'testing-updates'), (500, 'testing')
Architecture: amd64 (x86_64)

Kernel: Linux 3.16-3-amd64 (SMP w/2 CPU cores)
Locale: LANG=fr_FR.UTF-8, LC_CTYPE=fr_FR.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash

Versions of packages fbi depends on:
ii  ghostscript      9.06~dfsg-1.1+b1
ii  libc6            2.19-12
ii  libcurl3-gnutls  7.38.0-2
ii  libexif12        0.6.21-2
ii  libfontconfig1   2.11.0-6.1
ii  libfreetype6     2.5.2-2
ii  libgif4          4.1.6-11
ii  libjpeg62-turbo  1:1.3.1-8
ii  libpng12-0       1.2.50-2
ii  libtiff5         4.0.3-10+b2
ii  zlib1g           1:1.2.8.dfsg-2

fbi recommends no packages.

Versions of packages fbi suggests:
ii  imagemagick  8:6.8.9.6-4+b1

-- no debconf information


-- 
Stéphane Aulery
--- fbi.mime.origin	2014-10-29 18:05:37.311982961 +0100
+++ fbi.mime.new	2014-10-29 18:50:45.585412563 +0100
@@ -1,36 +1,44 @@
-image/gif; fbi '%s'; test=test -z "$DISPLAY"; needsterminal;
-image/jpeg; fbi '%s'; test=test -z "$DISPLAY"; needsterminal;
-image/png; fbi '%s'; test=test -z "$DISPLAY"; needsterminal;
-image/tiff; fbi '%s'; test=test -z "$DISPLAY"; needsterminal;
-image/x-xwindowdump; fbi '%s'; test=test -z "$DISPLAY"; needsterminal;
-image/x-portable-pixmap; fbi '%s'; test=test -z "$DISPLAY"; needsterminal;
-image/bmp; fbi '%s'; test=test -z "$DISPLAY"; needsterminal;
-image/x-ms-bmp; fbi '%s'; test=test -z "$DISPLAY"; needsterminal;
-image/x-photo-cd; fbi '%s'; test=test -z "$DISPLAY"; needsterminal;
-image/pnm; fbi '%s'; test=test -z "$DISPLAY"; needsterminal;
-image/xpm; fbi '%s'; test=test -z "$DISPLAY"; needsterminal;
-image/avs; fbi '%s'; test=test -z "$DISPLAY"; needsterminal;
-image/dcx; fbi '%s'; test=test -z "$DISPLAY"; needsterminal;
-image/fax; fbi '%s'; test=test -z "$DISPLAY"; needsterminal;
-image/fits; fbi '%s'; test=test -z "$DISPLAY"; needsterminal;
-image/x-fits; fbi '%s'; test=test -z "$DISPLAY"; needsterminal;
-image/pjpeg; fbi '%s'; test=test -z "$DISPLAY"; needsterminal;
-image/mtv; fbi '%s'; test=test -z "$DISPLAY"; needsterminal;
-image/x-portable-bitmap; fbi '%s'; test=test -z "$DISPLAY"; needsterminal;
-image/pcd; fbi '%s'; test=test -z "$DISPLAY"; needsterminal;
-image/pcx; fbi '%s'; test=test -z "$DISPLAY"; needsterminal;
-image/x-portable-graymap; fbi '%s'; test=test -z "$DISPLAY"; needsterminal;
-image/pict; fbi '%s'; test=test -z "$DISPLAY"; needsterminal;
-image/x-portable-anymap; fbi '%s'; test=test -z "$DISPLAY"; needsterminal;
-image/x-rgb; fbi '%s'; test=test -z "$DISPLAY"; needsterminal;
-image/sgi; fbi '%s'; test=test -z "$DISPLAY"; needsterminal;
-image/x-sgi; fbi '%s'; test=test -z "$DISPLAY"; needsterminal;
-image/sun-raster; fbi '%s'; test=test -z "$DISPLAY"; needsterminal;
-image/x-sun-raster; fbi '%s'; test=test -z "$DISPLAY"; needsterminal;
-image/viff; fbi '%s'; test=test -z "$DISPLAY"; needsterminal;
-image/x-xbitmap; fbi '%s'; test=test -z "$DISPLAY"; needsterminal;
-image/x-xpixmap; fbi '%s'; test=test -z "$DISPLAY"; needsterminal;
-image/x-icon; fbi '%s'; test=test -z "$DISPLAY"; needsterminal;
-application/pdf; fbgs -c '%s'; test=test -z "$DISPLAY"; needsterminal;
-application/postscript; fbgs -c '%s'; test=test -z "$DISPLAY"; needsterminal;
-image/x-eps; fbgs -c '%s'; test=test -z "$DISPLAY"; needsterminal;
+# fbi specific limitations
+# test "$TERM" = linux      Must be launched in a linux console (except option -T)
+# test -c /dev/fb0          Need a kernel providing a framebuffer device
+#
+image/gif; fbi '%s'; test=test -z "$DISPLAY" -a "$TERM" = linux -a -c /dev/fb0; needsterminal;
+image/jpeg; fbi '%s'; test=test -z "$DISPLAY" -a "$TERM" = linux -a -c /dev/fb0; needsterminal;
+image/png; fbi '%s'; test=test -z "$DISPLAY" -a "$TERM" = linux; needsterminal;
+image/tiff; fbi '%s'; test=test -z "$DISPLAY" -a "$TERM" = linux; needsterminal;
+image/x-xwindowdump; fbi '%s'; test=test -z "$DISPLAY" -a "$TERM" = linux; needsterminal;
+image/x-portable-pixmap; fbi '%s'; test=test -z "$DISPLAY" -a "$TERM" = linux; needsterminal;
+image/bmp; fbi '%s'; test=test -z "$DISPLAY" -a "$TERM" = linux; needsterminal;
+image/x-ms-bmp; fbi '%s'; test=test -z "$DISPLAY" -a "$TERM" = linux; needsterminal;
+image/x-photo-cd; fbi '%s'; test=test -z "$DISPLAY" -a "$TERM" = linux; needsterminal;
+image/pnm; fbi '%s'; test=test -z "$DISPLAY" -a "$TERM" = linux -a -c /dev/fb0; needsterminal;
+image/xpm; fbi '%s'; test=test -z "$DISPLAY" -a "$TERM" = linux -a -c /dev/fb0; needsterminal;
+image/avs; fbi '%s'; test=test -z "$DISPLAY" -a "$TERM" = linux -a -c /dev/fb0; needsterminal;
+image/dcx; fbi '%s'; test=test -z "$DISPLAY" -a "$TERM" = linux -a -c /dev/fb0; needsterminal;
+image/fax; fbi '%s'; test=test -z "$DISPLAY" -a "$TERM" = linux -a -c /dev/fb0; needsterminal;
+image/fits; fbi '%s'; test=test -z "$DISPLAY" -a "$TERM" = linux -a -c /dev/fb0; needsterminal;
+image/x-fits; fbi '%s'; test=test -z "$DISPLAY" -a "$TERM" = linux -a -c /dev/fb0; needsterminal;
+image/pjpeg; fbi '%s'; test=test -z "$DISPLAY" -a "$TERM" = linux -a -c /dev/fb0; needsterminal;
+image/mtv; fbi '%s'; test=test -z "$DISPLAY" -a "$TERM" = linux -a -c /dev/fb0; needsterminal;
+image/x-portable-bitmap; fbi '%s'; test=test -z "$DISPLAY" -a "$TERM" = linux -a -c /dev/fb0; needsterminal;
+image/pcd; fbi '%s'; test=test -z "$DISPLAY" -a "$TERM" = linux -a -c /dev/fb0; needsterminal;
+image/pcx; fbi '%s'; test=test -z "$DISPLAY" -a "$TERM" = linux -a -c /dev/fb0; needsterminal;
+image/x-portable-graymap; fbi '%s'; test=test -z "$DISPLAY" -a "$TERM" = linux -a -c /dev/fb0; needsterminal;
+image/pict; fbi '%s'; test=test -z "$DISPLAY" -a "$TERM" = linux -a -c /dev/fb0; needsterminal;
+image/x-portable-anymap; fbi '%s'; test=test -z "$DISPLAY" -a "$TERM" = linux -a -c /dev/fb0; needsterminal;
+image/x-rgb; fbi '%s'; test=test -z "$DISPLAY" -a "$TERM" = linux -a -c /dev/fb0; needsterminal;
+image/sgi; fbi '%s'; test=test -z "$DISPLAY" -a "$TERM" = linux -a -c /dev/fb0; needsterminal;
+image/x-sgi; fbi '%s'; test=test -z "$DISPLAY" -a "$TERM" = linux -a -c /dev/fb0; needsterminal;
+image/sun-raster; fbi '%s'; test=test -z "$DISPLAY" -a "$TERM" = linux -a -c /dev/fb0; needsterminal;
+image/x-sun-raster; fbi '%s'; test=test -z "$DISPLAY" -a "$TERM" = linux -a -c /dev/fb0; needsterminal;
+image/viff; fbi '%s'; test=test -z "$DISPLAY" -a "$TERM" = linux -a -c /dev/fb0; needsterminal;
+image/x-xbitmap; fbi '%s'; test=test -z "$DISPLAY" -a "$TERM" = linux -a -c /dev/fb0; needsterminal;
+image/x-xpixmap; fbi '%s'; test=test -z "$DISPLAY" -a "$TERM" = linux -a -c /dev/fb0; needsterminal;
+image/x-icon; fbi '%s'; test=test -z "$DISPLAY" -a "$TERM" = linux -a -c /dev/fb0; needsterminal;
+#
+# fbgs, which use fbi, has the same limitations
+# fbgs use options -c and -xxl for color mode and high resolution
+#
+application/pdf; fbgs -c -xxl '%s'; test=test -z "$DISPLAY" -a "$TERM" = linux -a -c /dev/fb0; needsterminal;
+application/postscript; fbgs -c -xxl '%s'; test=test -z "$DISPLAY" -a "$TERM" = linux -a -c /dev/fb0; needsterminal;
+image/x-eps; fbgs -c -xxl '%s'; test=test -z "$DISPLAY" -a "$TERM" = linux -a -c /dev/fb0; needsterminal;

Reply via email to