quilt-dev
[Top][All Lists]
Advanced

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

Re: [Quilt-dev] [PATCH] quilt/mail: remove procmail dependency


From: Jean Delvare
Subject: Re: [Quilt-dev] [PATCH] quilt/mail: remove procmail dependency
Date: Tue, 27 Jan 2015 13:05:08 +0100

Hi Kent, Martin,

> On Mon, Jan 26, 2015 at 06:01:09PM -0600, Kent R. Spillner wrote:
> > quilt depends on procmail because 'quilt mail' requires formail.
> > However, formail is only used to extract header values from messages.
> > Since quilt already requires sed we can replace formail -x uses with
> > sed instead.  The sed script is slightly complicated because it
> > needs to handle the case of "Long Header Fields" definied in RFC
> > 2822, but essentially all it's doing is: look for the first line
> > beginning with the name of header we are looking for, and print
> > every line until one that does not start with blanks.
> > 
> > Signed-off-by: Kent R. Spillner <address@hidden>
> > ---
> >  po/de.po      |  4 ----
> >  po/fr.po      |  6 ------
> >  po/ja.po      |  4 ----
> >  po/quilt.pot  |  4 ----
> >  po/ru.po      |  4 ----
> >  quilt/mail.in | 33 +++++++++++++++++++++------------
> >  6 files changed, 21 insertions(+), 34 deletions(-)

Le Tuesday 27 January 2015 à 08:40 +0100, Martin Quinson a écrit :
> Hello,
> 
> I've read the patch, and it seems ok to me. Many thanks for that.

I like it too, however I am not so happy with sed being called twice. I
think we should be able to achieve the same with a single call.

> > +# Extract RFC 2822 compliant header values, including Long Header Fields,
> > +# from messages
> > +
> > +extract_header_value()
> > +{
> > +      local header=$1
> > +
> > +      # Long Header Fields may span multiple lines, in which case CRLF
> > +      # is followed by space or tab (RFC 2822)
> > +      sed -n "/^${header}/,/^[^[:blank:]]/ { /^${header}/ { p; n; }; 
> > /^[^[:blank:]]/q; /^$/q; p; }" | sed "s/^${header}//"
> > +}
> > +

I think the following should work equally well?

        sed -n "/^${header}/,/^[^[:blank:]]/ { /^${header}/ { s/^${header}//p; 
n; }; /^[^[:blank:]]/q; /^$/q; p; }"

-- 
Jean Delvare
SUSE L3 Support




reply via email to

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