• putty resize action

    From xjasoneganx@gmail.com@21:1/5 to All on Tue Mar 26 12:54:27 2019
    So, Im probably not in the right place but im getting kind of desperate here.
    When I resize my putty window by simply dragging the window border, it closes whatever ssh session I am currently in. Some details: I am using the latest version from the website. Lets say I do a ./start Network/tunnelConnect.py -p 22 into a remote
    linux machine. Ok great...I am on that machine and it tells me 'root@machinename' at the prompt. Now I am running commands, tailing logs, etc and I find that I need to make the window bigger. I resize the window and it closes my session immediately
    with "Cleaning up...Done!", and then I am back at my local user prompt 'user@locallinuxbox'. The resizing option is set to "change number of rows and columns when resized" so I changed it to "change font when resized". This works, in that it doesnt end
    my session when the window is resized, but I do not like this option as I want to see more text when I resize, not just make the font bigger. Why is it ending my session when its resized? I wonder if its just not passing the new size to the application
    correctly? In which case, I would expect a blank page instead of just being signed out. I am at a loss and would love some help (been putting up with this for like 5 years). Thanks!!

    Jason Egan
    xjasoneganx@gmail.com

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Kaz Kylheku@21:1/5 to xjasoneganx@gmail.com on Tue Mar 26 20:53:28 2019
    On 2019-03-26, xjasoneganx@gmail.com <xjasoneganx@gmail.com> wrote:
    So, Im probably not in the right place but im getting kind of desperate here.
    When I resize my putty window by simply dragging the window border,
    it closes whatever ssh session I am currently in. Some details: I
    am using the latest version from the website. Lets say I do a
    ./start Network/tunnelConnect.py -p 22 into a remote linux machine.

    Does it reproduce if you just use "ssh" to connect to the remote machine
    like a normal person, instead relying on the above Python wrapper?

    It smells like something might be getting a SIGWINCH signal from the
    terminal resize and is not prepared to handle it.

    Normally programs don't have know about the existence of SIGWINCH
    because its default action is for it to be ignored. That's why in
    everyday experience, programs don't terminate when the terminal
    window is resized, even though they don't make any arrangements
    regarding SIGWINCH.

    --
    TXR Programming Lanuage: http://nongnu.org/txr
    Music DIY Mailing List: http://www.kylheku.com/diy
    ADA MP-1 Mailing List: http://www.kylheku.com/mp1

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From xjasoneganx@gmail.com@21:1/5 to Kaz Kylheku on Tue Mar 26 13:57:44 2019
    On Tuesday, March 26, 2019 at 3:53:33 PM UTC-5, Kaz Kylheku wrote:
    On 2019-03-26, xjasoneganx@gmail.com <xjasoneganx@gmail.com> wrote:
    So, Im probably not in the right place but im getting kind of desperate here.
    When I resize my putty window by simply dragging the window border,
    it closes whatever ssh session I am currently in. Some details: I
    am using the latest version from the website. Lets say I do a
    ./start Network/tunnelConnect.py -p 22 into a remote linux machine.

    Does it reproduce if you just use "ssh" to connect to the remote machine
    like a normal person, instead relying on the above Python wrapper?

    It smells like something might be getting a SIGWINCH signal from the
    terminal resize and is not prepared to handle it.

    Normally programs don't have know about the existence of SIGWINCH
    because its default action is for it to be ignored. That's why in
    everyday experience, programs don't terminate when the terminal
    window is resized, even though they don't make any arrangements
    regarding SIGWINCH.

    --
    TXR Programming Lanuage: http://nongnu.org/txr
    Music DIY Mailing List: http://www.kylheku.com/diy
    ADA MP-1 Mailing List: http://www.kylheku.com/mp1

    I wouldnt know how to just use ssh in our environment once im puttied into my linux box. ...our hostnames arent recognized unless you use the python command. I am on a windows box using putty to ssh into my linux box behind me...and from there I connect
    to the customers machine.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From xjasoneganx@gmail.com@21:1/5 to xjaso...@gmail.com on Tue Mar 26 14:06:45 2019
    On Tuesday, March 26, 2019 at 3:57:45 PM UTC-5, xjaso...@gmail.com wrote:
    On Tuesday, March 26, 2019 at 3:53:33 PM UTC-5, Kaz Kylheku wrote:
    On 2019-03-26, xjasoneganx@gmail.com <xjasoneganx@gmail.com> wrote:
    So, Im probably not in the right place but im getting kind of desperate here.
    When I resize my putty window by simply dragging the window border,
    it closes whatever ssh session I am currently in. Some details: I
    am using the latest version from the website. Lets say I do a
    ./start Network/tunnelConnect.py -p 22 into a remote linux machine.

    Does it reproduce if you just use "ssh" to connect to the remote machine like a normal person, instead relying on the above Python wrapper?

    It smells like something might be getting a SIGWINCH signal from the terminal resize and is not prepared to handle it.

    Normally programs don't have know about the existence of SIGWINCH
    because its default action is for it to be ignored. That's why in
    everyday experience, programs don't terminate when the terminal
    window is resized, even though they don't make any arrangements
    regarding SIGWINCH.

    --
    TXR Programming Lanuage: http://nongnu.org/txr
    Music DIY Mailing List: http://www.kylheku.com/diy
    ADA MP-1 Mailing List: http://www.kylheku.com/mp1

    I wouldnt know how to just use ssh in our environment once im puttied into my linux box. ...our hostnames arent recognized unless you use the python command. I am on a windows box using putty to ssh into my linux box behind me...and from there I
    connect to the customers machine.

    Im gonna cat the tunnelconnect.py file and see what its doing real quick

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From xjasoneganx@gmail.com@21:1/5 to xjaso...@gmail.com on Tue Mar 26 14:09:47 2019
    On Tuesday, March 26, 2019 at 4:06:45 PM UTC-5, xjaso...@gmail.com wrote:
    On Tuesday, March 26, 2019 at 3:57:45 PM UTC-5, xjaso...@gmail.com wrote:
    On Tuesday, March 26, 2019 at 3:53:33 PM UTC-5, Kaz Kylheku wrote:
    On 2019-03-26, xjasoneganx@gmail.com <xjasoneganx@gmail.com> wrote:
    So, Im probably not in the right place but im getting kind of desperate here.
    When I resize my putty window by simply dragging the window border,
    it closes whatever ssh session I am currently in. Some details: I
    am using the latest version from the website. Lets say I do a
    ./start Network/tunnelConnect.py -p 22 into a remote linux machine.

    Does it reproduce if you just use "ssh" to connect to the remote machine like a normal person, instead relying on the above Python wrapper?

    It smells like something might be getting a SIGWINCH signal from the terminal resize and is not prepared to handle it.

    Normally programs don't have know about the existence of SIGWINCH
    because its default action is for it to be ignored. That's why in everyday experience, programs don't terminate when the terminal
    window is resized, even though they don't make any arrangements
    regarding SIGWINCH.

    --
    TXR Programming Lanuage: http://nongnu.org/txr
    Music DIY Mailing List: http://www.kylheku.com/diy
    ADA MP-1 Mailing List: http://www.kylheku.com/mp1

    I wouldnt know how to just use ssh in our environment once im puttied into my linux box. ...our hostnames arent recognized unless you use the python command. I am on a windows box using putty to ssh into my linux box behind me...and from there I
    connect to the customers machine.

    Im gonna cat the tunnelconnect.py file and see what its doing real quick

    That tunnelconnect wrapper is like 500 lines of code...so yeah i am not sure how to get around connecting to a machine without using it.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Kaz Kylheku@21:1/5 to xjasoneganx@gmail.com on Tue Mar 26 21:31:16 2019
    On 2019-03-26, xjasoneganx@gmail.com <xjasoneganx@gmail.com> wrote:
    On Tuesday, March 26, 2019 at 3:53:33 PM UTC-5, Kaz Kylheku wrote:
    On 2019-03-26, xjasoneganx@gmail.com <xjasoneganx@gmail.com> wrote:
    So, Im probably not in the right place but im getting kind of desperate here.
    When I resize my putty window by simply dragging the window border,
    it closes whatever ssh session I am currently in. Some details: I
    am using the latest version from the website. Lets say I do a
    ./start Network/tunnelConnect.py -p 22 into a remote linux machine.

    Does it reproduce if you just use "ssh" to connect to the remote machine
    like a normal person, instead relying on the above Python wrapper?

    It smells like something might be getting a SIGWINCH signal from the
    terminal resize and is not prepared to handle it.

    Normally programs don't have know about the existence of SIGWINCH
    because its default action is for it to be ignored. That's why in
    everyday experience, programs don't terminate when the terminal
    window is resized, even though they don't make any arrangements
    regarding SIGWINCH.

    --
    TXR Programming Lanuage: http://nongnu.org/txr
    Music DIY Mailing List: http://www.kylheku.com/diy
    ADA MP-1 Mailing List: http://www.kylheku.com/mp1

    I wouldnt know how to just use ssh in our environment once im puttied
    into my linux box. ...our hostnames arent recognized unless you use
    the python command. I am on a windows box using putty to ssh into my
    linux box behind me...and from there I connect to the customers
    machine.

    Problem is, there is no reason to believe that the problem is anywhere
    else but that Pythonology that you have there; so you either have to
    debug into that yourself, or report this crippling issue to its maintainers/purveyors.

    Read the code to find out what it's doing; it must be getting host names
    or IP addresses from somewhere. Try connecting to those same host names directly using "ssh". If the resize problem is not reproducible that
    way, the problem is in the connect script.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Kaz Kylheku@21:1/5 to xjasoneganx@gmail.com on Tue Mar 26 21:33:17 2019
    On 2019-03-26, xjasoneganx@gmail.com <xjasoneganx@gmail.com> wrote:
    That tunnelconnect wrapper is like 500 lines of code...so yeah i am
    not sure how to get around connecting to a machine without using it.

    Add some print statements to it. At some point it has to call ssh
    with some arguments, right? So print that command line or those
    arguments.

    You could also run that command under strace -f.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Kaz Kylheku@21:1/5 to Kaz Kylheku on Tue Mar 26 21:38:22 2019
    On 2019-03-26, Kaz Kylheku <157-073-9834@kylheku.com> wrote:
    Problem is, there is no reason to believe that the problem is anywhere
    else but that Pythonology that you have there; so you either have to
    debug into that yourself, or report this crippling issue to its maintainers/purveyors.

    Also: you've been tolerating this problem for five years, right?
    How many times have you upgraded tunnelConnect.py script in that
    time? Maybe there are newer versions of it?

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From xjasoneganx@gmail.com@21:1/5 to Mark Richards on Wed Mar 27 20:12:38 2019
    On Wednesday, August 13, 2014 at 9:33:14 AM UTC-5, Mark Richards wrote:
    I found a nice script (below) which resizes the terminal session to match that of the putty window.

    It would be sweet if putty provided a trigger event which will launch the script in my terminal session when the window has been re-sized. Ideally, the script would be launched after a slight delay following mouse up after the re-size action.

    Of course, the script can't launch if a user is not at a command prompt. Not certain how putty might make this distinction.

    Which is probably why the feature has not been implemented?


    from: https://raw.githubusercontent.com/akkana/scripts/master/termsize


    #!/usr/bin/env python

    # Get the current size of the terminal window, and set stty size accordingly. # A replacement for xterm's resize program, with no X dependency.
    # Useful when logged in over a serial line.
    # Copyright 2013 by Akkana Peck -- share and enjoy under the GPL v2 or later.

    import os, sys
    import fcntl
    import posix
    import struct
    import time
    import re
    import termios
    import select

    tty = open('/dev/tty', 'r+')
    tty.write('\033[7\033[r\033[999;999H\033[6n')
    tty.flush()

    fd = sys.stdin.fileno()

    oldterm = termios.tcgetattr(fd)
    newattr = oldterm[:]
    newattr[3] = newattr[3] & ~termios.ICANON & ~termios.ECHO termios.tcsetattr(fd, termios.TCSANOW, newattr)

    oldflags = fcntl.fcntl(fd, fcntl.F_GETFL)
    fcntl.fcntl(fd, fcntl.F_SETFL, oldflags | os.O_NONBLOCK)

    try:
    while True:
    r, w, e = select.select([fd], [], [])
    if r:
    output = sys.stdin.read()
    break
    finally:
    termios.tcsetattr(fd, termios.TCSAFLUSH, oldterm)
    fcntl.fcntl(fd, fcntl.F_SETFL, oldflags)

    rows, cols = map(int, re.findall(r'\d+', output))

    fcntl.ioctl(fd, termios.TIOCSWINSZ,
    struct.pack("HHHH", rows, cols, 0, 0))

    print "\nReset the terminal to", rows, "rows", cols, "cols"

    Sorry for the late reply. I am just4 the technical support person for the product and only know linux inside the scope of my job. I am not a developer, nor did I develop the 10 year old python code that makes up our system. I was assuming the issue
    was PUTTY related, which is why I didnt contact the developers and instead came here. Once you helped me realize it was a python code issue, I contacted them and they fixed it. Come to realize, my entire technical support team was also putting up with
    session termination on resize for the last 5 years as well...and nobody said anything!! Anyway, its fixed and will be incorporated into the next software release. Thanks for everyones insight!

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Grant Taylor@21:1/5 to xjasoneganx@gmail.com on Wed Mar 27 17:24:13 2019
    On 3/26/19 3:09 PM, xjasoneganx@gmail.com wrote:
    That tunnelconnect wrapper is like 500 lines of code...so yeah i am not
    sure how to get around connecting to a machine without using it.

    Without knowing what tunnelConnect.py is doing, there's little that we
    can do to help.

    Do you want to provide a copy of it? Here or email?

    There's always a chance that it's doing something extremely complex.
    But I'm getting it can be replaced with a judiciously crafted
    ~/.ssh/config file.



    --
    Grant. . . .
    unix || die

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Kaz Kylheku@21:1/5 to xjasoneganx@gmail.com on Thu Mar 28 06:02:46 2019
    On 2019-03-28, xjasoneganx@gmail.com <xjasoneganx@gmail.com> wrote:
    why I didnt contact the developers and instead came here. Once you
    helped me realize it was a python code issue, I contacted them and
    they fixed it.

    Good job.

    BTW that script you quoted from Mark Richards is a reimplementation of
    the "resize" program from the X11 window system (which is written in C).

    Except, this Python imitation doesn't output shell variables that can be eval-ed; it just punches the terminal size down into the kernel.

    Here is a shell implementation of resize:

    http://www.kylheku.com/cgit/unix-cruft/tree/resize

    what's missing from this one is C shell support; it spits out the LINES
    and COLUMNS variable assignments in Bourne/POSIX shell syntax only.

    The only situation in which we need such a thing is when working over
    serial lines (with embedded hosts nowadays). When using a host over
    a serial console, there is no protocol there for communicating a window
    resize. A manual action has to be taken on the host to inform the kernel
    of the altered window size. I wrote resize some 13 years ago for
    embedded use: I didn't want to add the X11 package to the embedded
    distro just to get resize. :)

    If we're using ssh, resizing should work: resizing the local window
    should communicate to the remote host. The struct termios structure in
    the kernel on the remote end should pick up the new size, and the kernel
    should send the SIGWINCH signal to the foreground process group.

    --
    TXR Programming Lanuage: http://nongnu.org/txr
    Music DIY Mailing List: http://www.kylheku.com/diy
    ADA MP-1 Mailing List: http://www.kylheku.com/mp1

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)