Error when using include1:: in a config file

View: New views
2 Messages — Rating Filter:   Alert me  

Error when using include1:: in a config file

by Maciej Bliziński-5 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi asciidoc-discuss!

I'm playing around with asciidoc, and I've bumped on a problem. Here's
my minimal setup that shows it. I'm using version 8.2.1 from a package
from Ubuntu.com.

The problem occurs when trying to include a file from inside a config
file. My minimal setup looks like this:

** Makefile **
all: test.html
%.html: %.txt
       asciidoc -a toc -a numbered --conf=example.conf -b xhtml11 -d
book test.txt

** example.conf **
[header]
<html>
<body>
include1::foo.txt[]

[footer]
</body>
</html>

** foo.txt **
foo

** test.txt **
Test
====

Bar.

When executing 'make', I'm getting this error:

FAILED: unexpected error:
------------------------------------------------------------
Traceback (most recent call last):
 File "/usr/bin/asciidoc", line 3963, in asciidoc
   config.load(conf)
 File "/usr/bin/asciidoc", line 3488, in load
   while not rdr.eof():
 File "/usr/bin/asciidoc", line 3262, in eof
   return self.read_next() is None
 File "/usr/bin/asciidoc", line 3265, in read_next
   result = self.read()
 File "/usr/bin/asciidoc", line 3208, in read
   result = self.read_super()
 File "/usr/bin/asciidoc", line 3203, in read_super
   result = Reader1.read(self,self.skip)
 File "/usr/bin/asciidoc", line 3136, in read
   fname = safe_filename(fname, os.path.dirname(self.fname))
 File "/usr/bin/asciidoc", line 140, in safe_filename
   if not is_safe_file(fname, parentdir):
 File "/usr/bin/asciidoc", line 128, in is_safe_file
   return not safe() or file_in(fname,dir)
 File "/usr/bin/asciidoc", line 115, in file_in
   assert os.path.isdir(dir), "'%s' is not a directory" % dir
AssertionError: '' is not a directory
------------------------------------------------------------

Is it a bug or am I doing something wrong?

Cheers,
Maciej
_______________________________________________
asciidoc-discuss mailing list
asciidoc-discuss@...
http://lists.metaperl.com/cgi-bin/mailman/listinfo/asciidoc-discuss

Re: Error when using include1:: in a config file

by Stuart Rackham :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi Maciej

I've run your example without any problems on the latest release
(8.2.5).

I'm pretty sure your problem is related to a bug fixed in 8.2.2 (see
http://www.methods.co.nz/asciidoc/CHANGELOG.html):

``Fixed an assertion error that occurred when a configuration file
containing an include::[] macro was loaded using the --conf-file option
and the configuration file name did not include an explicit directory
path — patch submitted by Dmitry Potapov.''


Cheers, Stuart
--
Stuart Rackham


Maciej Bliziński wrote:

> Hi asciidoc-discuss!
>
> I'm playing around with asciidoc, and I've bumped on a problem. Here's
> my minimal setup that shows it. I'm using version 8.2.1 from a package
> from Ubuntu.com.
>
> The problem occurs when trying to include a file from inside a config
> file. My minimal setup looks like this:
>
> ** Makefile **
> all: test.html
> %.html: %.txt
>        asciidoc -a toc -a numbered --conf=example.conf -b xhtml11 -d
> book test.txt
>
> ** example.conf **
> [header]
> <html>
> <body>
> include1::foo.txt[]
>
> [footer]
> </body>
> </html>
>
> ** foo.txt **
> foo
>
> ** test.txt **
> Test
> ====
>
> Bar.
>
> When executing 'make', I'm getting this error:
>
> FAILED: unexpected error:
> ------------------------------------------------------------
> Traceback (most recent call last):
>  File "/usr/bin/asciidoc", line 3963, in asciidoc
>    config.load(conf)
>  File "/usr/bin/asciidoc", line 3488, in load
>    while not rdr.eof():
>  File "/usr/bin/asciidoc", line 3262, in eof
>    return self.read_next() is None
>  File "/usr/bin/asciidoc", line 3265, in read_next
>    result = self.read()
>  File "/usr/bin/asciidoc", line 3208, in read
>    result = self.read_super()
>  File "/usr/bin/asciidoc", line 3203, in read_super
>    result = Reader1.read(self,self.skip)
>  File "/usr/bin/asciidoc", line 3136, in read
>    fname = safe_filename(fname, os.path.dirname(self.fname))
>  File "/usr/bin/asciidoc", line 140, in safe_filename
>    if not is_safe_file(fname, parentdir):
>  File "/usr/bin/asciidoc", line 128, in is_safe_file
>    return not safe() or file_in(fname,dir)
>  File "/usr/bin/asciidoc", line 115, in file_in
>    assert os.path.isdir(dir), "'%s' is not a directory" % dir
> AssertionError: '' is not a directory
> ------------------------------------------------------------
>
> Is it a bug or am I doing something wrong?
>
> Cheers,
> Maciej
> _______________________________________________
> asciidoc-discuss mailing list
> asciidoc-discuss@...
> http://lists.metaperl.com/cgi-bin/mailman/listinfo/asciidoc-discuss
>
_______________________________________________
asciidoc-discuss mailing list
asciidoc-discuss@...
http://lists.metaperl.com/cgi-bin/mailman/listinfo/asciidoc-discuss