>Number:         164302
>Category:       bin
>Synopsis:       mail expands aliases beyond #
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Thu Jan 19 06:30:11 UTC 2012
>Closed-Date:
>Last-Modified:
>Originator:     Stefan Schaeckeler
>Release:        9.0
>Organization:
>Environment:
FreeBSD taipei 9.0-RELEASE FreeBSD 9.0-RELEASE #0: Mon Jan 16 05:33:35 PST 2012 
    root@taipei:/usr/obj/usr/src/sys/TAIPEI  i386
>Description:
I'm not sure if this is a bug or a feature. For, me, it's a bug :) 

/usr/bin/mail parses ~/.mailrc and expands aliases in an unexpected way, e.g. 
for such an entry

--- snip ---
alias stefan   import...@internet.com  # that's me
--- snip ---

/usr/bin/mail sends out email to 4 recipients:

1. import...@internet.com
2. #
3. that's
4. me

I'm also using emacs/rmail which expands aliases from ~/.mailrc, but only up to 
the #. That's more intuitive.

>How-To-Repeat:

>Fix:
A fix could stop reading beyond # in usr.bin/mail/list.c:getrawlist(). See 
attachment.

Patch attached with submission follows:

--- list.c.orig 2012-01-19 06:04:25.000000000 -0800
+++ list.c      2012-01-19 05:47:29.000000000 -0800
@@ -393,7 +393,7 @@
        for (;;) {
                for (; *cp == ' ' || *cp == '\t'; cp++)
                        ;
-               if (*cp == '\0')
+               if (*cp == '\0' || *cp == '#')
                        break;
                if (argn >= argc - 1) {
                        printf(
@@ -402,7 +402,7 @@
                }
                cp2 = linebuf;
                quotec = '\0';
-               while ((c = *cp) != '\0') {
+               while ((c = *cp) != '\0' && c != '#') {
                        /* Allocate more space if necessary */
                        if (cp2 - linebuf == linebufsize - 1) {
                                linebufsize += BUFSIZ;


>Release-Note:
>Audit-Trail:
>Unformatted:
_______________________________________________
freebsd-bugs@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-bugs
To unsubscribe, send any mail to "freebsd-bugs-unsubscr...@freebsd.org"

Reply via email to