[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: misbehavior in shell window with ksh
From: |
Mike Kupfer |
Subject: |
Re: misbehavior in shell window with ksh |
Date: |
Thu, 04 May 2017 20:04:03 -0700 |
Eli Zaretskii wrote:
> Can the shell experts among us please tell whether this is an expected
> reaction of a shell to window-resizing ioctl? And why this is only
> seen with ksh? And why in some cases one needs to set EDITOR in the
> environment?
I'm not a shell expert, but I did spend a little time with strace to see
what ksh is doing.
In a regular terminal emulator (xfce4-terminal), when ksh gets SIGWINCH,
it queries for the size of the screen, and it generates one or more
carriage returns before (re)writing the PS1 prompt.
--- SIGWINCH {si_signo=SIGWINCH, si_code=SI_KERNEL} ---
rt_sigaction(SIGWINCH, {0x41c250, [], SA_RESTORER|SA_INTERRUPT,
0x7f91cb7cd0e0}, {0x41c250, [], SA_RESTORER|SA_INTERRUPT, 0x7f91cb7cd0e0}, 8) = 0
ioctl(2, TIOCGWINSZ, {ws_row=25, ws_col=80, ws_xpixel=0, ws_ypixel=0}) = 0
rt_sigprocmask(SIG_UNBLOCK, [WINCH], NULL, 8) = 0
rt_sigreturn() = -1 EINTR (Interrupted system call)
write(2, "\r", 1) = 1
ioctl(2, TIOCGWINSZ, {ws_row=25, ws_col=80, ws_xpixel=0, ws_ypixel=0}) = 0
poll(0x7ffcc1e41dc0, 0, 50) = 0 (Timeout)
ioctl(2, TIOCGWINSZ, {ws_row=25, ws_col=80, ws_xpixel=0, ws_ypixel=0}) = 0
write(2, "\ralto$ ", 7) = 7
select(1, [0], NULL, NULL, NULL) = ? ERESTARTNOHAND (To be restarted
if no handler)
Its behavior in a shell buffer is similar, except it just writes out the
PS2 prompt.
--- SIGWINCH {si_signo=SIGWINCH, si_code=SI_KERNEL} ---
rt_sigaction(SIGWINCH, {0x41c250, [], SA_RESTORER|SA_INTERRUPT,
0x7fc02802d0e0}, {0x41c250, [], SA_RESTORER|SA_INTERRUPT, 0x7fc02802d0e0}, 8) = 0
ioctl(2, TIOCGWINSZ, {ws_row=32, ws_col=78, ws_xpixel=0, ws_ypixel=0}) = 0
rt_sigprocmask(SIG_UNBLOCK, [WINCH], NULL, 8) = 0
rt_sigreturn() = -1 EINTR (Interrupted system call)
ioctl(2, TIOCGWINSZ, {ws_row=32, ws_col=78, ws_xpixel=0, ws_ypixel=0}) = 0
poll(0x7ffc9eb5abf0, 0, 50) = 0 (Timeout)
ioctl(2, TIOCGWINSZ, {ws_row=32, ws_col=78, ws_xpixel=0, ws_ypixel=0}) = 0
select(1, [0], NULL, NULL, {0, 0}) = 0 (Timeout)
write(2, "> ", 2) = 2
I can't explain the difference.
I also checked bash's behavior. It does not query the current screen
size.
bash in an Emacs shell buffer:
read(0, 0x6fdc00, 128) = ? ERESTARTSYS (To be restarted if
SA_RESTART is set)
--- SIGWINCH {si_signo=SIGWINCH, si_code=SI_KERNEL} ---
rt_sigreturn() = -1 EINTR (Interrupted system call)
read(0, <detached ...>
bash in an xfce4-terminal:
read(0, 0x7ffd51136837, 1) = ? ERESTARTSYS (To be restarted if
SA_RESTART is set)
--- SIGWINCH {si_signo=SIGWINCH, si_code=SI_KERNEL} ---
rt_sigreturn() = 0
read(0, 0x7ffd51136837, 1) = ? ERESTARTSYS (To be restarted if
SA_RESTART is set)
[...]
--- SIGWINCH {si_signo=SIGWINCH, si_code=SI_KERNEL} ---
rt_sigreturn() = 0
read(0, 0x7ffd51136837, 1) = ? ERESTARTSYS (To be restarted if
SA_RESTART is set)
--- SIGWINCH {si_signo=SIGWINCH, si_code=SI_KERNEL} ---
rt_sigreturn() = 0
read(0, 0x7ffd51136837, 1) = ? ERESTARTSYS (To be restarted if
SA_RESTART is set)
--- SIGWINCH {si_signo=SIGWINCH, si_code=SI_KERNEL} ---
rt_sigreturn() = 0
read(0, <detached ...>
regards,
mike
- Re: misbehavior in shell window with ksh, (continued)
- Re: misbehavior in shell window with ksh, Stephen Berman, 2017/05/01
- Re: misbehavior in shell window with ksh, Eli Zaretskii, 2017/05/01
- Re: misbehavior in shell window with ksh, Stephen Berman, 2017/05/01
- Re: misbehavior in shell window with ksh, Eli Zaretskii, 2017/05/02
- Re: misbehavior in shell window with ksh, Stephen Berman, 2017/05/02
- Re: misbehavior in shell window with ksh, Eli Zaretskii, 2017/05/02
- Re: misbehavior in shell window with ksh, Stephen Berman, 2017/05/02
- Re: misbehavior in shell window with ksh, Eli Zaretskii, 2017/05/03
- Re: misbehavior in shell window with ksh, Stephen Berman, 2017/05/04
- Re: misbehavior in shell window with ksh, Eli Zaretskii, 2017/05/04
- Re: misbehavior in shell window with ksh,
Mike Kupfer <=
- Re: misbehavior in shell window with ksh, Eli Zaretskii, 2017/05/05
- Re: misbehavior in shell window with ksh, Mike Kupfer, 2017/05/06
- Re: misbehavior in shell window with ksh, Eli Zaretskii, 2017/05/09
- Re: misbehavior in shell window with ksh, Mike Kupfer, 2017/05/01
- Re: misbehavior in shell window with ksh, Tino Calancha, 2017/05/02
Re: misbehavior in shell window with ksh, Tino Calancha, 2017/05/01