Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tty.setraw() and tty.setcbreak() return partially modified original attributes #110392

Closed
serhiy-storchaka opened this issue Oct 5, 2023 · 0 comments
Assignees
Labels
3.12 bugs and security fixes 3.13 bugs and security fixes type-bug An unexpected behavior, bug, or error

Comments

@serhiy-storchaka
Copy link
Member

serhiy-storchaka commented Oct 5, 2023

Bug report

According to the documentation they save the original result of termios.tcgetattr() and return it. But while making a copy of the attribute list before modifying it they do not take in account that it contains a reference to original cc list and modify it. So these functions return a list which contains original values and modified cc list.

These functions started returning the attribute list in #85984 (486bc8e).

The question: who should make a copy of the internal list: setraw() before passing it to cfmakeraw(), or cfmakeraw() itself?

cc @gpshead

Linked PRs

@serhiy-storchaka serhiy-storchaka added type-bug An unexpected behavior, bug, or error 3.12 bugs and security fixes 3.13 bugs and security fixes labels Oct 5, 2023
@serhiy-storchaka serhiy-storchaka self-assigned this Oct 5, 2023
serhiy-storchaka added a commit to serhiy-storchaka/cpython that referenced this issue Oct 10, 2023
* tty.setraw() and tty.setcbreak() previously returned partially modified
  list of the original tty attributes. Now they return the correct list of
  the original tty attributes

* tty.cfmakeraw() and tty.cfmakecbreak() now make a copy of the list of
  special characters before modifying it.
serhiy-storchaka added a commit that referenced this issue Oct 14, 2023
* tty.setraw() and tty.setcbreak() previously returned partially modified
  list of the original tty attributes. Now they return the correct list of
  the original tty attributes

* tty.cfmakeraw() and tty.cfmakecbreak() now make a copy of the list of
  special characters before modifying it.
miss-islington pushed a commit to miss-islington/cpython that referenced this issue Oct 14, 2023
* tty.setraw() and tty.setcbreak() previously returned partially modified
  list of the original tty attributes. Now they return the correct list of
  the original tty attributes

* tty.cfmakeraw() and tty.cfmakecbreak() now make a copy of the list of
  special characters before modifying it.
(cherry picked from commit 84e2096)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
serhiy-storchaka added a commit that referenced this issue Oct 14, 2023
* tty.setraw() and tty.setcbreak() previously returned partially modified
  list of the original tty attributes. Now they return the correct list of
  the original tty attributes

* tty.cfmakeraw() and tty.cfmakecbreak() now make a copy of the list of
  special characters before modifying it.

(cherry picked from commit 84e2096)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
aisk pushed a commit to aisk/cpython that referenced this issue Feb 11, 2024
* tty.setraw() and tty.setcbreak() previously returned partially modified
  list of the original tty attributes. Now they return the correct list of
  the original tty attributes

* tty.cfmakeraw() and tty.cfmakecbreak() now make a copy of the list of
  special characters before modifying it.
Glyphack pushed a commit to Glyphack/cpython that referenced this issue Sep 2, 2024
* tty.setraw() and tty.setcbreak() previously returned partially modified
  list of the original tty attributes. Now they return the correct list of
  the original tty attributes

* tty.cfmakeraw() and tty.cfmakecbreak() now make a copy of the list of
  special characters before modifying it.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
3.12 bugs and security fixes 3.13 bugs and security fixes type-bug An unexpected behavior, bug, or error
Projects
None yet
Development

No branches or pull requests

1 participant