[colug-432] terminal resizing notification?

Rick Hornsby richardjhornsby at gmail.com
Wed Apr 3 14:27:24 EDT 2013


On Thu, Mar 28, 2013 at 4:31 PM, Jeff Frontz <jeff.frontz at gmail.com> wrote:

> Yeah, someone else ran into this:
> http://ubuntuforums.org/showthread.php?t=865420
>
> Summary:  "You have to trap SIGWINCH in your expect script and
> propagate this to the child."



Trapping the signal did the trick.  Thanks!

> I always thought it was SIGWINCH that prompted an app (or, rather, its
> > library) to go out and query the terminal for [potentially] new
> > dimensions.  And I'm guessing the "query" is dependent on the TERM
> > type-- which, if I remember correctly, is sent over by ssh on
> > interactive login.
> >
> > When you're running it with "expect", what environment variables are
> > you seeing on the remote?
>

all of the normal variables seem to be there like

TERM=xterm-256color
SSH_TTY=/dev/pts/0

etc


thanks again!
-rick


>
> >
> > Jeff
> >
> >
> >
> > On Thu, Mar 28, 2013 at 2:41 PM, Rick Hornsby <richardjhornsby at gmail.com>
> wrote:
> >>
> >> Trying to understand the relationship between resizing a terminal,
> stty, and
> >> how the remote side gets that information that the window has been
> resized.
> >>
> >> The issue is that I can ssh into a linux host with no issues, resize my
> >> window all day long and the remote side sees the resize (confirmed by
> stty
> >> -a | grep row).
> >>
> >> However, we have a very small expect wrapper that we use most of the
> time to
> >> log in.  The expect wrapper goes to a credential store to fetch the
> password
> >> (yeah, I know, public keys, etc ... that's a long story), and passes the
> >> password to the prompt.
> >>
> >> When I use the expect wrapper to log in, the remote side never sees the
> >> resize.  I can manually set the window size using stty, but I'm unclear
> on
> >> why wrapping it in expect is causing this issue.  The terminal type is
> the
> >> same in both cases, and I've confirmed this behavior in two different
> >> terminal applications (Terminal.app and iTerm2).
> >>
> >> How does the remote side know about the resize?  Is it some kind of
> >> backchannel communication, or is there some kind of escape code getting
> >> sent?
> >>
> >> This is the essence of the expect script, if it helps put it in context:
> >>
> >> ---
> >> spawn -noecho ssh -o PubKeyAuthentication=no -o StrictHostKeyChecking=no
> >> root@$host $cmd
> >>
> >> expect "?*password?*"
> >> send "$passwd\r"
> >>
> >> interact
> >>
> >> exit 0
> >> ---
> >>
> >> (yes -- first rule -- never, ever log in as root -- if I could get my
> giant
> >> company with our 10s of thousands of servers to understand that life
> would
> >> be much easier.)
> >>
> >> the $cmd part is ignored if it wasn't provided.
> >>
> >> termtype all that behind the scenes stuff re a terminal is a topic I
> >> admittedly don't understand very well.
> >>
> >> thanks
> >> -rick
> >>
> >> _______________________________________________
> >> colug-432 mailing list
> >> colug-432 at colug.net
> >> http://lists.colug.net/mailman/listinfo/colug-432
> >>
> _______________________________________________
> colug-432 mailing list
> colug-432 at colug.net
> http://lists.colug.net/mailman/listinfo/colug-432
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.colug.net/pipermail/colug-432/attachments/20130403/adc97a28/attachment.html 


More information about the colug-432 mailing list