[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [bug-mailutils] Is this a Bug? Readmsg Omits From Line

From: Sergey Poznyakoff
Subject: Re: [bug-mailutils] Is this a Bug? Readmsg Omits From Line
Date: Tue, 13 Feb 2007 10:49:19 +0200

Neil R. Ormos <address@hidden> wrote:

> 2.  I don't mean to seem ungrateful, but what
>      about the -h option?  The elm implementation
>      of readmsg also copies the 'From ' marker if
>      the -h option is supplied.  If Mailutils
>      readmsg is intended to be a superset of elm
>      readmsg, users may reasonably expect the -h
>      option to duplicate the behavior of the elm
>      implementation when the user desires to
>      extract a verbatim copy of specified messages.

It can be implemented easily [1], however I strongly doubt that would be
right.  As I said, the 'From ' marker is not a message header, so I see
no reason why -h, which is supposed to show all *headers*, should
display it as well. Besides, as I said earlier, in the majority of
mailbox formats, there's no 'From ' marker at all...
>      I suppose that a reasonable workaround for
>      extracting a verbatim copy of specified
>      messages is to use an appropriate argument to
>      -w, specifically -w 'From_ \' .

No, this does not work.  But this does:

       readmsg -h -w From_ 

>      I would have thought that
>        -w 'From_ a b c d ...' etc.
>      should also work, and it mostly does, but some
>      non-alpha characters are handled incorrectly.

Which ones, exactly?

>      Including " or ' in the
>      argument to -w provokes a segfault.

I have fixed it [2]. Thanks for reporting.

>      Including ! in the argument appears to artificially
>      terminate the list; anything thereafter is
>      ignored.

The specification of '!' in the original readmsg documentation is rather
obscure: in particular, the precedence of the operator is not specified.
It is not clear, for example, whether the two specifications '!X-From-
X-From' and 'X-From !X-From-' are different.

In my implementation, negation has higher precedence than normal
patterns, so to include all headers, matching 'X-From*', except those
matching 'X-From-*' one should use:

   -w '!X-From- X-From'


[1]. Replace the

  if (all_header)
      weedc = 0;
      weedv = NULL;

in the patched version of the program (around line 350), with:

  if (all_header)
      unix_header = 1;
      weedc = 0;
      weedv = NULL;

[2]. Here's the patch:

Index: mailbox/argcv.c
RCS file: /cvsroot/mailutils/mailutils/mailbox/argcv.c,v
retrieving revision 1.16
diff -p -u -r1.16 argcv.c
--- mailbox/argcv.c     27 Jun 2006 13:07:56 -0000      1.16
+++ mailbox/argcv.c     13 Feb 2007 08:39:04 -0000
@@ -348,8 +348,11 @@ argcv_get_n (const char *command, int le
       if ((command[start] == '"' || command[end] == '\'')
          && command[end] == command[start])
-         start++;
-         end--;
+         if (start < end)
+           {
+             start++;
+             end--;
+           }
          unquote = 0;

reply via email to

[Prev in Thread] Current Thread [Next in Thread]