nmh-workers
[Top] [All Lists]

whatnow with dist: external sendproc doesn't pass -dist to post

1992-07-24 05:22:21
[Sorry to use MUSH. :-)  My MH setup is screwed up to let me make this demo.]

BACKGROUND:  I've written a sendproc shell script that adds a signature
file to the end of a mail message.  The shell script is simple:
it tests $mhdist to be sure the draft isn't from "dist", grabs the draft
filename from the command line, uses "cat >>" to append a signature,
then exec's /usr/local/mh/send with the command line arguments.

With comp, repl and forw, it works just fine.

THE PROBLEM: When I use dist with my sendproc, this happens:

        % dist
                ...
        What now? s
        post: illegal header line -- Resent-To:
        post: illegal header line -- Resent-Fcc:
        post: re-format message and try again
        whatnow: message not delivered to anyone

Why?  All the environment variables like mhdist are getting passed
to "send".  My script isn't changing anything in the environment.

Turns out that *any* external sendproc will have the same problem.
If I comment out the sendproc: in the MH profile and "dist" uses its
internal sendproc, it works fine.

THE CAUSE:  The external sendproc, /usr/local/mh/send, doesn't seem to
pass the -dist switch to "post".  (The internal sendproc does.)  Right?

REPEAT-BY:

1)  Make a fake postproc shell script called /tmp/snoop.
This will show the environment and arguments passed to 'post':

        % cd /tmp
        % cat snoop
        #! /bin/sh
        printenv
        for arg
        do echo "arg is '$arg'"
        done
        exit 1

2)  Make an external sendproc -- a symbolic link named "/tmp/tmpsend"
pointing to /usr/local/mh/send.  (I do this so that the sendproc
won't be named "send", to be sure "whatnow" uses an external sendproc.)

        % ln -s /usr/local/mh/send tmpsend

3)  Add these to the MH profile:

        postproc: /tmp/snoop
        sendproc: /tmp/tmpsend

4)  Use "dist".  Notice that, although $mhdist is in the environment
and set to 1, the postproc isn't getting a -dist switch from send:

        % dist
        Resent-To: jerry
        Resent-cc:
        Resent-Bcc:
        Resent-Fcc: test
        Resent-Comments:
        Resent-Comments:
        --------
        --------

        What now? s
                ...list of envariables from "printenv"...
        USER=jerry
        editalt=/mh/jerry/inbox/333
        mhaltmsg=/mh/jerry/inbox/333
        mhdist=1
        mhdraft=/mh/jerry/drafts/17
        mheditor=prompter
        mhfolder=/mh/jerry/inbox
        mhuse=0
        arg is '-library'
        arg is '/mh/jerry'
        arg is '-alias'
        arg is 'aliases'
        arg is '/mh/jerry/drafts/17'
        whatnow: message not delivered to anyone

        What now? q d

5)  Delete (comment out) the sendproc: from the MH profile and try again.
Notice that now, using the internal sendproc, -dist is set.

(ALSO: notice that -msgid is set with internal sendproc but NOT with external.
Maybe that's another bug?)

        % dist
        Resent-To: jerry
        Resent-cc:
        Resent-Bcc:
        Resent-Fcc: test
        Resent-Comments:
        Resent-Comments:
        --------
        --------

        What now? s
                ...list of envariables...
        USER=jerry
        editalt=/mh/jerry/inbox/333
        mhaltmsg=/mh/jerry/inbox/333
        mhdist=1
        mhdraft=/mh/jerry/drafts/17
        mheditor=prompter
        mhfolder=/mh/jerry/inbox
        mhuse=0
        arg is '-library'
        arg is '/mh/jerry'
    arg is '-msgid'
        arg is '-alias'
        arg is 'aliases'
    arg is '-dist'
        arg is '/mh/jerry/drafts/17'
        send: message not delivered to anyone

        What now? q d

VERSION INFO:

        version: MH 6.7.2 #1[UCI] (rubble) of Mon Apr 20 17:13:08 EDT 1992
        options: [BIND] [BSD42] [BSD43] [DBM] [DUMB] [FOLDPROT='"0750"'] [ISI]
                 [MHRC] [MSGPROT='"0640"'] [POP] [POP] [POP2]
                 [POPSERVICE='"pop3"'] [SENDMTS] [SENDMTS] [SUN40] [SUN41]
                 [TYPESIG='void'] [ZONEINFO]

MH PROFILE I USED FOR THE TEST:

        Aliasfile: aliases
        Draft-Folder: drafts
        Path: /mh/jerry
        send: -msgid
        #: DEBUG DEBUG:
        #sendproc: /tmp/tmpsend
        postproc: /tmp/snoop

Sorry that I don't have time to dig into the code.  As usual when I
find bugs, I'm swamped working on the MH book.  Any clues?  Thanks.

--Jerry Peek, jerry(_at_)ora(_dot_)com

<Prev in Thread] Current Thread [Next in Thread>
  • whatnow with dist: external sendproc doesn't pass -dist to post, Jerry Peek <=