Re: courier will be missing in the next stable version of Debian and Devuan

Sam Varshavchik <[email protected]> Sun, 29 Dec 2024 20:34:33 -0500
Newsgroups gmane.mail.imap.courier.general
Message-ID <[email protected]>
anfibiosdeasturias-2--- via courier-users writes:

> --- -   2024-12-29 23:13:13.549399846 +0100
> +++ ./testsuite.txt.idn 2024-01-05 02:51:32.000000000 +0100
> @@ -2,6 +2,7 @@
>  Subject: test-forward
>  Subject: msg1
>  
> +
>  Subject: msg2
>  
>  -rw-------

The difference comes out from this portion of the testsuite script:

cat >testsuite.recipe <<EOF
to "./testsuite.maildir"
EOF
echo "Subject: msg1" | $VALGRIND ./maildrop testsuite.recipe
echo "Subject: msg2" | $VALGRIND ./maildrop testsuite.recipe
sed '/^From /d' <testsuite.maildir
ls -al testsuite.maildir | cut -c1-10

A maildrop recipe containing just a

to "./testsuite.maildir"

gets created.

Then, maildrop is invoked twice, with two messages, containing just a

Subject: msg1

and

Subject: msg2

The maildrop recipe causes both messages to be delivered to an mbox file  
named "testsuite.maildir". The contents of testsuite.maildir are printed,  
then "ls -al" is called on testsuite.maildir, and the first ten characters  
are printed, the file's permissions (that's the "-rw-------" in the output,  
above).

The output is compared against the expected output. The difference is that  
there should be two blank lines between the two messages in the mbox file,  
but there is only one.

The script deletes the From lines in the mbox file (since it varies because  
it includes the current timestamp), but simplifying the script to this:

rm -f testsuite.maildir
cat >testsuite.recipe <<EOF
to "./testsuite.maildir"
EOF
echo "Subject: msg1" | ./maildrop testsuite.recipe
echo "Subject: msg2" | ./maildrop testsuite.recipe
cat ./testsuite.maildir

This should produce output that looks something like this:

-----------------------------------------------------------------------
From MAILER-DAEMON Sun Dec 29 20:03:48 2024
Subject: msg1


From MAILER-DAEMON Sun Dec 29 20:03:48 2024
Subject: msg2

-----------------------------------------------------------------------

According to your make check failure: there's only one empty line.

The second newline actually, logically, belongs to the following From line.  
The relevant lines in the code:

                        if ((stat_buf.st_size > 0 &&
                             mio.write(
#if     CRLF_TERM
                                       "\r\n", 2
#else
                                       "\n", 1
#endif
                                       ) < 0) ||
                            format_mbox.DeliverTo(mio))

That is, if the mbox file is not empty, if its length is greater than 0,  
then add a newline before writing the new message to the mbox file  
(consisting of the "From" line, and the message.

So, the first message into a new, empty, mbox file should not have a blank  
line, as seen above, before the first From line. The first message consists  
of:

Subject: msg1
<empty line>

Then, when the second message gets written, the shown code, above, should  
write a newline before writing the second From line.

In your case, for some reason it doesn't happen. The only reason that I can  
think of is that, for some reason, the stat call indicated that mbox file is  
still empty. I presume that you ran this on an ordinary filesystem, instead  
of some unusual filesystem. Even NFS should get this right.

Investigating this further will involve using strace, I suppose, to see  
what's coming back from the stat() system call…

_______________________________________________
courier-users mailing list
[email protected]
Unsubscribe: https://lists.sourceforge.net/lists/listinfo/courier-users
signature.asc (application/pgp-signature, 228 B)
-----BEGIN PGP SIGNATURE-----

iHUEABYKAB0WIQRupkKLJP96aW75pIOKYPgoojZS4gUCZ3H4qQAKCRCKYPgoojZS
4u1vAP0YnSK3/fkEFOB1jfLyL//a5yBe9IFxEcTDPQh1k34g6wEAky+qT7l4eGzd
XBX6CfuiAv+rRF8hs+G4nuZyrXLoBgM=
=dMJV
-----END PGP SIGNATURE-----