Re: Mutt ignoring 'From ' lines in mailbox

2002-04-02 Thread Matthew D. Fuller

On Tue, Apr 02, 2002 at 12:46:36PM -0600 I heard the voice of
David DeSimone, and lo! it spake thus:
> 
> Mutt chooses to be picker about the "From " syntax because some mailers
> don't properly escape a "From " that is inside the body of the message.

Well.

Mutt doesn't escape "^From " in the body either when it writes, since it
always writes with Content-Length: headers.

There's no way to win with mbox.  You escape From_'s, you mangle the
message, which can do things like screw up crypto signatures, and the
various other similar problems.  You don't escape them and rely totally
on Content-Length:, you get yourself into trouble if the file is edited
manually or otherwise changed without updating Content-Length to match.
Say I change stuff in the middle of a message, and the last line is "From
something ".  If I don't adjust the Content-Length:, depending on
how smart the parser is, it'll either:

- Puke when (end-of-header+content-length) isn't the start of a new
  message
- Search forward from(end-of-header+content-length) to try and
  figure out where the next message is, in which case it'll either get an
  extra empty message (my From) if I added stuff, or skip over a whole
  message and include it in the current, if I deleted stuff.
- Search forward AND backward, in which case, who knows?




-- 
Matthew Fuller (MF4839) |[EMAIL PROTECTED]
Unix Systems Administrator  |[EMAIL PROTECTED]
Specializing in FreeBSD |http://www.over-yonder.net/

"The only reason I'm burning my candle at both ends, is because I
  haven't figured out how to light the middle yet"



Re: Mutt ignoring 'From ' lines in mailbox

2002-04-02 Thread David DeSimone

James Greenwood <[EMAIL PROTECTED]> wrote:
>
> I looked more carefully at the From lines of the messages
> it was picking up compared to those it wasn't, and in the 
> ones mutt can see, the sender is an e-mail address, e.g. :
> 
>   From [EMAIL PROTECTED] Tue Oct 16 12:48:57 2001
> 
> whereas in the messages mutt is ignoring, it is a name, e.g.:
> 
>   From Bruce Smith Wed Oct 17 17:08:13 2001
> 
> and just removing the space like this solves the problem:
> 
>   From BruceSmith Wed Oct 17 17:08:13 2001

This is exactly the problem.  Mutt uses a more stringent definition for
the mailbox separator, namely "From  ".  Mutt has
some heuristics for recognizing date stamps, but if the userid is more
than one word, the heuristics fail.  Technically it shouldn't be
multiple words anyway.

> I don't know enough about the mailbox format to know whether
> this is a bug in mutt, or a bug in the LibDBX program I used
> to translate the Outlook files into mailbox format.  

It's a bug in the tool that wrote the mailbox, LibDBX, I suppose.  But
it's hard to fault it, since the mailbox format is so loosely defined.

Mutt chooses to be picker about the "From " syntax because some mailers
don't properly escape a "From " that is inside the body of the message.

-- 
David DeSimone   | "The doctrine of human equality reposes on this:
[EMAIL PROTECTED]   |  that there is no man really clever who has not
Hewlett-Packard  |  found that he is stupid." -- Gilbert K. Chesterson
Richardson IT|PGP: 5B 47 34 9F 3B 9A B0 0D  AB A6 15 F1 BB BE 8C 44



Re: Mutt ignoring 'From ' lines in mailbox

2002-03-31 Thread James Greenwood

On Sun, Mar 31, 2002 at 07:29:06AM -0800, David Ellement wrote:
> On 020331, at 16:23:09, James Greenwood wrote
> > However the problem is still there - on the mailbox I tried,
> > pine still sees 102 messages and mutt sees only 3.
> > 
> > Any other ideas?
> 
> Perhaps formail could reformat the mailbox:
> 
> formail -d newmbox
> 

Thanks David - I tried that, it increased the number of visible
messages from 3 to 14, but all the extra ones were actually
attachments to other messages, not real messages themselves.

However I think I've managed to fix the problem !!! 
I don't know if there's a bug in mutt though.

I looked more carefully at the From lines of the messages
it was picking up compared to those it wasn't, and in the 
ones mutt can see, the sender is an e-mail address, e.g. :

