#767544 fbi: Fix mailcap to not use Fbi off a linux console with Frambuffer

Package:
fbi
Source:
fbi
Description:
Linux frame buffer image viewer
Submitter:
Stéphane Aulery
Date:
2014-11-01 23:39:08 UTC
Severity:
minor
#767544#5
Date:
2014-11-01 00:23:35 UTC
From:
To:
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,

#767544#20
Date:
2014-11-01 08:49:16 UTC
From:
To:
I wonder whether -a is accepted by all "test" implementations. This
feature is obsolescent in POSIX:

http://pubs.opengroup.org/onlinepubs/9699919799/utilities/test.html

BTW, I wonder why all these bugs can't be merged. The merge seems
to have been accepted in the BTS (before the unmerge).

#767544#25
Date:
2014-11-01 13:18:24 UTC
From:
To:
Le samedi 01 novembre 2014 à 09:49:16, Vincent Lefevre a écrit :

Sorry, I only read the manpage delivered by debian to write this line.
This is not documented. This should work:

   (test -z "$DISPLAY") && (test "$TERM" = linux) && (test -c /dev/fb0)

I wanted this bug (767544) becomes the principal and the other attached to it.
It seems that the "merge" connects all to the oldest bug. Are there a way to
do what I want?

#767544#30
Date:
2014-11-01 14:58:23 UTC
From:
To:
You shouldn't need parentheses; they run the command in a subshell.

I don't think that there is a "principal bug".

#767544#35
Date:
2014-11-01 23:33:48 UTC
From:
To:
Le samedi 01 novembre 2014 à 03:58:23, Vincent Lefevre a écrit :

test -z "$DISPLAY" && test "$TERM" = linux && test -c /dev/fb0

Like this then.

The web interface displays one of the merged bug without changing over time.
I think the oldest is the default choice. It is still problematic for the
display of threads because they are not merged. I have had to merge and post
the summary on the oldest bug.