[issue41818] Lib/pty.py major revision

2021-11-20 Thread Soumendra Ganguly


Change by Soumendra Ganguly :


--
pull_requests: +27900
pull_request: https://github.com/python/cpython/pull/29658

___
Python tracker 
<https://bugs.python.org/issue41818>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue41818] Lib/pty.py major revision

2021-01-05 Thread Soumendra Ganguly


Soumendra Ganguly  added the comment:

Thank you for the fix. That test was created by modifying an existing test 
which already had that issue; it is documented in a comment by user nnorwitz in 
the file. If your solution resolves the problem for all the tests in "class 
PtyTest", then can you please also remove that comment?

--

___
Python tracker 
<https://bugs.python.org/issue41818>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue41818] Lib/pty.py major revision

2020-12-10 Thread Soumendra Ganguly


Change by Soumendra Ganguly :


--
pull_requests: +22598
pull_request: https://github.com/python/cpython/pull/23740

___
Python tracker 
<https://bugs.python.org/issue41818>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue41818] Lib/pty.py major revision

2020-12-07 Thread Soumendra Ganguly


Change by Soumendra Ganguly :


--
pull_requests: +22550
pull_request: https://github.com/python/cpython/pull/23686

___
Python tracker 
<https://bugs.python.org/issue41818>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue41818] Lib/pty.py major revision

2020-11-28 Thread Soumendra Ganguly


Change by Soumendra Ganguly :


--
pull_requests: +22425
pull_request: https://github.com/python/cpython/pull/23546

___
Python tracker 
<https://bugs.python.org/issue41818>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue41818] Lib/pty.py major revision

2020-11-27 Thread Soumendra Ganguly


Soumendra Ganguly  added the comment:

Update: I closed PR 23533. PR 23536 is much better. It will help us detect 
exact behavior on each platform, which is necessary for making pty.spawn() 
successfully exit its copy loop.

--

___
Python tracker 
<https://bugs.python.org/issue41818>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue41818] Lib/pty.py major revision

2020-11-27 Thread Soumendra Ganguly


Change by Soumendra Ganguly :


--
pull_requests: +22418
pull_request: https://github.com/python/cpython/pull/23536

___
Python tracker 
<https://bugs.python.org/issue41818>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue41818] Lib/pty.py major revision

2020-11-27 Thread Soumendra Ganguly


Soumendra Ganguly  added the comment:

PR-23533 should fix the test_master_read() issue on Solaris. Actually, instead 
of adding 'or PLATFORM == "SunOS"', I ended up removing the whole line and 
replaced it with 'if platform.system() != "Linux"' because I expect that test 
to fail on every platform that is not Linux.

--

___
Python tracker 
<https://bugs.python.org/issue41818>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue41818] Lib/pty.py major revision

2020-11-27 Thread Soumendra Ganguly


Change by Soumendra Ganguly :


--
pull_requests: +22415
pull_request: https://github.com/python/cpython/pull/23533

___
Python tracker 
<https://bugs.python.org/issue41818>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue41818] Lib/pty.py major revision

2020-11-27 Thread Soumendra Ganguly


Soumendra Ganguly  added the comment:

This is actually good news. I had not tested the code on Solaris; this confirms 
my suspicion that Linux is the only platform that "behaves differently". Sadly, 
the current Lib/pty.py code depends on such "different behavior" to exit from 
pty.spawn()'s copy loop, which is why it hangs on the BSDs, macOS, and now we 
know that it (probably) also hangs on Solaris. Adding 'or PLATFORM == "SunOS"' 
is the correct thing to do. I am working on this now.

--

___
Python tracker 
<https://bugs.python.org/issue41818>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue41818] Lib/pty.py major revision

2020-11-26 Thread Soumendra Ganguly


Change by Soumendra Ganguly :


--
pull_requests: +22408
pull_request: https://github.com/python/cpython/pull/23526

___
Python tracker 
<https://bugs.python.org/issue41818>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue41818] Lib/pty.py major revision

2020-11-26 Thread Soumendra Ganguly


Soumendra Ganguly  added the comment:

