8.4.2: "missing template section"

86 views
Skip to first unread message

Peter Schuller

unread,
Mar 21, 2009, 11:49:22 AM3/21/09
to asci...@googlegroups.com
Upgrading from 8.3.5 to 8.4.2, invocing asciidoc on even a trivial
text file gives me:

WARNING: [music-block] missing template section
WARNING: [music-block] missing template section

Googling/searching the ML didn't yield much. Am I missing something or
is the music filter in need of updates to new syntax? I could have
sworn I saw this for graphviz too at some point, but I could be wrong.

--
/ Peter Schuller

PGP userID: 0xE9758B7D or 'Peter Schuller <peter.s...@infidyne.com>'
Key retrieval: Send an E-Mail to getp...@scode.org
E-Mail: peter.s...@infidyne.com Web: http://www.scode.org

Stuart Rackham

unread,
Mar 21, 2009, 11:56:51 PM3/21/09
to asci...@googlegroups.com
Peter Schuller wrote:
> Upgrading from 8.3.5 to 8.4.2, invocing asciidoc on even a trivial
> text file gives me:
>
> WARNING: [music-block] missing template section
> WARNING: [music-block] missing template section
>
> Googling/searching the ML didn't yield much. Am I missing something or
> is the music filter in need of updates to new syntax? I could have
> sworn I saw this for graphviz too at some point, but I could be wrong.
>

Sounds like it's not picking up your filters configuration files, run
asciidoc with the --verbose option, the output should show something like:

reading: ... /filters/source/source-highlight-filter.conf
reading: ... /filters/music/music-filter.conf
reading: ... /filters/code/code-filter.conf
reading: ... /filters/graphviz/graphviz-filter.conf


Cheer,Stuart

Peter Schuller

unread,
Mar 23, 2009, 5:19:18 PM3/23/09
to asci...@googlegroups.com
Ok, some progress here. Short version: It seems to break as a function
of the order in which the filter configuration files are
loaded. Longer story with details (and patch to re-produce
deterministically):

> > Upgrading from 8.3.5 to 8.4.2, invocing asciidoc on even a trivial
> > text file gives me:
> >
> > WARNING: [music-block] missing template section
> > WARNING: [music-block] missing template section

[snip]

> Sounds like it's not picking up your filters configuration files, run
> asciidoc with the --verbose option, the output should show something like:
>
> reading: ... /filters/source/source-highlight-filter.conf
> reading: ... /filters/music/music-filter.conf
> reading: ... /filters/code/code-filter.conf
> reading: ... /filters/graphviz/graphviz-filter.conf

It's picking them up. However, it seems like neither
ifdef::basebackend-htm nor ifdef::basebackend-docbook evaluate to
true. If I simply comment out the ifdef/endif to hard-code the HTML
version of the template, the problem disappears.

Long story short, after some time I realized that the outcome is a
function of the order in which os.walk() returns files when asciidoc
is traversing the filter configuration subdirectory.

The context is that I am trying to update the FreeBSD port to
8.4.2. With the port-installed asciidoc, I got the error. In the end I
took the tarball and configure/make installed:ed manually, and it
worked! After diffing the entire etc/asciidoc directory along with the
asciidoc binary and spotting only expected changes (i.e., CONF_DIR), I
realize that a difference was the order in which the filter
configurations were loaded. From a failed run:

% asciidoc --verbose -a toc -a numbered test.txt
reading: /usr/local/etc/asciidoc/asciidoc.conf
reading: /usr/local/etc/asciidoc/xhtml11.conf
reading: /usr/local/etc/asciidoc/filters/music/music-filter.conf
reading: /usr/local/etc/asciidoc/filters/code/code-filter.conf
reading: /usr/local/etc/asciidoc/filters/graphviz/graphviz-filter.conf
reading: /usr/local/etc/asciidoc/filters/source/source-highlight-filter.conf


WARNING: [music-block] missing template section
WARNING: [music-block] missing template section

reading: /usr/tmp/test.txt
writing: /usr/tmp/test.html

From a successful run:

