tech-userlevel archive

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

Re: Proposal: Add option to add dates to write(1)

On Tue, 29 May 2012 10:46:43 -0400
Thor Lancelot Simon <> wrote:

> On Tue, May 29, 2012 at 10:37:56AM -0400, James K. Lowden wrote:
> > On Fri, 25 May 2012 02:05:32 -0400 (EDT)
> > Mouse <mouse%Rodents-Montreal.ORG@localhost> wrote:
> > 
> > I see no problem using the preferences of the logged-in user to
> > determine the date format of its message notice. It is both
> > technically unambiguous and meets the POLA test.  
> I do.  I think it's well beyond crazy to invent a whole new kind of
> persistent-locale for Unix systems just to add this feature to write
> (1).
> For better or worse, locale settings on Unix are controlled by
> environment variables.  Letting processes poke at each others'
> environment variables is a very, very dangerous thing.  I cannot see
> sufficient benefit here to justify it, either.

To rephrase: 

1.  This is a locale issue.
2.  Locales are governed by environments. 
3.  We must not use environments.
4.  Ergo, this issue cannot be addressed.  

I deny #1.  We're not discussing the date formatting conventions for
the locale.  We're discussing whether or not the date should be
included in the time string produced by write(1) and, if so, how the
user might control the behavior.  

Mouse convinced me that processes are a red herring here, that write(1)
communicates to a user via a terminal.  We know what account logged
in.  All that remains is, as Mouse said, 

> *if* you can find ... a way to attach that
> preference to the user, without dragging other things into it that
> introduce ambiguities (like processes).  

Of the people involved in this thread ISTM I'm the least qualified,
which might explain why I'm floating the suggestions instead of
torpedoing them.  But let me reiterate.  

> It could be another subfield in gecos in /etc/password, or a
> mod 644 ${HOME}/.writefmt file.  

Both options are completely in the user's control and absolutely safe
from a security point of view.  (If there are security concerns with
invalid format strings being passed to strftime(3), that's a bigger

I don't need to explain to you that dot files in one's home directory
are a common way to control behavior.  For an example of expressing a
preference to a process not owned by the user, I refer you
to .forward, a file so old it predates history, if the manual be our

Agreed, the complexity might not be worth it, fsvo of "it".  But the
OP's proposal was more complex, requiring agreement between sender
and recipient.  By using ~/.writefmt instead, write locates the user,
attempts to open one file in his home directory and, if successful,
uses the contained string to format the time.  Fallback is current
behavior. It's small, safe, predictable, and convenient.  


Home | Main Index | Thread Index | Old Index