I've read and re-read about all those many quirks a lot of times over the decades, and some of the things I understand to an extend where I know what the issue is when something breaks... but man, the interactions between tty/pty, terminal (emulator), shell, screen, ssh and locales still sometimes make me want to scream.
Nothing better than sshing into a random system and getting a ~ when you hit backspace.
Re:The TTY Demystified (2008)
by simplicio on Monday April 25, 2022 @05:33AM
(#31152244)
I used to think the unix way of doing this was overly baroque, till I had to figure out how a terminal emulator worked in Windows, which requires an actual instance of the windows default terminal program (con.exe I think?) be drawn on the screen. So if you want to grab the IO from a terminal program (say to make your own terminal emulator), the standard solution is to draw a windows terminal off the boundry of your monitor somewhere and scrape the text out and send it to your program.*
*(I think this situation has improved somewhat in recent years with Windows Console?, but I haven't had a chance to play with that yet).
Re:The TTY Demystified (2008)
by ghostpepper on Sunday April 24, 2022 @09:00PM
(#31149753)
I regularly re-read this article myself and refer new Linux devs on our team to it. It's pretty incredible that the system of PID/SID/PGID has survived under the hood of Linux (and Unix) for this many decades.
Re:The TTY Demystified (2008)
by dang on Monday April 25, 2022 @12:51AM
(#31150836)
When the various discussions were years apart, like here, I suspect it would elide too much context to coalesce them.
But for submissions of the same vintage, it might be a good idea, and in fact not so different than the thread merging we already (but unsystematically) do.
Re:The TTY Demystified (2008)
by metadat on Sunday April 24, 2022 @04:03PM
(#31147787)
Minor sidenote / hopefully welcome feedback:
When pasting HN link lists like this, it's extra considerate to include the dates and comment counts, since sometimes stories have little or no discussion.
Clicking through the links blindly wastes human time, especially for a longer list such as your post.
Re:The TTY Demystified (2008)
by almog on Sunday April 24, 2022 @04:38PM
(#31148086)
1. Generally speaking, dates are useful, but this is a link to article from 2008, so I'm not sure if previous submissions dates would be all that useful.
2. All links are to previous _discussions_, none are to discussion-less submissions.
Re:The TTY Demystified (2008)
by westcort on Sunday April 24, 2022 @04:09PM
(#31147845)
Basically, the TTY driver keeps track of the foreground process group id, but only in a passive way. A user process can affect the behavior of any TTY device by manipulating the corresponding device file under /dev. For example, a user process can send a signal to the TTY driver, which will then suspend the process. TTY driver keeps track of the size of the connected terminal, but this information has to be updated explicitly, by the terminal emulator or even by the user. The TTY driver is a passive object.
Re:The TTY Demystified (2008)
by brainwipe on Monday April 25, 2022 @04:13AM
(#31151753)
For anyone new to the topic; don't panic at the size of the vertical scrollbar in the article - the majority of it is comments! The article itself is succinct and not a huge read.
Re:The TTY Demystified (2008)
by GekkePrutser on Monday April 25, 2022 @03:24AM
(#31151490)
SIGSTOP and SIGCONT are also really useful with GUI apps. I use them when I want to pause a major app like Firefox but don't want to sleep the entire machine.
Nothing better than sshing into a random system and getting a ~ when you hit backspace.
Or having the backspace print as a space, but still being registered as a backspace. That one threw me the first time I ran into that.
*(I think this situation has improved somewhat in recent years with Windows Console?, but I haven't had a chance to play with that yet).
https://news.ycombinator.com/item?id=13571055
https://news.ycombinator.com/item?id=8094186
https://news.ycombinator.com/item?id=26803109
https://news.ycombinator.com/item?id=10631513
https://news.ycombinator.com/item?id=4062981
https://news.ycombinator.com/item?id=4544318
https://news.ycombinator.com/item?id=10064657
https://news.ycombinator.com/item?id=658155
The TTY Demystified (2008) - https://news.ycombinator.com/item?id=26803109 - April 2021 (35 comments)
The TTY demystified (2008) - https://news.ycombinator.com/item?id=17765683 - Aug 2018 (12 comments)
The TTY demystified (2008) - https://news.ycombinator.com/item?id=13571055 - Feb 2017 (43 comments)
The TTY demystified - https://news.ycombinator.com/item?id=10631513 - Nov 2015 (40 comments)
The TTY demystified (2008) - https://news.ycombinator.com/item?id=10064657 - Aug 2015 (31 comments)
The TTY demystified - https://news.ycombinator.com/item?id=8094186 - July 2014 (21 comments)
The TTY Demystified - https://news.ycombinator.com/item?id=4544318 - Sept 2012 (46 comments)
The TTY demystified - https://news.ycombinator.com/item?id=4062981 - June 2012 (17 comments)
The TTY demystified - https://news.ycombinator.com/item?id=658155 - June 2009 (13 comments)
But for submissions of the same vintage, it might be a good idea, and in fact not so different than the thread merging we already (but unsystematically) do.
When pasting HN link lists like this, it's extra considerate to include the dates and comment counts, since sometimes stories have little or no discussion. Clicking through the links blindly wastes human time, especially for a longer list such as your post.
2. All links are to previous _discussions_, none are to discussion-less submissions.
Kinda cool because I never experienced the punch card era. I expect most of us here didn't.
PS who is Uriel? I only joined here a year or so ago and didn't hear of them before.