Package: man-db
Version: 2.7.2-1
Severity: normal

Current "man -a" uses /dev/tty unconditionally. This means no way to use
for scripting usage, or such.

For example, emacs can view all manpages via (setq Man-switches "-a").
With this configuration, emacs does 

        man -a <name> | post-process

But current man version asks via /dev/tty in background, and bother emacs.

Also simple example is,

        $ man -a <name> | less

Older versions can show all manpages as contiguous file. Current version
ask to user via /dev/tty in background from man command, totally useless.

The following patch restores the behavior of older version.

Thanks.

 src/man.c |    4 ++++
 1 file changed, 4 insertions(+)

diff -puN src/man.c~script-usage-fix src/man.c
--- man-db-2.7.2/src/man.c~script-usage-fix     2015-09-05 23:16:15.120264227 
+0900
+++ man-db-2.7.2-hirofumi/src/man.c     2015-09-05 23:28:19.507147470 +0900
@@ -2015,6 +2015,10 @@ static inline int do_prompt (const char
        FILE *tty = NULL;
 
        skip = 0;
+       /* If no interactive, choose "view" without asking */
+       if (!isatty (STDOUT_FILENO) || !isatty (STDIN_FILENO))
+               return 0;
+
        tty = fopen ("/dev/tty", "r+");
        if (!tty)
                return 0;
_


-- System Information:
Debian Release: stretch/sid
  APT prefers testing-proposed-updates
  APT policy: (500, 'testing-proposed-updates'), (500, 'testing')
Architecture: amd64 (x86_64)
Foreign Architectures: i386

Kernel: Linux 3.18.5 (SMP w/8 CPU cores)
Locale: LANG=ja_JP.UTF-8, LC_CTYPE=ja_JP.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/bash
Init: sysvinit (via /sbin/init)

Versions of packages man-db depends on:
ii  bsdmainutils           9.0.6
ii  debconf [debconf-2.0]  1.5.57
ii  dpkg                   1.18.2
ii  groff-base             1.22.3-1
ii  libc6                  2.19-19
ii  libgdbm3               1.8.3-13.1
ii  libpipeline1           1.4.1-1
ii  zlib1g                 1:1.2.8.dfsg-2+b1

man-db recommends no packages.

Versions of packages man-db suggests:
ii  epiphany-browser [www-browser]  3.16.3-1
ii  groff                           1.22.3-1
ii  less                            458-3
ii  lynx-cur [www-browser]          2.8.9dev6-3
ii  w3m [www-browser]               0.5.3-24

-- debconf information:
* man-db/install-setuid: false
  man-db/auto-update: true

-- 
OGAWA Hirofumi <hirof...@mail.parknet.co.jp>

Reply via email to