The reproducer was helpful. https://github.com/python/cpython/pull/23526 should 
fix this issue.

--

___
Python tracker 
<https://bugs.python.org/issue41818>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue41818] Lib/pty.py major revision

2020-10-25 Thread Soumendra Ganguly


Change by Soumendra Ganguly :


--
keywords: +patch
pull_requests: +21878
stage:  -> patch review
pull_request: https://github.com/python/cpython/pull/22962

___
Python tracker 
<https://bugs.python.org/issue41818>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue26228] pty.spawn hangs on FreeBSD 9.3, 10.x, 12.1

2020-10-25 Thread Soumendra Ganguly


Change by Soumendra Ganguly :


--
pull_requests: +21879
pull_request: https://github.com/python/cpython/pull/22962

___
Python tracker 
<https://bugs.python.org/issue26228>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue41818] Lib/pty.py major revision

2020-09-19 Thread Soumendra Ganguly


Soumendra Ganguly  added the comment:

Makes sense. I will happily make a change of terminology in the pypty2 
repository after the most desirable alternative is determined based on the 
choice of the majority. I think 'mother/son' sounds cute while still retaining 
the same initials as before; people used to the older
terminology will find this easy to remember. Terminology such as parent/child 
and server/client might make it a little confusing.

--

___
Python tracker 
<https://bugs.python.org/issue41818>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue41494] Adds window resizing support to Lib/pty.py [ SIGWINCH ]

2020-09-19 Thread Soumendra Ganguly


Soumendra Ganguly  added the comment:

Reopening to indicate that this issue has not been resolved. However, this 
thread should not be used anymore. Use this instead: 
https://bugs.python.org/issue41818

--
status: closed -> open

___
Python tracker 
<https://bugs.python.org/issue41494>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue41818] Lib/pty.py major revision

2020-09-19 Thread Soumendra Ganguly


New submission from Soumendra Ganguly :

The current pty library has the following issues:

  1. Does not set slave termios. Documented in the source.

  2. Does not set initial slave window size. Documented in the source. Does not 
handle SIGWINCH. See bpo-41494, bpo-41541. This is essential in the following 
practical scenarios: i. creating split windows/panes while using a terminal 
multiplexer; ii. when resizing GUI terminal emulator window, especially 
relevant when using tiling window managers; iii. resizing an ansi-term window 
created inside a GNU Emacs frame.

  3. Does not perform signal handling. Signals must be blocked during sensitive 
portions of code.

  4. Hangs on FreeBSD. See bpo-26228.

  5. Includes deprecated functions pty.master_open(), pty.slave_open().

  6. In pty.fork(), the fallback code should try using TIOCSCTTY first. It is 
still using the old method of opening a tty to make it the controlling tty. 
Currently even SysV based systems provide TIOCSCTTY. See 
https://stackoverflow.com/questions/51593530/code-explanation-for-glibc-login-tty-function-openttyname-immediately-f

The current version of pty.spawn() uses pty.fork() internally. However, 
pty.fork() closes slave and only returns (pid, master_fd). To update winsize, 
access to slave is necessary. Further, slave termios must be properly set. The 
proposed modifications do this by implementing a login_tty(3) based function ( 
tty.login() ), and using that in pty.spawn() instead of pty.fork(). tty.login() 
tries TIOCSCTTY before falling back to the old SysV method because Python 
currently does not provide an interface to the native login_tty(3).

  7. tty.setraw() is called right after tty.tcgetattr(). This increases 
redundancy of code because tty.setraw() itself makes an identical 
tty.tcgetattr() call.

  8. Requires testing/porting to more platforms. Solaris, Illumos, macOS, 
Cygwin, etc. Windows ConPTY?

  9. There should be an option in pty.spawn() to turn off slave's ECHO flag. 
For example, when it is being used in a pipe. See 
https://github.com/karelzak/util-linux/commit/1eee1acb245a8b724e441778dfa9b858465bf7e5
 and 
