pkgsrc-Users archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

perl bug? weird ctrl-z behaviour when piping from tin through perl



Sometimes I pipe articles in tin(1) through a perl script that parses
the output, does something and pipes it into less; when I quit less
I'm back in tin and everything is fine.

However, when I press ctrl-z (happens more often than I'd think) the
terminal ends up in a strange state. The output is
        Stopped. Type 'fg' to restart tin
but I have no shell:
        ls
        (nothing)
entering "fg" doesn't take me back to tin. Killing the perl and/or
less processes doesn't help either, nor does pressing 'q' (as command
for less or tin).

A tin developer analysed the behaviour of tin for me:

before popen(), tin does (feed.c:feed_articles() ~ line 616)
        reset_shell_mode(3ncurses);
        endwin(3ncurses);

and after pclose() (feed.c:feed_articles() ~ line 855)
        reset_prog_mode(3ncurses);
        set_keypad_on(3ncurses);

SIGTSTP causes (signal.c:handle_suspend())
        set_keypad_off(3ncurses);
        set_xclick_off(3ncurses);
        reset_shell_mode(3ncurses);
        kill(0, SIGSTOP);
        reset_prog_mode(3ncurses);
        set_keypad_on(3ncurses);
        set_xclick_on(3ncurses);

The developer claims that the double reset_shell_mode shouldn't hurt
and that this looks ok (I think so as well).

He reduced my test case to
        cat|less
and pressing ^Z, which works nicely, however piping through
        perl -ne 'print $_;'|less
and pressing ^Z confuses perl. This looks like a perl problem.

Can someone shed more light on this?
 Thomas


Home | Main Index | Thread Index | Old Index