[Dovecot] Pigeonhole: extprograms - pipe

Anes Mukhametov dovecot at anes.su
Sat May 18 10:58:28 EEST 2013


No result:

[root at backend1 scripts]# cat spam.sh
#!/bin/bash

cat > /dev/null

exit 0
[root at backend1 scripts]#

In the log: May 17 22:42:56 backend1 dovecot: script: Error:
write(response) failed: Broken pipe

:(

On Sat, May 18, 2013 at 2:05 AM, Ben Morrow <ben at morrow.me.uk> wrote:

> At  7PM +0400 on 17/05/13 you (Anes Mukhametov) wrote:
> > Hello!
> >
> > I've tried to use extprograms pipe feature but stuck with "Broken pipe"
> > errors in mail log:
> >
> > May 17 15:18:57 backend1 dovecot: lmtp(20338, user at domain.tld): Debug:
> > 3VMVFWFKllFyTwAArRg8UA: sieve: action pipe: running program: learn
> > May 17 15:18:57 backend1 dovecot: script: Error: write(response) failed:
> > Broken pipe
>
> I suspect that what's happening here is that your script isn't reading
> the whole mail. However, that pipe that's broken is (I think) the socket
> from the script service back to the master service, so I don't quite
> understand how that could happen.
>
> > May 17 15:18:57 backend1 dovecot: lmtp(20338, user at domain.tld):
> > 3VMVFWFKllFyTwAArRg8UA: sieve: execution of script
> > /data/mail/storage/domain/user at domain.tld/.dovecot.sieve;name=main
> script
> > failed, but implicit keep was successful (user logfile
> > /data/mail/storage/domain/buser at domain.tld/.dovecot.sieve.log should
> reveal
> > additional details)
> >
> > /data/mail/storage/domain/buser at domain.tld/.dovecot.sieve.log:
> > error: msgid=<c7cd36f19be8164addf091a646b8b284 at domain.tld>: pipe action:
> > failed to pipe message to program `learn': refer to server log for more
> > information. [2013-05-17 15:18:57] ham user at domain.tld 50796.
>
> Mmm, recursively-referential error logs. Always fun...
>
> > spam.sh is message processing script which interacts with spamassassin.
> > I've tested pipe with spam.sh that redirects stdin to /dev/null and
> returns
> > 0 but errors were logged anyway.
>
> Well, you shouldn't do that: redirecting stdin from /dev/null in a shell
> script will close the incoming pipe, which means you won't read the mail
> at all and sieve will get upset. What you need to do instead (if you've
> got data to read and nothing to do with it) is 'cat >/dev/null', which
> will read it all and throw it away.
>
> > Note that spam.sh runs, getting the message from sieve and processing it
> to
> > spamassassin without a problem, but "broken pipe" is being logged.
>
> Hmm. Are you sure your real script is exitting with 0? spamc in learn
> mode exits 5 or 6 depending on whether the mail was already learned or
> not.
>
> Ben
>
>


More information about the dovecot mailing list