% /tmp/a/bin/asciidoc --verbose -a toc -a numbered test.txt
reading: /tmp/a//etc/asciidoc/asciidoc.conf
reading: /tmp/a//etc/asciidoc/xhtml11.conf
reading: /tmp/a//etc/asciidoc/filters/source/source-highlight-filter.conf
reading: /tmp/a//etc/asciidoc/filters/graphviz/graphviz-filter.conf
reading: /tmp/a//etc/asciidoc/filters/code/code-filter.conf
reading: /tmp/a//etc/asciidoc/filters/music/music-filter.conf
reading: /usr/tmp/test.txt
writing: /usr/tmp/test.html

After simply re-installing asciidoc (the package version):

% asciidoc --verbose -a toc -a numbered test.txt
reading: /usr/local/etc/asciidoc/asciidoc.conf
reading: /usr/local/etc/asciidoc/xhtml11.conf
reading: /usr/local/etc/asciidoc/filters/code/code-filter.conf
reading: /usr/local/etc/asciidoc/filters/graphviz/graphviz-filter.conf
reading: /usr/local/etc/asciidoc/filters/music/music-filter.conf
reading: /usr/local/etc/asciidoc/filters/source/source-highlight-filter.conf
reading: /usr/tmp/test.txt
writing: /usr/tmp/test.html

After re-installing again:

% asciidoc --verbose -a toc -a numbered test.txt
reading: /usr/local/etc/asciidoc/asciidoc.conf
reading: /usr/local/etc/asciidoc/xhtml11.conf
reading: /usr/local/etc/asciidoc/filters/graphviz/graphviz-filter.conf
reading: /usr/local/etc/asciidoc/filters/code/code-filter.conf
reading: /usr/local/etc/asciidoc/filters/music/music-filter.conf
reading: /usr/local/etc/asciidoc/filters/source/source-highlight-filter.conf
WARNING: [graphviz-block] missing template section
WARNING: [graphviz-block] missing template section
reading: /usr/tmp/test.txt
writing: /usr/tmp/test.html

Here we again see the graphviz-block version of the error, which I
thought I had previously seen. In retrospect, it's very possible it
switched from that to music-block after a package re-install.

After applying this patch:

--- orig/asciidoc-8.4.2/asciidoc.py 2009-03-18 05:22:00.000000000 +0100
+++ asciidoc.py 2009-03-23 22:15:03.665573228 +0100
@@ -3901,7 +3901,11 @@
self.load_file(conf,dir)
# Load filter .conf files.
filtersdir = os.path.join(dir,'filters')
- for dirpath,dirnames,filenames in os.walk(filtersdir):
+# for dirpath,dirnames,filenames in os.walk(filtersdir):
+ for dirpath,dirnames,filenames in [ ('/tmp/a/etc/asciidoc/filters/graphviz', None, ('graphviz-filter.conf',)),
+ ('/tmp/a/etc/asciidoc/filters/code', None, ('code-filter.conf',)),
+ ('/tmp/a/etc/asciidoc/filters/music', None, ('music-filter.conf',)),
+ ('/tmp/a/etc/asciidoc/filters/source', None, ('source-highlight-filter.conf',)) ]:
for f in filenames:
if re.match(r'^.+\.conf$',f):
self.load_file(f,dirpath)

I am able to make the manually-installed-from-tarball fail:

% /tmp/a/bin/asciidoc --verbose -a toc -a numbered test.txt
reading: /tmp/a//etc/asciidoc/asciidoc.conf
reading: /tmp/a//etc/asciidoc/xhtml11.conf
reading: /tmp/a/etc/asciidoc/filters/graphviz/graphviz-filter.conf
reading: /tmp/a/etc/asciidoc/filters/code/code-filter.conf
reading: /tmp/a/etc/asciidoc/filters/music/music-filter.conf
reading: /tmp/a/etc/asciidoc/filters/source/source-highlight-filter.conf
WARNING: [graphviz-block] missing template section
WARNING: [graphviz-block] missing template section
reading: /usr/tmp/test.txt
writing: /usr/tmp/test.html

At this point I suspect someone with better knowledge of the code can
spot what's actually the problem much more easily than me, so I'm
holding my investigation for a little bit to await feedback.

