Re: messages chopped in half

Vlad Zero <[email protected]> Mon, 26 Jan 2004 17:48:16 +0100 (CET)
Newsgroups gmane.mail.yosucker.general
Message-ID <[email protected]>
Well, yeah, as David A. noticed, there are several methods of file lock
protection. There's a more or less standard way of file-locking, the
system 'flock' call that I used in YoSucker, but this solution surely has
a very weak point - it only works if the other applications use the flock
way as well. Many does not, as they employ their own way of file-locking.  
But it would be impossible to take in account all of them. And I don't
think the primary YoSucker user is a heavy traffic production mail server,
but a single person that likes to fetch the its Yahoo messages once in a
while. So I went for the flock, that I considered standard. It surely
brings some risk to the code, but I found it acceptable. But if anyone
wants to write a more complex flocking mechanism, taking in account all
the different ways of flocking, I'll be happy to apply your patch! The
question is right: "Is this really safe?" Not 100%. But there's been
hundreds or maybe even thousands of users since May 1st 2002 (the
first public release) and I never heard of any trouble. 

(David M., you may actually be the first one to experience this kind of
trouble. :-) Unfortunately. I'll recheck the code, but everything seems to
be fine... Try the solution bellow as well...)

Let me know if the problem persist... Take care,

Vlad
-z3r0-


On Fri, 23 Jan 2004, David Aspinwall wrote:

> >>"svref" == David Morse <svref-/[email protected]> writes:
> 
> > My mail flow, if I remember it right:
> > yahoo ---> Yosucker ---> localhost:/var/spool/mail/dm ---> pop3d -----> Mozilla
> 
> Is this really safe?
> 
> From a quick look at the YoSucker code, it seems like it is doing a
> flock call on the mail spool file itself (/var/spool/mail/dm in this
> case).  I think sendmail actually locks a file with a '.lock' at the
> end.  At least that's what the 'movemail' command that comes with
> emacs does.  Plus, some versions of sendmail don't use flock, and some
> systems don't use sendmail, so getting this right doesn't seem that
> easy.  If sendmail is trying to write the file while YoSucker is also
> trying to write it, or your mail client or pop server is reading the
> file while YoSucker is writing it, mail can get lost or truncated.
> 
> I don't tend to trust file locking with sendmail in any case.  What I
> do is set PIPE=1 in the config file, and set OUTFILE to a script which
> basically looks like:
> 
> #!/bin/sh
> /usr/bin/spamc -f | /usr/sbin/sendmail -oi myname-G/[email protected]
> 
> The spamc is there because I'm using spamassassin; if you aren't, you
> could get rid of all up to and including the '|'.
> 
> Of course, you should test the sendmail command by itself first to
> make sure it works.
> 
> 
> 
> -------------------------------------------------------
> The SF.Net email is sponsored by EclipseCon 2004
> Premiere Conference on Open Tools Development and Integration
> See the breadth of Eclipse activity. February 3-5 in Anaheim, CA.
> http://www.eclipsecon.org/osdn
> _______________________________________________
> Yosucker-general mailing list
> Yosucker-general-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org
> https://lists.sourceforge.net/lists/listinfo/yosucker-general
> 



-------------------------------------------------------
The SF.Net email is sponsored by EclipseCon 2004
Premiere Conference on Open Tools Development and Integration
See the breadth of Eclipse activity. February 3-5 in Anaheim, CA.
http://www.eclipsecon.org/osdn