Here's what I'm doing... creating an on-the-fly composition file that
gets piped into 'mhbuild -', like this (under bash 2.01.1):
SUBJECT=$(cat $(mhpath $TARGET) | formail -x Subject)
format_file=$(mhparam path)/abuse.fab.format
sed -e "s/%SUBJ%/$SUBJECT/" -e "s|%TARGET%|$TARGET|" \
$format_file | mhbuild -debug - > $(mhpath +drafts new)
Now, if I run this script on linux (libc.so.5.4.38), it works, giving
me a draft message, pre-expanded, that I can 'comp -use -draftm
+drafts last'. If I run exactly the same script on Solaris 2.5.1
(same version of bash), it doesn't work. I can reduce it to the
minimal case, a typescript of which it attached, but for giggles, it's
this:
cat /tmp/andy | mhbuild - > /tmp/andy1
fails, but
mhbuild - > /tmp/andy1 < /tmp/andy
works. Here, /tmp/andy contains the post-sed abuse.fab.format, and
it's catted in the typescript.
Next, I've attached the bottomish part of what the script that fails
says when I say 'truss mhbuild -debug' instead of just 'mhbuild
-debug'.
So, what the heck is going on here? Lseeking on stdin or something?
Andy
Script started on Mon Mar 23 17:36:43 1998
marlin /home/a907932/mh-mail 5 $ cat /tmp/andy
To: andy
Fcc: nmh-workers
Subject: SPAM: Fwd: Here it is, the sight everyone has been waiting for.
---------
#<text/plain [Introduction]
I don't want this spam. Please make the offending sender go away,
and/or stop relaying mail for them (even if you didn't mean to).
Andy Kailhofer
postmaster(_at_)ameritech(_dot_)com
#forw [Spammish Exposition] cur
marlin /home/a907932/mh-mail 6 $ cat /tmp/andy | mhbuild -debug -
big endian architecture
Content-Type: multipart/mixed
mhbuild: no content directives found
marlin /home/a907932/mh-mail 7 $ mhbuild -debug - < /tmp/andy
big endian architecture
Content-Type: multipart/mixed
Content-Type: text/plain [Introduction]
Content-Type: forw [Spammish Exposition] cur
Content-Type: message/rfc822
To: andy
Fcc: nmh-workers
Subject: SPAM: Fwd: Here it is, the sight everyone has been waiting for.
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="----- =_aaaaaaaaaa0"
Content-ID:
<12832(_dot_)890696233(_dot_)0(_at_)marlin(_dot_)bdy(_dot_)wi(_dot_)ameritech(_dot_)com>
------- =_aaaaaaaaaa0
Content-Type: text/plain; charset="us-ascii"
Content-ID:
<12832(_dot_)890696233(_dot_)1(_at_)marlin(_dot_)bdy(_dot_)wi(_dot_)ameritech(_dot_)com>
Content-Description: Introduction
I don't want this spam. Please make the offending sender go away,
and/or stop relaying mail for them (even if you didn't mean to).
Andy Kailhofer
postmaster(_at_)ameritech(_dot_)com
------- =_aaaaaaaaaa0
Content-Type: message/rfc822
[ the rest of the spam I'll be forwarding deleted here ]
------- =_aaaaaaaaaa0--
marlin /home/a907932/mh-mail 9 $ exit
exit
script done on Mon Mar 23 17:37:20 1998
------------------------------------------------------------------------
open("/home/a907932/.mh_profile", O_RDONLY) = 3
fstat(3, 0xEFFFDA50) = 0
brk(0x0004CD10) = 0
brk(0x0004ED10) = 0
ioctl(3, TCGETA, 0xEFFFD9DC) Err#25 ENOTTY
read(3, " A l i a s f i l e : a".., 8192) = 587
read(3, 0x0004BD2C, 8192) = 0
read(3, 0x0004BD2C, 8192) = 0
lseek(3, 0, SEEK_CUR) = 587
close(3) = 0
stat("/home/a907932/mh-mail", 0xEFFFE0F8) = 0
open("/home/a907932/mh-mail/context", O_RDONLY) = 3
fstat(3, 0xEFFFDA50) = 0
ioctl(3, TCGETA, 0xEFFFD9DC) Err#25 ENOTTY
read(3, " C u r r e n t - F o l d".., 8192) = 20
read(3, 0x0004BD2C, 8192) = 0
read(3, 0x0004BD2C, 8192) = 0
lseek(3, 0, SEEK_CUR) = 20
close(3) = 0
bigwrite(2, " b i g", 3) = 3
endian architecture
write(2, " e n d i a n a r c h".., 21) = 21
access("/home/a907932/mh-mail/mhbuild.defaults", 4) Err#2 ENOENT
access("/usr/local/nmh/etc/mhbuild.defaults", 4) Err#2 ENOENT
open("mhbuild.defaults", O_RDONLY) Err#2 ENOENT
umask(037777777133) = 022
getpid() = 12603 [12601]
access("mhbuilda0034v", 0) Err#2 ENOENT
unlink("mhbuilda0034v") Err#2 ENOENT
open("mhbuilda0034v", O_WRONLY|O_CREAT|O_TRUNC, 0666) = 3
ioctl(0, TCGETA, 0xEFFFDB24) Err#22 EINVAL
fstat(0, 0xEFFFDB98) = 0
read(0, " T o : a n d y\n f c c".., 5120) = 339
fstat(3, 0xEFFFCFF0) = 0
brk(0x0004ED10) = 0
brk(0x00050D10) = 0
ioctl(3, TCGETA, 0xEFFFCF7C) Err#25 ENOTTY
lseek(0, 0xFFFFFF15, SEEK_CUR) Err#29 ESPIPE
Content-Typewrite(2, " C o n t e n t - T y p e", 12) = 12
: write(2, " : ", 2) = 2
multipart/mixedwrite(2, " m u l t i p a r t / m i".., 15) = 15
write(2, "\n", 1) = 1
read(0, 0x0004BD5C, 5120) = 0
lseek(0, 0, SEEK_CUR) Err#29 ESPIPE
close(0) = 0
getpid() = 12603 [12601]
open("/tmp/snprintf012603", O_RDWR|O_CREAT|O_EXCL, 0600) = 0
unlink("/tmp/snprintf012603") = 0
ioctl(0, TCGETA, 0xEFFFC544) Err#25 ENOTTY
fstat(0, 0xEFFFC5B8) = 0
brk(0x00050D10) = 0
brk(0x00052D10) = 0
write(0, " n o c o n t e n t d".., 27) = 27
lseek(0, 0, SEEK_SET) = 0
read(0, " n o c o n t e n t d".., 8192) = 27
read(0, 0x00050A5C, 8192) = 0
lseek(0, 0, SEEK_CUR) = 27
close(0) = 0
mhbuild: no content directives found
writev(2, 0xEFFFD3C0, 4) = 37
unlink("mhbuilda0034v") = 0
write(3, " T o : a n d y\n f c c".., 94) = 94
_exit(1)
+ '[' 0 -ne 0 ']'
+ sleep 3