Miklos Vajna

unread,
Apr 2, 2009, 11:14:44 AM4/2/09
to asci...@googlegroups.com
On Sat, Mar 21, 2009 at 04:49:22PM +0100, Peter Schuller <peter.s...@infidyne.com> wrote:
> Upgrading from 8.3.5 to 8.4.2, invocing asciidoc on even a trivial
> text file gives me:
>
> WARNING: [music-block] missing template section
> WARNING: [music-block] missing template section
>
> Googling/searching the ML didn't yield much. Am I missing something or
> is the music filter in need of updates to new syntax? I could have
> sworn I saw this for graphviz too at some point, but I could be wrong.

I'm having the same problem. Here is a reproducer:

-- snip --
= foo

== bar

blah blah

[options="header",grid="all"]
|====
| Action | Apt command | Pacman-G2 command
| Refresh the package database: | apt-get update | pacman-g2 -Sy
|====
-- snap --

$ asciidoc test2.txt


WARNING: [graphviz-block] missing template section
WARNING: [graphviz-block] missing template section

$ asciidoc --version
asciidoc 8.4.2

Let me know in case I should provide more info.

Thanks!

Stuart Rackham

unread,
Apr 2, 2009, 7:41:02 PM4/2/09
to asci...@googlegroups.com
Hi Peter

Apologies for not answering sooner, it required a bit of thinking on my
part so I put it on my TODO list and forgot about it till another report
turned up and jogged my memory.

Thank you for the excellent detective work -- this bug is very subtle.

The ordering of the filters should not ordinarily cause a problem --
basebackend-html is defined in the backend configuration file
(xhtml11.conf) which always precedes the filters. The problem occurs if
either the music filter or graphviz filter follow *immediately* after
the loading of xhtml11.conf and can be traced to the ordering of two
statements in the load_file method. After loading the conf file
load_file updated the document attributes and then loaded the
config.sections dictionary -- should be the other way round, the
update_attributes method depends on the sections dictionary. The reason
it doesn't occur every time is that the next load_file call updates the
attributes loaded by the previous call, so the problem only occurs if a
conf file depends on attributes loaded by the immediately preceding conf
file.

A patch has been committed to the trunk:
http://hg.sharesource.org/asciidoc/rev/1dfa7028bbb3

Please check it fixes the problem.

Another consequence of this bug (which I picked up running the
testasciidoc test command) is that the IE6 quirks mode CSS stylesheet
was not included by default (quirks attribute was defined in
asciidoc.conf which immediately preceeded xhtml11.conf).


Cheers, Stuart

Stuart Rackham

unread,
Apr 2, 2009, 7:41:12 PM4/2/09
to asci...@googlegroups.com
Hi Miklos

Thanks for the example, I think I've nailed the problem:

http://hg.sharesource.org/asciidoc/rev/1dfa7028bbb3

Explanation here:

http://groups.google.com/group/asciidoc/browse_thread/thread/fd27add515597c06


Cheers, Stuart

Peter Schuller

unread,
Apr 6, 2009, 1:47:02 PM4/6/09
to asci...@googlegroups.com
Hello,

> A patch has been committed to the trunk:
> http://hg.sharesource.org/asciidoc/rev/1dfa7028bbb3
>
> Please check it fixes the problem.

Thanks a lot for looking into it. It does indeed fix the problem for
me too; with that patch applied 8.4.2 deterministically works.

Thanks!

Miklos Vajna

unread,
Apr 9, 2009, 6:32:28 AM4/9/09
to asci...@googlegroups.com
On Fri, Apr 03, 2009 at 12:41:12PM +1300, Stuart Rackham <srac...@gmail.com> wrote:
> Thanks for the example, I think I've nailed the problem:
>
> http://hg.sharesource.org/asciidoc/rev/1dfa7028bbb3
>
> Explanation here:
>
> http://groups.google.com/group/asciidoc/browse_thread/thread/fd27add515597c06

Sorry for the late reply, I just got time to test it and the problem
disappears here as well.

Thanks!

Reply all
Reply to author
Forward
0 new messages