https://github.com/karelzak/util-linux/commit/75ccd75a2fa1194c6415c47b0024a438e26f1ad7#diff-3834a3d25eeaf20d9d0dcb05a46995f6

  10. Tests are incomplete. Tests consider OSes such as Tru64 but not 
{Free/Net/Open/...}BSD.

Find ongoing work here: https://github.com/8vasu/pypty2

--
components: FreeBSD, Library (Lib), Tests, Windows, macOS
messages: 377195
nosy: koobs, ned.deily, paul.moore, ronaldoussoren, soumendra, steve.dower, 
tim.golden, zach.ware
priority: normal
severity: normal
status: open
title: Lib/pty.py major revision
versions: Python 3.10, Python 3.8, Python 3.9

___
Python tracker 
<https://bugs.python.org/issue41818>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue41541] [PATCH] Make pty.spawn set window size

2020-09-14 Thread Soumendra Ganguly


Change by Soumendra Ganguly :


Added file: https://bugs.python.org/file49458/script.py

___
Python tracker 
<https://bugs.python.org/issue41541>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue41541] [PATCH] Make pty.spawn set window size

2020-09-14 Thread Soumendra Ganguly


Change by Soumendra Ganguly :


Added file: https://bugs.python.org/file49457/script.py

___
Python tracker 
<https://bugs.python.org/issue41541>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue41541] [PATCH] Make pty.spawn set window size

2020-09-14 Thread Soumendra Ganguly


Change by Soumendra Ganguly :


Removed file: https://bugs.python.org/file49457/script.py

___
Python tracker 
<https://bugs.python.org/issue41541>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue41541] [PATCH] Make pty.spawn set window size

2020-09-14 Thread Soumendra Ganguly


Change by Soumendra Ganguly :


Added file: https://bugs.python.org/file49455/before.png

___
Python tracker 
<https://bugs.python.org/issue41541>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue41541] [PATCH] Make pty.spawn set window size

2020-09-14 Thread Soumendra Ganguly


Change by Soumendra Ganguly :


Added file: https://bugs.python.org/file49456/after.png

___
Python tracker 
<https://bugs.python.org/issue41541>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue41541] [PATCH] Make pty.spawn set window size

2020-08-21 Thread Soumendra Ganguly


Soumendra Ganguly  added the comment:

All images, test programs, and old patches have been removed.

window resize test is now being performed using stty.

On linux:
stty -F  rows x cols y

On BSDs:
stty -f  rows x cols y

to change window size.

--

___
Python tracker 
<https://bugs.python.org/issue41541>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue26228] pty.spawn hangs on FreeBSD 9.3, 10.x, 12.1

2020-08-21 Thread Soumendra Ganguly


Change by Soumendra Ganguly :


--
title: pty.spawn hangs on FreeBSD 9.3, 10.x -> pty.spawn hangs on FreeBSD 9.3, 
10.x, 12.1

___
Python tracker 
<https://bugs.python.org/issue26228>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue41541] [PATCH] Make pty.spawn set window size

2020-08-21 Thread Soumendra Ganguly


Change by Soumendra Ganguly :


Removed file: https://bugs.python.org/file49393/test.py

___
Python tracker 
<https://bugs.python.org/issue41541>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue41541] [PATCH] Make pty.spawn set window size

2020-08-21 Thread Soumendra Ganguly


Change by Soumendra Ganguly :


Removed file: https://bugs.python.org/file49395/pty.diff

___
Python tracker 
<https://bugs.python.org/issue41541>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue41541] [PATCH] Make pty.spawn set window size

2020-08-21 Thread Soumendra Ganguly


Change by Soumendra Ganguly :


Removed file: https://bugs.python.org/file49391/before.png

___
Python tracker 
<https://bugs.python.org/issue41541>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue41541] [PATCH] Make pty.spawn set window size

2020-08-21 Thread Soumendra Ganguly


Change by Soumendra Ganguly :


Removed file: https://bugs.python.org/file49390/pty.diff

___
Python tracker 
<https://bugs.python.org/issue41541>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue41541] [PATCH] Make pty.spawn set window size

2020-08-21 Thread Soumendra Ganguly


Change by Soumendra Ganguly :


