Package: pinfo
Version: 0.6.9-5.1
Severity: normal

Dear Maintainer,

I've been testing a local Bourne shell script that uses 'iselect' in a
'while' loop that calls 'pinfo'.  When the script opens a file as a
command line argument, 'pinfo' works correctly.  When the script inputs
from STDIN, 'pinfo' consistently hangs.  (i.e. the first screen of data
is shown, but no pager keys work.  'Ctrl-C' to exit works.)  The one line
of code that calls 'pinfo' remains the same, hang or no hang.

This code simulates the hang:

        # close STDIN, run pinfo
        % pinfo dash <&-

Maybe 'pinfo' requires an empty and open STDIN.

I used 'strace' and 'diff' to compare good and bad 'pinfo' runs. The
good run succeeds with this call:

    select(1, [0], NULL, NULL, {0, 0})      = 0 (Timeout)

...while the bad run fails with it, just before some sort of infinite
loop:

    select(1, [0], NULL, NULL, {0, 0})      = 1 (in [0], left {0, 0})

'man select' describes a potential 'select' hang, or race condition, and 
a related 'pselect' fix:

  % man select | grep -A 7 "reason that pselect"

    The reason that pselect() is needed is that if one wants to wait for either 
 a
    signal or for a file descriptor to become ready, then an atomic test is 
needed
    to prevent race conditions.  (Suppose the signal handler sets  a  global  
flag
    and  returns.   Then a test of this global flag followed by a call of 
select()
    could hang indefinitely if the signal arrived just after  the  test  but  
just
    before  the  call.   By contrast, pselect() allows one to first block 
signals,
    handle the signals that have come in, then call  pselect()  with  the  
desired
    sigmask, avoiding the race.)

Other pagers don't fail this way: 'man dash <&-' works fine.  

HTH...


-- System Information:
Debian Release: wheezy/sid
  APT prefers unstable
  APT policy: (500, 'unstable'), (1, 'experimental')
Architecture: i386 (i686)

Kernel: Linux 3.2.0-2-686-pae (SMP w/2 CPU cores)
Locale: LANG=C, LC_CTYPE=C (charmap=ANSI_X3.4-1968) (ignored: LC_ALL set to C)
Shell: /bin/sh linked to /bin/dash

Versions of packages pinfo depends on:
ii  install-info  4.13a.dfsg.1-10
ii  libc6         2.13-31
ii  libncursesw5  5.9-7
ii  libreadline6  6.2-8
ii  libtinfo5     5.9-7

pinfo recommends no packages.

Versions of packages pinfo suggests:
ii  balsa [mail-reader]         2.4.11-1
ii  bsd-mailx [mail-reader]     8.1.2-0.20111106cvs-1
ii  claws-mail [mail-reader]    3.8.0-1
ii  cups-bsd [lpr]              1.5.2-10
ii  dillo [www-browser]         3.0.2-2
ii  elinks [www-browser]        0.12~pre5-7
ii  galeon [www-browser]        2.0.7-2.1+b1
ii  iceape [www-browser]        2.7.4-1
ii  iceweasel [www-browser]     10.0.4esr-2
ii  konqueror [www-browser]     4:4.7.4-2
ii  links [www-browser]         2.6-1
ii  lynx-cur [www-browser]      2.8.8dev.12-2
ii  nmh [mail-reader]           1.3-1+b1
ii  opera-static [www-browser]  7.23-20031119.1
ii  sylpheed [mail-reader]      3.2.0~beta7-1

-- no debconf information



-- 
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org

Reply via email to