Bering-uClibc 2.1, and possibly several other LEAF variants, have
a bug in POSIXness.mail triggered when the "-v" option to the mail
command is used.  Here's an example of the bug in action:

  firewall# mail -v -s "This is a test" [EMAIL PROTECTED] < /dev/null
    [..]
  4: 250 RCPT TO:<[EMAIL PROTECTED]>
  5: 354 DATA
  6: 354 Date: Sun, 25 Jan 2004 04:50:54 +0000
  6: 354 From: [EMAIL PROTECTED]
  6: 354 Subject:
  6: 354 To: This is a test [EMAIL PROTECTED]
  6: 354 X-Mailer: POSIXness Mail
    [..]

Notice that the "Subject" header line is blank and the subject has
been prepended to the "To" header line.  The problem is the "v" in
getopts optstring should not be followed by a colon since "-v" does
not take an argument.  The bug is only triggered when "-v" is used.
The trivial patch attached fixes the problem for me.

--Brad

--- POSIXness.mail.orig 2004-01-24 23:45:13.000000000 -0500
+++ POSIXness.mail      2004-01-24 23:45:39.000000000 -0500
@@ -188,7 +188,7 @@
        user=${user:-root}
        smtpserv=${MAIL_SERVER:-mail}
 
-       while getopts v:a:b:c:d:h:s: opt ; do
+       while getopts va:b:c:d:h:s: opt ; do
                case "$opt" in
                        a) att="$OPTARG" ;;
                        b) bcc="$OPTARG" ;;

Attachment: signature.asc
Description: Digital signature

Reply via email to