Removed file: https://bugs.python.org/file49392/after.png

___
Python tracker 
<https://bugs.python.org/issue41541>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue41541] [PATCH] Make pty.spawn set window size

2020-08-21 Thread Soumendra Ganguly


Change by Soumendra Ganguly :


Removed file: https://bugs.python.org/file49396/pty.diff

___
Python tracker 
<https://bugs.python.org/issue41541>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue41541] [PATCH] Make pty.spawn set window size

2020-08-21 Thread Soumendra Ganguly


Change by Soumendra Ganguly :


Removed file: https://bugs.python.org/file49402/pty.diff

___
Python tracker 
<https://bugs.python.org/issue41541>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue41541] [PATCH] Make pty.spawn set window size

2020-08-21 Thread Soumendra Ganguly


Change by Soumendra Ganguly :


Removed file: https://bugs.python.org/file49386/pty.diff

___
Python tracker 
<https://bugs.python.org/issue41541>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue41541] [PATCH] Make pty.spawn set window size

2020-08-18 Thread Soumendra Ganguly


Soumendra Ganguly  added the comment:

v0.5 had introduced minor mistakes + one hack [ was using master instead of 
slave to set window size ]. v0.6 removes all such mistakes.

--
Added file: https://bugs.python.org/file49404/pty.diff

___
Python tracker 
<https://bugs.python.org/issue41541>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue41541] [PATCH] Make pty.spawn set window size

2020-08-17 Thread Soumendra Ganguly


Soumendra Ganguly  added the comment:

Further note: login_tty will also enable us to set slave termios from the 
parent process in pty.spawn.

Due to the fact that reviewing patches can be overwhelming, v0.5 removes a lot 
of stuff and instead simply performs window resize by calling ioctl TIOCSWINSZ 
on the master end of the pty. Still works as expected.

--
Added file: https://bugs.python.org/file49402/pty.diff

___
Python tracker 
<https://bugs.python.org/issue41541>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue41541] [PATCH] Make pty.spawn set window size

2020-08-16 Thread Soumendra Ganguly


Soumendra Ganguly  added the comment:

Further proposal: Rename my _login_tty to login_tty and make it available as a 
part of the pty library. Note that usually login_tty accompanies openpty and 
forkpty on a system; for example, see

https://www.man7.org/linux/man-pages/man3/login_tty.3.html
https://man.openbsd.org/login_tty
https://netbsd.gw.com/cgi-bin/man-cgi?login_tty++NetBSD-current

However, python's pty only offers openpty and forkpty in the form of 
pty.openpty and pty.fork respectively. While it is true that forkpty [ pty.fork 
] combines openpty, fork, and login_tty, it also closes the slave end of the 
pty, making it unsuitable for situations where the slave end needs to be kept 
open; for example, in my patch, the slave end is used to set the window size; 
or, in case someone wants to do even better and register a SIGWINCH handler for 
situations in which the window size can change.

--

___
Python tracker 
<https://bugs.python.org/issue41541>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue41541] [PATCH] Make pty.spawn set window size

2020-08-15 Thread Soumendra Ganguly


Soumendra Ganguly  added the comment:

v0.4 puts try-except guards around imports so that existing code does not break.

--
Added file: https://bugs.python.org/file49396/pty.diff

___
Python tracker 
<https://bugs.python.org/issue41541>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue41541] [PATCH] Make pty.spawn set window size

2020-08-15 Thread Soumendra Ganguly


Soumendra Ganguly  added the comment:

v0.3 removes _login_pty() and defines _login_tty() instead; the latter is based 
on login_tty(3) from glibc.

--
Added file: https://bugs.python.org/file49395/pty.diff

___
Python tracker 
<https://bugs.python.org/issue41541>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue41541] [PATCH] Make pty.spawn set window size

2020-08-14 Thread Soumendra Ganguly


Change by Soumendra Ganguly :


--
title: Make pty.spawn set window size [ patch + before, after screenshots ] -> 
[PATCH] Make pty.spawn set window size

