bug-bash
[Top][All Lists]
Advanced

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

Re: corrupted input after size function (input that's not recorded by ba


From: Chet Ramey
Subject: Re: corrupted input after size function (input that's not recorded by bash)
Date: Tue, 25 Jun 2013 15:27:00 -0400
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:17.0) Gecko/20130509 Thunderbird/17.0.6

On 6/13/13 3:58 PM, Linda Walsh wrote:
> 
> I have a small function in my bashrc:
> 
> function showsize () {\
>   local s=$(stty size); local o="(${s% *}x${s#* })"; s="${#o}";\
>   echo -n $o; while ((s-- > 0));do echo -ne "\b"; done; \
> }
> export -f showsize
> trap showsize SIGWINCH
> ---
> That has the effect of showing me my current window size
> when I resize it.
> 
> The odd thing is, if I use it while at a bash input prompt --
> any command I type has the first word ignored.

I haven't looked closely at this yet, but I bet that bash-4.2 running the
trap immediately when the SIGWINCH is received is screwing up the parser
state.  A quick test shows me that running this on an empty line, then
hitting return after resizing the terminal and before entering a new
command, does not result in any errors.

This won't work in bash-4.3, which runs traps at command boundaries to
avoid just this kind of corruption.

Chet


-- 
``The lyf so short, the craft so long to lerne.'' - Chaucer
                 ``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, ITS, CWRU    chet@case.edu    http://cnswww.cns.cwru.edu/~chet/



reply via email to

[Prev in Thread] Current Thread [Next in Thread]