zsh-users
 help / color / mirror / code / Atom feed
* TRAPALRM and vlock problem
@ 2001-09-04 16:13 Kevin Way
  2001-09-04 16:24 ` Bart Schaefer
  0 siblings, 1 reply; 3+ messages in thread
From: Kevin Way @ 2001-09-04 16:13 UTC (permalink / raw)
  To: zsh-users

[-- Attachment #1: Type: text/plain, Size: 1242 bytes --]

I'm having a problem with the TRAPALRM+TMOUT feature of zsh, and I'd greatly
appreciate any help.  My .zshrc contains:

    TMOUT=300

    TRAPALRM () {
        clear
        echo Inactivity timeout on $TTY
        echo
        vlock -c
        echo
        echo Terminal unlocked. [ Press Enter ]
    }

The goal being, of course, to lock unused terminals after five minutes.

The problem is that when called by zsh in this manner, vlock will only
accept one character, making it impossible to unlock the terminal.  I end
up with:

    This TTY is now locked.
    Please enter the password to unlock.
    kway's Password:
    root's Password:
     *** That password is incorrect; please try again. *** 

    This TTY is now locked.
    Please enter the password to unlock.
    kway's Password:
    root's Password:
     *** That password is incorrect; please try again. *** 

despite the fact that if I all vlock -c from the command line, it works as
expected:

    This TTY is now locked.
    Please enter the password to unlock.
    kway's Password:
    [kway@bean kway]% 

Does anybody know why this happens, or how to stop it?  I'd greatly
appreciate any assistance in this matter.

Kevin Way

[-- Attachment #2: Type: application/pgp-signature, Size: 230 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: TRAPALRM and vlock problem
  2001-09-04 16:13 TRAPALRM and vlock problem Kevin Way
@ 2001-09-04 16:24 ` Bart Schaefer
  2001-09-04 16:52   ` Kevin Way
  0 siblings, 1 reply; 3+ messages in thread
From: Bart Schaefer @ 2001-09-04 16:24 UTC (permalink / raw)
  To: Kevin Way, zsh-users

On Sep 4,  4:13pm, Kevin Way wrote:
}
} The problem is that when called by zsh in this manner, vlock will only
} accept one character, making it impossible to unlock the terminal.

Try replacing the call to "vlock -c" with a call to "stty -a" just to
find out what the tty settings are at the time vlock runs.

If for some reason the ZLE tty settings are not being reset properly
from inside a trap (which would be a bug, but could be happening), try
replacing "vlock -c" in the trap with

	STTY=sane vlock -c

or some such.  See the manual for an explanation of the STTY parameter.

-- 
Bart Schaefer                                 Brass Lantern Enterprises
http://www.well.com/user/barts              http://www.brasslantern.com

Zsh: http://www.zsh.org | PHPerl Project: http://phperl.sourceforge.net   


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: TRAPALRM and vlock problem
  2001-09-04 16:24 ` Bart Schaefer
@ 2001-09-04 16:52   ` Kevin Way
  0 siblings, 0 replies; 3+ messages in thread
From: Kevin Way @ 2001-09-04 16:52 UTC (permalink / raw)
  To: Bart Schaefer; +Cc: zsh-users

[-- Attachment #1: Type: text/plain, Size: 2379 bytes --]

On Tue, Sep 04, 2001 at 04:24:03PM +0000, Bart Schaefer wrote:
> On Sep 4,  4:13pm, Kevin Way wrote:
> }
> } The problem is that when called by zsh in this manner, vlock will only
> } accept one character, making it impossible to unlock the terminal.
> 
> Try replacing the call to "vlock -c" with a call to "stty -a" just to
> find out what the tty settings are at the time vlock runs.

Your suggestion below worked, but seeing as you thought this might be a
bug, I thought I should include:

The output of stty -a from within the trap:

speed 115200 baud; 25 rows; 80 columns;
lflags: -icanon isig iexten -echo echoe -echok echoke -echonl echoctl
        -echoprt -altwerase -noflsh -tostop -flusho -pendin -nokerninfo
        -extproc
iflags: -istrip icrnl inlcr -igncr ixon -ixoff ixany imaxbel -ignbrk
        brkint -inpck -ignpar -parmrk
oflags: opost onlcr -ocrnl -oxtabs -onocr -onlret
cflags: cread cs8 -parenb -parodd hupcl -clocal -cstopb -crtscts -dsrflow
        -dtrflow -mdmbuf
cchars: discard = <undef>; dsusp = <undef>; eof = ^D; eol = <undef>;
        eol2 = <undef>; erase = ^H; erase2 = ^H; intr = ^C; kill = ^U;
        lnext = <undef>; min = 1; quit = <undef>; reprint = ^R;
        start = ^Q; status = ^T; stop = ^S; susp = <undef>; time = 0;
        werase = ^W;

And the output of stty -a from a regular command line:

speed 115200 baud; 25 rows; 80 columns;
lflags: icanon isig iexten echo echoe -echok echoke -echonl echoctl
        -echoprt -altwerase -noflsh -tostop -flusho pendin -nokerninfo
        -extproc
iflags: -istrip icrnl -inlcr -igncr ixon -ixoff ixany imaxbel -ignbrk
        brkint -inpck -ignpar -parmrk
oflags: opost onlcr -ocrnl -oxtabs -onocr -onlret
cflags: cread cs8 -parenb -parodd hupcl -clocal -cstopb -crtscts -dsrflow
        -dtrflow -mdmbuf
cchars: discard = ^O; dsusp = ^Y; eof = ^D; eol = <undef>;
        eol2 = <undef>; erase = ^H; erase2 = ^H; intr = ^C; kill = ^U;
        lnext = ^V; min = 1; quit = ^\; reprint = ^R; start = ^Q;
        status = ^T; stop = ^S; susp = ^Z; time = 0; werase = ^W;

> If for some reason the ZLE tty settings are not being reset properly
> from inside a trap (which would be a bug, but could be happening), try
> replacing "vlock -c" in the trap with
> 
> 	STTY=sane vlock -c

This fixes the problem for me, thank you!

Kevin Way

[-- Attachment #2: Type: application/pgp-signature, Size: 230 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2001-09-04 16:53 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-09-04 16:13 TRAPALRM and vlock problem Kevin Way
2001-09-04 16:24 ` Bart Schaefer
2001-09-04 16:52   ` Kevin Way

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).