tech-userlevel archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: Proposal for write(1) addition

In article <20110917013403.65aeb987@adolfputzen>,
Julian Fagir  <> wrote:
>write(1) is a nice tool to communicate safely on multi user machines. I've
>been using it a while but there is one great insufficiency: It does not work
>together with non-utmp terminals, as e.g. tmux(1) or rather any tool except
>for screen creates as a normal user.
>The patch supplied fixes that: When using the option '-c', write additionally
>checks for a mounted ptyfs and loops through these terminals, comparing
>ownership. As they only exist if there's a user logged into them, that works.
>Now, you can use the 'newest' terminal of the user if he is logged in. If he
>is not (i.e. has _no_ utmp-record), then you cannot write to him without
>explicitly specifying a terminal.
>Another issue fixed is that until now, the message 'not logged in' could
>never have appeared because in case you could not open the terminal, it was
>an EPERM instead of comparing ownership.
>Note that you can only test this with a very current version as of after
>If you want to test it anyway, comment out lines 207-212 and 242-243 in
>write.c, then it works as intended.
>This is also why I write to this list now: I won't have the chance to test
>this patch any further the next few weeks as I have no machine I can reboot.
>I can only test with these lines commented out.
>I would be glad if somebody reviewed this code and perhaps eventually commits
>it if it is usable. If not, then please comment what's wrong or recode this
>functionality, nowadays write(1) is barely usable without.
>One could also think about not using an option for that but making it the
>standard behaviour, I was just curious about changing behaviour that is
>longer present than I am.

I think it is better to fix tmux to add utmpx entries. Traditionally things
like xterm or others could choose to create utmp entries or not, so that
people who did not want to be bothered with write talk, biff, and friends,
could specify that they did not want a utmp entry. Consider the scenario
where I want to have a clean terminal that it is not interrupted by such
junk, and another that is.


Home | Main Index | Thread Index | Old Index