[RndTbl] Linux "write"

Trevor Cordes trevor at tecnopolis.ca
Fri Jul 7 02:21:49 CDT 2017


On 2017-07-06 Gilbert E. Detillieux wrote:
> 
> The onus doesn't fall on the maintainers of write or any other
> low-level UNIX tools to try and second-guess something being done at
> a GUI-level. That's the mistake made by the systemd crowd, and

True.  But it seemed the level of cooperation/sanity used to be much
greater.  15 years ago one wouldn't just say "delete all the
utmp/pts/write code, who cares".  Oh well.

> There are alternatives.  Maybe it's time to just ditch Gnome.

I'm already *not* using Gnome (haven't since Gnome2 was ditched, exactly
15 years ago!), I'm using XFCE and sawfish and very, very happy with it.
It's only gnome-terminal I'm using, as it used to be very nice and
cutting edge, and prior to about 5 years ago just added features,
rather than ripping them out (as Adam said).

> > Could I just open(2) & write(2) to some file representing the pts?
> > That would have the same effect and mitigate the need for
> > write(1).  
> 
> Seems this could be done with a combination of lsof to find the tty 
> associated with processes that have the files open, then just writing 
> directly to the tty (e.g. using cat, or some other such utility, or
> even right in a perl script, say).

I tried it out and directly writing does work.  Don't know why I didn't
try that sooner... thought perhaps there was some sort of protocol on
that special file.  I forgot "everything's a file".  So now I have my
script working again after changing 1 line and I can ignore g-t's
shenanigans for another few months until they remove some other feature
I use... I swear one of these days I'll actually switch :-)  Honest!

P.S. instead of using lsof my script just looks at the env vars of the
ps that is using my editor on that file; that provides the pts number.

> Possibly, depending on the wm.  (Likely not possible in Gnome...)
> 
> Can't help you there, though.  Last time I did any serious
> customization of a wm setup was with twm in the early '90's.  And
> I've never worked with them at the API level.

This would be a fun thing to tackle, I'll add it to my
fun-thing-to-tackle (but-probably-never-will-get-around-to) list.  I'm
pretty sure sawfish with its can-do-everything-in-lisp can do it
somehow...

Thanks all!


More information about the Roundtable mailing list