This, btw, was yet another reminder of the horrible can of worms #stdio's #buffering is.
I created a little tool running as a child process to do the *actual* #PAM authentication, so it will be possible to have this run as root while the real service drops all privileges. This little tool uses a simple line-based protocol for communication on stdin/stdout. It worked well when testing directly on the terminal.
On the first real test though, my service just went hanging. I suspected a deadlock caused by pthread mutexes. Wasted quite some time looking into that. Then I finally realized communication over the pipes was stalled.
Ok, just set buffering mode to "line buffering" after fdopen'ing the #pipe. Turned out that didn't help either. I *assume* that even in the child process, the stdio streams automatically created on the pipes were somehow fully buffered. But at that point, I was really fed up with trial and error and rewrote the whole mess to do I/O using plain #POSIX APIs (read, write), sidestepping any buffering. Worked like a charm.
Your face when you learn what an annular throbber is. (It's the thing on her forehead)
Emote by https://vgen.co/cosmoknz.
Oh no, #Chile's playing hide and seek with the sun, and everyone forgot their flashlights! Quick, somebody call #CNN for their *invaluable* #Feedback on ad relevance while the country fumbles around in the dark. Meanwhile, their video player is #Buffering like it's still #1999.
https://www.cnn.com/2025/02/25/americas/chile-blackout-14-regions-intl-latam/index.html #Sunlight #Issues #HackerNews #ngated
Unix buffering: The clearest explanation I've ever seen about line buffering, block buffering, and tty output vs simple file / pipe
https://jvns.ca/blog/2024/11/29/why-pipes-get-stuck-buffering/
#buffering #stdlib #linux #shell #unix #cli #+
Io ricordo con certezza di avere visto al #cinema diversi anni fa uno spot #antipirateria in cui c'erano due persone che vedevano un film in streaming, si interrompeva il filmato per problemi di rete, usciva la scritta "Buffering" e guardandosi stupiti si dicevano l'un l'altro "l'assassino è #Buffering" lodando l'incredibile colpo di scena.
Faceva molto ridere, non sono più stato in grado di trovarlo, non sembra essercene traccia da nessuna parte.
Me lo sono sognato? Qualcuno se lo ricorda?