___
Python tracker 
<https://bugs.python.org/issue41541>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue41541] Make pty.spawn set window size [ patch + before, after screenshots ]

2020-08-14 Thread Soumendra Ganguly


Soumendra Ganguly  added the comment:

Additional note: I am using the i3wm window manager. No desktop environment.

--
nosy:  -mark.dickinson, meador.inge

___
Python tracker 
<https://bugs.python.org/issue41541>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue41541] Make pty.spawn set window size [ patch + before, after screenshots ]

2020-08-14 Thread Soumendra Ganguly


Change by Soumendra Ganguly :


--
nosy: +mark.dickinson, meador.inge

___
Python tracker 
<https://bugs.python.org/issue41541>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue41541] Make pty.spawn set window size [ patch + before, after screenshots ]

2020-08-14 Thread Soumendra Ganguly


Soumendra Ganguly  added the comment:

I am new to BPO. Just learned how to make someone nosy.

@twouters, I have attached all resources. This is ready for a review.

Thank you.

--
nosy: +twouters

___
Python tracker 
<https://bugs.python.org/issue41541>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue41541] Make pty.spawn set window size [ patch + before, after screenshots ]

2020-08-14 Thread Soumendra Ganguly


Soumendra Ganguly  added the comment:

Adding the test program [ test.py ] as an attachment. It was taken from 
https://docs.python.org/3/library/pty.html.

How to reproduce issue:

1. Notice that the xterm window in before.png is not too wide; this makes the 
output of "ls" wrap around the xterm window.
2. Run test.py.
3. Run "ls".

Solution:

1. Apply latest version of the patch [ pty.diff ].
2. Run test.pty and run "ls".
3. Run "ls".

--
Added file: https://bugs.python.org/file49393/test.py

___
Python tracker 
<https://bugs.python.org/issue41541>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue41541] Make pty.spawn set window size [ patch + before, after screenshots ]

2020-08-14 Thread Soumendra Ganguly


Change by Soumendra Ganguly :


--
title: Make pty.spawn set window size [ + before, after screenshots ] -> Make 
pty.spawn set window size [ patch + before, after screenshots ]

___
Python tracker 
<https://bugs.python.org/issue41541>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue41541] Make pty.spawn set window size [ + before, after screenshots ]

2020-08-14 Thread Soumendra Ganguly


Soumendra Ganguly  added the comment:

Screenshot: output of "ls" after the patch is applied.

--
Added file: https://bugs.python.org/file49392/after.png

___
Python tracker 
<https://bugs.python.org/issue41541>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue41541] Make pty.spawn set window size [ + before, after screenshots ]

2020-08-14 Thread Soumendra Ganguly


Soumendra Ganguly  added the comment:

Screenshot: output of "ls" before the patch is applied.

--
title: Make pty.spawn set window size -> Make pty.spawn set window size [ + 
before, after screenshots ]
Added file: https://bugs.python.org/file49391/before.png

___
Python tracker 
<https://bugs.python.org/issue41541>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue41541] Make pty.spawn set window size

2020-08-14 Thread Soumendra Ganguly


Soumendra Ganguly  added the comment:

v0.2 moves _setwinsz block to parent after fork.

--
Added file: https://bugs.python.org/file49390/pty.diff

___
Python tracker 
<https://bugs.python.org/issue41541>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue41541] Make pty.spawn set window size

2020-08-14 Thread Soumendra Ganguly


Soumendra Ganguly  added the comment:

Note that defining _login_pty() was not a cosmetic change; it is reused in 
spawn().

--

___
Python tracker 
<https://bugs.python.org/issue41541>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue41541] Make pty.spawn set window size

2020-08-13 Thread Soumendra Ganguly


Soumendra Ganguly  added the comment:

OS: Linux 4.19.0-9-amd64 Debian 10 GNU/Linux

--

___
Python tracker 
<https://bugs.python.org/issue41541>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue41541] Make pty.spawn set window size

2020-08-13 Thread Soumendra Ganguly


Change by Soumendra Ganguly :


--
pull_requests: +20988
stage:  -> patch review
pull_request: https://github.com/python/cpython/pull/21861

