Opened 14 years ago

Closed 14 years ago

#431 closed task (fixed)

GPL text is detected as code

Reported by: Peter Johansson Owned by: Peter Johansson
Priority: major Milestone: svndigest 0.7.2
Component: core Version: 0.7.1
Keywords: Cc:

Description

In multiple C++ files i yat, for example, http://cbbp.thep.lu.se/~jari/svndigest/yat/blame_output/yat/utility/config_public.h.in.html, the GPL header text is counted as code when expected it to be comments.

Change History (5)

comment:1 Changed 14 years ago by Peter Johansson

Owner: changed from Jari Häkkinen to Peter Johansson
Status: newassigned

A hypothesis is that the '' in url is starting '':'\n' codon so that after the newline, we leave comment mode.

Also, I notice that this problem is not occurring in svndigest itself, and the obvious difference between svndigest and yat is that svndigest provides lt codons in config file, whereas yat uses the default.

Is the config in svndigest equal to the default? Is it equivalent to use the default implicitly and use it by first generating it to a file, in other words:

svndigest

svndigest -g /tmp/config && svndigest --config-file=/tmp/config

are they absolutely equivalent?

comment:2 in reply to:  1 Changed 14 years ago by Peter Johansson

Replying to peter:

are they absolutely equivalent?

It should be svndigest -g > /tmp/config && ...

comment:3 Changed 14 years ago by Peter Johansson

It seems something is wrong with the default parsing codons because multiple instacnes of the same codon occur. For instance, when I issue

svndigest -g -r /path/to/yat get the following config file

[parsing-codons]
*.ac = "#":"\n"  ;  "dnl":"\n"  ;  "#":"\n"  ;  "dnl":"\n"
*.am = "#":"\n"  ;  "#":"\n"
*.m4 = "#":"\n"  ;  "dnl":"\n"  ;  "#":"\n"  ;  "dnl":"\n"
*.c = "//":"\n"  ;  "/*":"*/"  ;  "//":"\n"  ;  "/*":"*/"
*.cc = "//":"\n"  ;  "/*":"*/"  ;  "//":"\n"  ;  "/*":"*/"
*.cpp = "//":"\n"  ;  "/*":"*/"  ;  "//":"\n"  ;  "/*":"*/"
*.cxx = "//":"\n"  ;  "/*":"*/"  ;  "//":"\n"  ;  "/*":"*/"
*.h = "//":"\n"  ;  "/*":"*/"  ;  "//":"\n"  ;  "/*":"*/"
*.hh = "//":"\n"  ;  "/*":"*/"  ;  "//":"\n"  ;  "/*":"*/"
*.hpp = "//":"\n"  ;  "/*":"*/"  ;  "//":"\n"  ;  "/*":"*/"
*.java = "//":"\n"  ;  "/*":"*/"  ;  "//":"\n"  ;  "/*":"*/"
*.pl = "#":"\n"  ;  "#":"\n"
*.pm = "#":"\n"  ;  "#":"\n"
*.sh = "#":"\n"  ;  "#":"\n"
*config = "#":"\n"  ;  "#":"\n"
bootstrap = "#":"\n"  ;  "#":"\n"
Makefile = "#":"\n"  ;  "#":"\n"
*.tex = "%":"\n"  ;  "%":"\n"
*.m = "%":"\n"  ;  "%":"\n"
*.jsp = "<!--":"-->"  ;  "<!--":"-->"
*.html = "<%--":"--%>"  ;  "<%--":"--%>"
*.xml = "<!--":"-->"  ;  "<!--":"-->"  ;  "<!--":"-->"  ;  "<!--":"-->"
*.xsl = "<!--":"-->"  ;  "<!--":"-->"
*.xsd = "<!--":"-->"  ;  "<!--":"-->"
*.xhtml = "<!--":"-->"  ;  "<!--":"-->"
*.shtml = "<!--":"-->"  ;  "<!--":"-->"
*.css = "<!--":"-->"  ;  "<!--":"-->"
*.rss = "<!--":"-->"  ;  "<!--":"-->"
*.sgml = "<!--":"-->"  ;  "<!--":"-->"
*.bat = "\nREM":"\n"  ;  "\nrem":"\n"  ;  "\nREM":"\n"  ;  "\nrem":"\n"

comment:4 Changed 14 years ago by Peter Johansson

The problem is that set_default is called twice. First in load(void) from the instance function and then as part of load(istream&). This implies that parse codons are added twice as we can see in example above. This is not a problem when config file do contain a parse-codons section because then the default codons are cleared before adding the one from config file.

We should probably remove the call to set_default in load(istream&). Should we also bump the cache_check_str in Stats.h, which means cache files prior the fix will be treated as invalid, in words, cache files will be ignored?

comment:5 Changed 14 years ago by Peter Johansson

Resolution: fixed
Status: assignedclosed

(In [994]) Fixed bug so default codons are not added twice to configuration file. The bug caused some comment lines to be interpreted as code lines. Cache file version is upgraded to prevent that old cache file (which reflects this bug) are used to create new reports. A notice is sent to stdout telling the user the cache file is out-dated.

fixes #431

Note: See TracTickets for help on using tickets.