On 24 Feb 2000, D. J. Bernstein wrote:

> Peter Samuel writes:
> > Under certain conditions it can leave the queue in a corrupt state.
> 
> No, it can't. See INTERNALS in the qmail package for the complete story.

I _know_ what INTERNALS says Dan, but try this test and you'll see that
it does leave the queue in a corrupt state

    echo "echo "Fpsamuel\0Tpsamuel\0" > /tmp/envelope
    echo hello | qmail-queue 1</tmp/envelope

Because the envelope details do NOT end with two NULL characters,
qmail-queue exits with a 91 and does NOT unlink the mess or intd file.
Here is the relevant part of my truss output:

    alarm(86400)                                    = 0
    open("pid/26826.951372231.1", O_WRONLY|O_CREAT|O_EXCL, 0644) = 3
    fstat(3, 0x000246EC)                            = 0
    link("pid/26826.951372231.1", "mess/21/227882") = 0
    unlink("pid/26826.951372231.1")                 = 0
    read(0, " h e l l o\n", 2048)                   = 6
    read(0, 0x00024780, 2048)                       = 0
    write(3, " R e c e i v e d :   ( q".., 75)      = 75
    fdsync(3, O_RDONLY|O_SYNC)                      = 0
    open("intd/227882", O_WRONLY|O_CREAT|O_EXCL, 0644) = 4
    read(1, " F p s a m u e l\0 T p s".., 2048)     = 19
    _exit(91)

And this is what happens when the envelope details are empty

    echo hello | qmail-queue 1</dev/null

You'll note that the intd and mess files are unlinked. ie qmail-queue
does the right thing.

    open("pid/27027.951372320.1", O_WRONLY|O_CREAT|O_EXCL, 0644) = 3
    fstat(3, 0x000246EC)                            = 0
    link("pid/27027.951372320.1", "mess/14/227898") = 0
    unlink("pid/27027.951372320.1")                 = 0
    read(0, " h e l l o\n", 2048)                   = 6
    read(0, 0x00024780, 2048)                       = 0
    write(3, " R e c e i v e d :   ( q".., 75)      = 75
    fdsync(3, O_RDONLY|O_SYNC)                      = 0
    open("intd/227898", O_WRONLY|O_CREAT|O_EXCL, 0644) = 4
    read(1, 0x00024780, 2048)                       = 0
    fcntl(4, F_FREESP, 0xEFFFF484)                  = 0
    unlink("intd/227898")                           = 0
    fcntl(3, F_FREESP, 0xEFFFF484)                  = 0
    unlink("mess/14/227898")                        = 0
    _exit(54)


I'm running qmail-1.03, Solaris 2.5.1

I can repeat this with qmail-1.03 running Linux 2.0.36 as well.

Regards
Peter
----------
Peter Samuel                                [EMAIL PROTECTED]
Technical Consultant                        or at present:
eServ. Pty Ltd                              [EMAIL PROTECTED]
Phone: +61 2 9206 3410                      Fax: +61 2 9281 1301

"If you kill all your unhappy customers, you'll only have happy ones left"

Reply via email to