https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=289908

            Bug ID: 289908
           Summary: mail(1) "inc" + "save" command creates malformed mbox
                    file it can't re-open properly
           Product: Base System
           Version: Unspecified
          Hardware: Any
                OS: Any
            Status: New
          Severity: Affects Only Me
          Priority: ---
         Component: bin
          Assignee: [email protected]
          Reporter: [email protected]

According to the man page for `mail(1)` it should take a message-list (and
according to POSIX an *optional*, see #268402) mbox file.  However, when
providing a message-list of more than one message, the resulting mbox file
lacks blank lines before the `^From` separator lines.  This prevents `mail(1)`
from seeing each distinct message in the mbox file.

To reproduce with an empty $MAIL spool:

    $ rm -f newfolder 2>/dev/null # make sure newfolder doesn't already exist
    $ echo "body1" | mail -s "Test1" $USER
    $ mail
    (see the 1 message listed)

and in another terminal issue

    $ echo "body2" | mail -s "Test2" $USER

Now if I do in my initial `mail` session

    & inc

it brings in the new message and

    & h

properly lists them.  Now if I save those two messages in a new folder:

    & save 1 2 newfolder
    "newfolder" [New file]

when I open that new folder:

    & folder newfolder
    & h

or opening it in mail:

    $ mail -f newfolder

it only shows one message.  However, when I display that message, the body of
the second message is now part of the first message.  When I open the
`newfolder` file in `vi` or another text editor, there is no blank line before
the `From` line of the second message.  Adding one and reopening the folder now
correctly shows two messages.

There seems to be something with the `inc` aspect because if I just send two
messages and save them:

    $ rm -f newfolder
    $ echo "body1" | mail -s "Test1" $USER
    $ echo "body2" | mail -s "Test2" $USER
    $ mail
    & save 1 2 newfolder
    & folder newfolder

it correctly identifies them as two messages when I

    & h

-- 
You are receiving this mail because:
You are the assignee for the bug.

Reply via email to