Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 16 Nov 2000 13:50:41 -0500
From:      "Andresen,Jason R." <jandrese@mitre.org>
To:        Mike Meyer <mwm@mired.org>
Cc:        Garrett Wollman <wollman@khavrinen.lcs.mit.edu>, void <float@firedrake.org>, freebsd-current@FreeBSD.ORG
Subject:   Re: Proper permissons on /var/mail
Message-ID:  <3A142C81.AE1A74F2@mitre.org>
References:  <Pine.BSF.4.21.0011160650180.41866-100000@arnold.neland.dk> <20001116151809.A15312@firedrake.org> <200011161636.LAA83126@khavrinen.lcs.mit.edu> <3A1412C1.96608727@mitre.org> <14868.7551.791920.252398@guru.mired.org>

next in thread | previous in thread | raw e-mail | index | archive | help


Mike Meyer wrote:
> 
> Andresen,Jason R. <jandrese@mitre.org> types:
> > Garrett Wollman wrote:
> > >
> > > <<On Thu, 16 Nov 2000 15:18:09 +0000, void <float@firedrake.org> said:
> > >
> > > > I have a similar problem -- every time I make world, perms on /var/mail
> > > > get set to 775.  Mutt considers my mailbox read-only until I change it
> > > > to 1777.
> > >
> > > It is misconfigured (or perhaps just broken).  1777 mode for /var/mail
> > > is insecure, but was necessary in the mists of ancient past, before
> > > UNIX learned to do file locking.  Unless your mail spool is shared
> > > over NFS (don't do that), locking is reliable and .lock files should
> > > never be used or relied upon.
> >
> > Not the FreeBSD's file locking works anyway.
> > Here's the results from a test of the below program:
> 
> I can see at least two problems with the test program.
> 
> 1) You're locking a shared descriptor. Possibly that should work, but
>    it's not a case I normally see. Moving the open after the fork
>    makes this behave better.

Actually, it does work in Irix.  I'll try that under FreeBSD.
<time passes...>
That seems to have fixed the problem under FreeBSD, although it might be
a 
good idea to mention somewhere in the manpage that shared file
descriptors 
are handled differently than they are in other OSes (Irix for instance). 
This is the kind of caveat that is likely to catch the unsuspecting
developer.

> 2) You're depending on a synchronization between the two process, but
>    not doing anything to insure it.  The correct test is not that the
>    last message was the child string, but that the last two messages
>    are the same.

Yeah, I tossed this program together last year when someone said they
couldn't get file locking to work under FreeBSD, I wanted to see if
it was working at all.  The only "syncronization" is that the processes
wait for a second before writing, which in my case was enough (unloaded
PII 400s with no disk activity can get a write out in less than 1
second).


-- 
   _  _    _  ___  ____  ___   ______________________________________
  / \/ \  | ||_ _||  _ \|___| | Jason Andresen -- jandrese@mitre.org
 / /\/\ \ | | | | | |/ /|_|_  | Views expressed may not reflect those 
/_/    \_\|_| |_| |_|\_\|___| | of the Mitre Corporation.


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-current" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?3A142C81.AE1A74F2>