___
Python tracker 
<https://bugs.python.org/issue41541>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue41541] Make pty.spawn set window size

2020-08-13 Thread Soumendra Ganguly


Change by Soumendra Ganguly :


--
title: Make pty.spawn set window size, make code more readable -> Make 
pty.spawn set window size

___
Python tracker 
<https://bugs.python.org/issue41541>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue41541] Make pty.spawn set window size, make code more readable

2020-08-13 Thread Soumendra Ganguly


New submission from Soumendra Ganguly :

The example in https://docs.python.org/3/library/pty.html that mimics script(1) 
can be used to reproduce the problem: since window size is not set by 
pty.spawn, output of "ls" becomes scattered and hard to visually parse if xterm 
window is not in fullscreen mode.

To fix the above issue, this patch makes pty.spawn set window size ( TIOCSWINSZ 
). Also, this patch makes the code of pty.fork() more readable by defining 
_login_pty(); the latter is reused in spawn().

--
components: Library (Lib)
files: pty.diff
keywords: patch
messages: 375326
nosy: soumendra
priority: normal
severity: normal
status: open
title: Make pty.spawn set window size, make code more readable
type: behavior
versions: Python 3.10, Python 3.8, Python 3.9
Added file: https://bugs.python.org/file49386/pty.diff

___
Python tracker 
<https://bugs.python.org/issue41541>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue41494] Adds window resizing support to Lib/pty.py [ SIGWINCH ]

2020-08-13 Thread Soumendra Ganguly


Change by Soumendra Ganguly :


--
stage: patch review -> resolved
status: open -> closed

___
Python tracker 
<https://bugs.python.org/issue41494>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue41494] Adds window resizing support to Lib/pty.py [ SIGWINCH ]

2020-08-13 Thread Soumendra Ganguly


Soumendra Ganguly  added the comment:

Closing because registering SIGWINCH handler from within library function is 
impractical.

--

___
Python tracker 
<https://bugs.python.org/issue41494>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue41494] Adds window resizing support to Lib/pty.py [ SIGWINCH ]

2020-08-09 Thread Soumendra Ganguly


Soumendra Ganguly  added the comment:

Possibly related issues:

https://bugs.python.org/issue29070
https://bugs.python.org/issue26228

Since wspawn does not depend on OSError, it might be a possible [ not 
necessarily the only way ] of solving the above issues.

--

___
Python tracker 
<https://bugs.python.org/issue41494>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue29070] Integration tests for pty.spawn on Linux and all other platforms

2020-08-09 Thread Soumendra Ganguly


Soumendra Ganguly  added the comment:

Hi! Can anyone please take a look at

https://bugs.python.org/issue41494 [ 
https://github.com/python/cpython/pull/21752 ]?

I think these are related. I wrote a new function called wspawn, which is like 
spawn+the following differences.

1. It sets window size at the beginning.
2. It registers a SIGWINCH handler.
3. It does not depend on OSError to return. It does a clean return instead.

--
nosy: +soumendra

___
Python tracker 
<https://bugs.python.org/issue29070>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue26228] pty.spawn hangs on FreeBSD 9.3, 10.x

2020-08-09 Thread Soumendra Ganguly


Soumendra Ganguly  added the comment:

Hi! Can anyone please take a look at

https://bugs.python.org/issue41494 [ 
https://github.com/python/cpython/pull/21752 ]?

I think these are related. I wrote a new function called wspawn, which is like 
spawn+the following differences.

1. It sets window size at the beginning.
2. It registers a SIGWINCH handler.
3. It does not depend on OSError to return. It does a clean return instead.

--
nosy: +soumendra

___
Python tracker 
<https://bugs.python.org/issue26228>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue41494] Adds window resizing support to Lib/pty.py [ SIGWINCH ]

2020-08-08 Thread Soumendra Ganguly


Change by Soumendra Ganguly :


--
title: Adds window resizing support to Lib/pty.py -> Adds window resizing 
support to Lib/pty.py [ SIGWINCH ]

