[RndTbl] Linux "write"

Gilbert E. Detillieux gedetil at cs.umanitoba.ca
Thu Jul 6 11:39:51 CDT 2017


On 06/07/2017 2:12 AM, Trevor Cordes wrote:
> On 2017-07-05 Gilbert E. Detillieux wrote:
>> As far as write(1) and other chat systems go, this is perhaps more to
>> the point...
>>
>> https://xkcd.com/1810/
> 
> Ha!  Love the two "walls".
> 
>> As a very early user of write(1), I had already grown to hate it long
> 
> Ah, but how do you feel about wall(1)?  Doesn't that still have a bit
> more use, or does no one care about wall anymore either... and you
> agree with their snubbing of who and u/wtmp?

I think about the only time I use wall(1) is in anticipation of a system 
shutdown.  Other than that, it's more of an annoyance than anything, 
especially when managing systems used by immature students.

I don't think I've agreed with anything the Gnome team has done in many 
years now.  I've just stopped caring, and avoid using Gnome-based apps, 
for the most part.

> At a conceptual level, I'm wondering whose is the problem of write not
> working with g-t.  If g-t is literally the only terminal in the history
> of mankind that doesn't work properly with write, and g-t says
> NOTABUG/WONTFIX, then does the onus fall on the write team to, say,
> document in the man page that write doesn't work with g-t?  This
> "limbo" kind of irks me in a strange way.

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 maintainers of other 
such monolithic beasts.  The UNIX way would be to keep those decoupled 
and modular, as much as possible.  The lower layers just need to provide 
the primitives that make the higher layers workable; apart from that, 
they should try to stay out of each other's way.

If the Gnome people choose to break UNIX functionality yet again, in 
their attempt to be something else, that's their business.  They'll just 
further alienate any serious UNIX users with each such step.

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

>> ago, for social/usage reasons more than technical issues, so I don't
>> particularly care if it goes.  And it can take the rest of the
> 
> OK, now I reveal the reason I need "write" to work, as perhaps someone
> can think of an alternate way to achieve the same ends.  I use write
> in a script that indicates to me when I already have a text file open
> in another terminal window.  The window I'm in says the file is open in
> another window, and my script writes a ton of *'s to the other window.
> Then I can rapidly spot which window has the open file, hit ^L and
> proceed from there. >
> So I'm not using write for any sort of communication with others, it's
> to aid me visually.  (I have 16 workspaces and 100+ windows across 2
> very high-pixel-count LCDs, and while I remember most of everything
> positionally, there's the odd time I forget something.  No, a potential
> solution is NOT to just use less ws/windows!)
> 
> 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).

The whole point of write was to make it easier to send the message to 
the tty(s) of a particular user, with a nice identifying banner line, 
rather than just doing low-level writes directly to the tty.

> Is there something I could do in my wm (sawfish) to instantly switch to
> the ws and focus the window with the specific pts?  That would be ideal!

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.

> Some other way?  At least we still have the beauty of *NIX in all
> likelihood giving me several workarounds...

And the UNIX "KISS" philosophy...  If this is just for your own internal 
use, I wouldn't spend too much effort on making it pretty and user friendly.

-- 
Gilbert E. Detillieux		E-mail:	<gedetil at cs.umanitoba.ca>
Dept. of Computer Science	Web:	http://www.cs.umanitoba.ca/~gedetil/
University of Manitoba		Phone:	(204)474-8161
Winnipeg MB CANADA  R3T 2N2	Fax:	(204)474-7609


More information about the Roundtable mailing list