From: John Mackin <mackin@vast.eecs.unsw.oz.au>
Date: Sat, 20 Apr 91 01:56:47 +1000
Subject: WARNING: 1.5.1 faces.sendmail is broken
When I looked at the patch, I didn't think it could work; I've just
tried it, and it doesn't. Rich, I guess you didn't test it -- or
had a different idea of how it was meant to work.
[...]
**** DO NOT USE THE 1.5.1 VERSION; IT IS A DISASTER ****
If you use it, the newline that is meant to separate the headers of
your mail from the body will get dropped, and the first part of the
body will be taken as (doubtless illegal) headers, and things will
be very bad.
This stirred up a bit of comment, most of which seemed to me to be
somewhat confused. I decided to wait until I had a chance to develop
a new version of the script before following up to it all; I've now
done that. In mail that wasn't sent to the list, Philippe suggested
that I was ``overreacting''. I think he thought I was claiming _his_
version of faces.sendmail -- viz., 1.5._0_ -- was a disaster. I was
not claiming that; please reread the referenced message. All I said
about the 1.5.0 faces.sendmail was that it would work on some systems,
with some versions of echo. That was perfectly true, and cannot be
considered an ``overreaction'' by anyone.
Then Dave Cohrs, in the second referenced message, wrote:
Well, v1.5.1 does seem to have problems. [...] Perhaps it's a
result of this problem John mentioned.
The problems Dave was talking about, though, were in fact nothing to
do with faces.sendmail at all. In case anyone is still in the dark
about them, they have to do with the fact that the 1.5.1 version of
compface/gen.c seems to be incorrect. Victor's version may be better;
I haven't personally looked into that, but I am following it up with
James, and will get back to the list when I have definite information.
Rich wrote, in the third referenced message (text re-ordered):
So what are other people seing? Is v1.5.1 a disaster?
I never meant to imply that 1.5.1 in general was a disaster. I meant
to imply that 1.5.1 _faces.sendmail_ was a disaster -- and it is.
Well, I'm not sure why it's not working for you John. Or perhaps I
should say, I don't know why it's working for me? This is getting
rather confusing. Can we have some feedback from the other guinea
pigs (sorry, I mean beta users) on this list?
[Rich gives details of just how 1.5.1 faces.sendmail works OK for him]
I realise I did end up putting several parts of patch #1 together
in a hurry, but yes, I did test this.
Well now. Faced with a situation like that, I investigated further.
The facts are indeed exactly as I stated them in the first referenced
message. 1.5.1 faces.sendmail _does_ drop the newline between the headers
and the body. There is no question at all about that. If anyone on the
list would like to see it happening for themselves, all they need do is
do what I did: edit faces.sendmail to finish with `> PUS' instead of
`| /usr/lib/sendmail "$@"', send some mail and cat PUS. There will be
_no_ blank line between the last line of the X-Face: header and the
first line of the body.
Why doesn't the universe end, then? It seems that some implementations
of sendmail decide that they can smell disaster on the East wind under
these conditions, and supply a blank line for free. That's the only
reason it works. Move to a different delivery agent, or perhaps even
a different version of sendmail, and all bets are off. And of course,
not even this gross sendmail hack can save the day if the first line
of the message happens to begin with whitespace: in that case, sendmail
will happily believe it is a continuation of the X-Face: header, and it's
good night, Irene.
So. Where does that leave us? It leaves us with 1.4 faces.sendmail, which
works, is portable, and doesn't seem to do what everyone wants; with 1.5.0
faces.sendmail, which works on some systems under some conditions, and isn't
portable; and with 1.5.1 faces.sendmail, which doesn't work.
Herewith, the _last_ revision of faces.sendmail.
It does what you want. It's portable. It works. (And it only uses one
sed.)
Rich, you might like to make this `official' by giving it a real version
number and arranging for it to go in the archive server and version on
iuvax.
And of course, if I have screwed up, I am sure everyone will let me know.
I don't think I have, though.
John.
#!/bin/sh
#
# @(#)faces.sendmail 1.3-unofficial
#
# Small script to automatically add X-Face: compressed image lines to a
# mail message header. This shell script should be run by adding a line
# similar to:
#
# set sendmail=/usr/local/bin/faces.sendmail
#
# to your ~/.mailrc file. See the faces manual pages for more details, and
# how to setup yout ~/.face file.
#
# Copyright 1990, 1991 John J. Mackin. All rights reserved.
#
# Permission is given to distribute these sources, as long as the
# copyright messages are not removed, and no monies are exchanged.
#
# No responsibility is taken for any errors or inaccuracies inherent
# either to the comments or the code of this program, but if
# reported to me then an attempt will be made to fix them.
#
cat $HOME/.face - | sed -n \
-e '1s/^/X-Face:/' \
-e 1h \
-e 1d \
-e '/^[ ]/{H;d;}' \
-e ': copy0' \
-e '/^$/!{p;n;}' \
-e '/^$/!b copy0' \
-e g \
-e p \
-e 'a\
' \
-e n \
-e ': copy' \
-e p \
-e n \
-e 'b copy' | /usr/lib/sendmail "$@"