bug-gnulib
[Top][All Lists]
Advanced

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

[no subject]


From: Assaf Gordon
Subject:
Date: Sat, 1 Aug 2015 23:42:04 -0600

Hello,

This tiny patch fixes a wrong regex in the gawk script 'build-aux/pmccabe2html'.
The commands replace '&' with '&amp;', '>' with '&gt;' and '<' with '&lt;',
but I think the actual replacement doesn't work properly.

A contrived example:

    $ echo '=>=' | gawk '{gsub(">","\&gt;",$0);print}'
    gawk: cmd. line:1: warning: escape sequence `\&' treated as plain `&'
    =>gt;=

The '\&' is treated as '&', and thus has special meaning for gsub (the matched 
string).
The output therefor contains the matched '>' instead of an actual '&'.

With an extra backslash:

    $ echo '=>=' | gawk '{gsub(">","\\&gt;",$0);print}'
    =&gt;=

Another example: the recently updated cyclomatic report for gnu libidn at:
  https://www.gnu.org/software/libidn/cyclo/
contains similarly incorrect HTML tags.
can be seen if one clicks on the down-arrow next to "_g_utf8_normalize_wc"
with lines such as:
===
 while ((max_len gt;= SBase && wc gt;= SBase && wc gt; 0)
===

regards,
 - assaf


Attachment: pmccabe.patch
Description: Binary data


reply via email to

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