___
Python tracker 
<https://bugs.python.org/issue41494>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue41494] Adds window resizing support to Lib/pty.py

2020-08-08 Thread Soumendra Ganguly


Change by Soumendra Ganguly :


--
title: Adds window resizing support to Lib/pty.py for proper output rendering 
-> Adds window resizing support to Lib/pty.py

___
Python tracker 
<https://bugs.python.org/issue41494>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue41494] Adds window resizing support to Lib/pty.py for proper output rendering

2020-08-08 Thread Soumendra Ganguly


Soumendra Ganguly  added the comment:

The following are two [ very old ] stackoverflow threads that are relevant.

https://stackoverflow.com/questions/6418678/resize-the-terminal-with-python

https://stackoverflow.com/questions/16941885/want-to-resize-terminal-windows-in-python-working-but-not-quite-right

--

___
Python tracker 
<https://bugs.python.org/issue41494>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue41494] Adds window resizing support to Lib/pty.py for proper output rendering

2020-08-08 Thread Soumendra Ganguly


Change by Soumendra Ganguly :


--
title: Add window resizing support [ SIGWINCH ] to Lib/pty -> Adds window 
resizing support to Lib/pty.py for proper output rendering

___
Python tracker 
<https://bugs.python.org/issue41494>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue41494] Add window resizing support [ SIGWINCH ] to Lib/pty

2020-08-07 Thread Soumendra Ganguly


Soumendra Ganguly  added the comment:

Updated diff.

Changes _ekill()

--
Added file: https://bugs.python.org/file49376/pty.diff

___
Python tracker 
<https://bugs.python.org/issue41494>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue41494] Add window resizing support [ SIGWINCH ] to Lib/pty

2020-08-06 Thread Soumendra Ganguly


Change by Soumendra Ganguly :


--
pull_requests: +20896
stage:  -> patch review
pull_request: https://github.com/python/cpython/pull/21752

___
Python tracker 
<https://bugs.python.org/issue41494>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue41494] Add window resizing support [ SIGWINCH ] to Lib/pty

2020-08-06 Thread Soumendra Ganguly


New submission from Soumendra Ganguly :

This was tested using Python 3.7 after commenting out the sys.audit lines.

https://docs.python.org/3/library/pty.html presents us with an example usage of 
pty.spawn. This example mimics script(1). However, the script(1) from 
util-linux has fantastic signal handing that pty.spawn does not directly 
provide. In fact, Lib/pty.py says "Bugs: No signal handling. Doesn't set slave 
termios and window size."

xterm(1) on Debian 10 GNU/Linux was used to test the pty.spawn example 
mentioned above; upon resizing the xterm(1) window, the output of programs such 
as ls(1) became scattered and hard to visually parse.

This patch does not modify any of the functions that are already present in 
Lib/pty. Instead, it exposes a new function called "wspawn" [ pty.wspawn ]. 
This is like pty.spawn + the following differences.

1. Window size is set at the beginning.
2. A SIGWINCH handler is registered. The old handler is saved and restored 
later.
3. If the above two steps fail, then cleanup is done, and an exception is 
raised, so that the programmer can catch the exception and use pty.spawn 
instead.
4. Unlike pty.spawn, this does not depend on OSError to break out of the parent 
mainloop. Instead, the main loop calls select with an adjustable  timeout, so 
that waitpid with WNOHANG can be called periodically to check if the spawned 
child process has undergone an alteration of state.
5. While the return value is same as that of pty.spawn, this accepts an extra 
optional "timeout" argument for the select call.

The aforementioned pty.spawn example now works well with window resizing if 
pty.wspawn is used in place of pty.spawn.

Signed-off-by: Soumendra Ganguly 

--
components: Library (Lib)
files: pty.diff
keywords: patch
messages: 374926
nosy: soumendra
priority: normal
severity: normal
status: open
title: Add window resizing support [ SIGWINCH ] to Lib/pty
type: enhancement
versions: Python 3.10, Python 3.7, Python 3.8, Python 3.9
Added file: https://bugs.python.org/file49372/pty.diff

___
Python tracker 
<https://bugs.python.org/issue41494>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com