From [EMAIL PROTECTED] Tue Oct 16 12:48:57 2001

whereas in the messages mutt is ignoring, it is a name, e.g.:

From Bruce Smith Wed Oct 17 17:08:13 2001

and just removing the space like this solves the problem:

From BruceSmith Wed Oct 17 17:08:13 2001

The names with spaces are obviously related to the fact that
the e-mails came from Microsoft Outlook folders originally.

I don't know enough about the mailbox format to know whether
this is a bug in mutt, or a bug in the LibDBX program I used
to translate the Outlook files into mailbox format.  

If no-one can answer that off the top of their head I'll read
some docs/ RFCs I guess, and perhaps make a bug report to the
approrpiate person.

Anyway my problem should be easy enough to fix now - I can
feel a regular expression coming on...

Thanks a lot for your help everyone.
James

-- 
James Greenwood | [EMAIL PROTECTED]



Re: Mutt ignoring 'From ' lines in mailbox - Content-Length?

2002-03-31 Thread David Ellement

On 020331, at 16:23:09, James Greenwood wrote
> However the problem is still there - on the mailbox I tried,
> pine still sees 102 messages and mutt sees only 3.
> 
> Any other ideas?

Perhaps formail could reformat the mailbox:

formail -d newmbox

-- 
David Ellement



Re: Mutt ignoring 'From ' lines in mailbox - Content-Length?

2002-03-31 Thread James Greenwood

On Sun, Mar 31, 2002 at 05:21:36AM +0200, Sven Guckes wrote:
> * James Greenwood <[EMAIL PROTECTED]> [2002-03-30 17:05]:
> > I have recently switched from Pine to Mutt and I have several mailboxes
> > that open fine in Pine but not in Mutt.  Mutt seems to concatenate some
> > of the messages together so that there are fewer messages in the
> > index...
> 
> Are there any Content-Length lines?  If so - delete them.
> It's easy with vi:
>   :g/^Content-Length:$/d
> ...
> Does it work now?

Hi Sven!

I couldn't get that g command to work, had to change it to

:g/^Content-Length:.*/d

which seemed to do the trick.  There were Content-Length
lines in the file, which are now gone.

However the problem is still there - on the mailbox I tried,
pine still sees 102 messages and mutt sees only 3.

Any other ideas?

> > .. how can I re-order an existing mailbox file by date so that
> > the file itself changes...
> 
> Tag all messages and the save them to a new file (folder)...

Thanks for that tip, although obviously I won't be able to
try it on my corrupt(?) mailboxes until mutt can read them OK.

> have fun! :-)

OK cheers :-)
James

--
James Greenwood | [EMAIL PROTECTED]



Re: Mutt ignoring 'From ' lines in mailbox - Content-Length?

2002-03-30 Thread Sven Guckes

* James Greenwood <[EMAIL PROTECTED]> [2002-03-30 17:05]:
> I have recently switched from Pine to Mutt and I have several mailboxes
> that open fine in Pine but not in Mutt.  Mutt seems to concatenate some
> of the messages together so that there are fewer messages in the
> index...

Are there any Content-Length lines?  If so - delete them.
It's easy with vi:
  $ vi ~/Mail/folder
  :g/^Content-Length:$/d
  :x
  $ mutt -f ~/Mail/folder

Does it work now?

> .. how can I re-order an existing mailbox file by date so that
> the file itself changes, rather than doing it dynamically (and
> slowly on a large mailbox) every time the mailbox is opened?

Tag all messages and the save them to a new file (folder).

  T tag-pattern
  . all ("contains at least some character")
  ; tag-prefix  (applies following command to all tagges messages)
  C copy-message
  +NEW  foldername "NEW"

The folder "NEW" (usually ~/Mail/NEW) should now
contain all the messages in the current order.
To change the order use 'o' ("sort-mailbox") -
before copying/saving the messages to a new folder.

have fun! :-)

Sven

-- 
Sven Guckes  http://www.math.fu-berlin.de/~guckes/mutt/setup.html
Mutt setup from scratch, Sven's sample setup; attribution, "limit", "list"
vs "subscribe", histories, mailcap, POP, hooks, use of external pagers,
troubleshooting, adding header lines, "from Mozilla to Mutt".