fetchmail-friends
[Top] [All Lists]

[fetchmail] Re: "Limit" doesn't cooperates with "flush"

2003-10-02 04:53:14
Quoting from Benjamin Drieu's mail on Sun, Sep 28, 2003 at 12:09:06AM +0200:
here is a patch to fix Debian bug #212240 [1].  A small bug was
introduced in 6.2.4 that prevent oversized messages to be flushed if
both "flush" and "limit" were specified.

[ Ralph Seichter had also complained about this change, however I
could not explain then why this change is required. ]

There are a few reasons why 'flush' should not be used to delete
oversized messages.

- 'limit' is a resource limit control option, 'flush' is not. Using
  the two in combination is neither safe nor intuitive. 'flush' is
  specifically for deleting old seen mails. Overloading it is
  dangerous.

- When one uses 'flush' on the command line, it is usually to delete
  old mails only. If one has the following rc file,

poll server
    keep
    limit 10000

  and occasionally invokes 'fetchmail -F' to delete old seen mails,
  the oversized mails will also get deleted. More often than not, this
  will not be the intention of the user.
  
  One can avoid this by invoking 'fetchmail -F -l 0' on the command
  line instead. But, it is not obvious at first glance.

- Currently, there is a serious bug in the uidl code where unseen
  messages are marked as seen under specific options. I have attempted
  to fix it in the thread "fetching uids of mails". If a user has
  specified 'flush' to delete oversized mails by default, such mails
  will also get deleted! If one has the following rc file,

set daemon 300
poll server
    protocol pop3
    uidl 
    no fetchall         # for uidl to work
    limit 10000         # don't download mails over 10kb,
    flush               # delete them instead
    fetchlimit 10       # do not download too many mails at one go

  [ this bug is visible only when one has resource control options
  like 'fetchlimit' or 'expunge' which do not download all new mails
  in one session ]

  Due to the bug, only the first 10 of the existing new mails get
  downloaded. The remaining mails are marked as seen and not
  downloaded in further polls. The 'flush' option (which has been
  added here specifically to delete oversized mails only) will make
  the matter worse by deleting all the remaining new mails without
  downloading!

  After the patch, the problem should be fixed. However, this bug
  gives a feeling that having 'flush' in the rc file by default for
  any other purpose than deleting old seen mails is a dangerous thing.
  When things start going wrong, 'flush' will make the matters worse.

I suggest that a resource control option like 'limitflush <number>' be
added. If acceptable, I could make a patch for this.

-- 
Sunil Shetye.