quilt-dev
[Top][All Lists]
Advanced

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

Re: [Quilt-dev] Re: ftw removed; emacs mode; translations; ready for 0.4


From: Jean Delvare
Subject: Re: [Quilt-dev] Re: ftw removed; emacs mode; translations; ready for 0.43?
Date: Fri, 3 Feb 2006 09:54:16 +0100

Hi Andreas, John,

[John Vandenberg]
> > The attached patch fixes the problem.
> 
> > Sun awk does not like ~ syntax.  Also, the commands
> > need to be reordered otherwise /^$/ causes it to
> > bail out too early.

[Andreas Grünbacher]
> I don't understand the reorder issue, and neither the $ in /^[a-z]+:[ $\t]/.

Neither do I.

While checking the original code and John's replacement proposal, I
found that the original code doesn't seem to work for me:

        /^$/    { exit (!mh || not_mh) }
        END     { exit (!mh || not_mh) }
        { if ($0 ~ /^[a-z]+:[ \t]/i)
            mh = 1
          else
            not_mh = 1
        }

The "i" modifier after the regular expression doesn't work as expected,
and seems to confuse gawk (3.1.5). In fact there is no way I could get
the code snippet above to exit with success (0). Replacing
/^[a-z]+:[ \t]/i with /^[A-Za-z]+:[ \t]/ made it work somewhat. But
even then I'm not sure it does what we want it to do. Isn't a line like:
Reply-To: address@hidden
supposed to match the regular expression? It doesn't at the moment,
because we don't allow dashes.

So now I wonder, does the original code actually work for anyone?

John, are you sure that the ~ construct, and not that trailing i, was
confusing Sun's awk? According to my awk reference, ~ is a pretty
standard construct.

Anyway, this code seems to be overly complicated in the first place.
What about this instead:

        /^$/    { exit }
        END     { exit (not_mh) }
        !/^[A-Za-z-]+:[ \t]/    { not_mh=1 ; exit }

Works for me and should be totally portable. John, can you please test
with Sun's /usr/xpg4/bin/awk for confirmation?

Note that the attached patch breaks the test suite. My analysis is that
the old awk code didn't work, and this hid a different bug in mail.in,
which we will now have to hunt for.

Thanks,
-- 
Jean Delvare

Attachment: quilt-fix-awk-in-mail.patch
Description: Text document


reply via email to

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