redhataccess / ascii_binder

AsciiBinder is an AsciiDoc-based system for authoring and publishing closely related documentation sets from a single source.
https://asciibinder.net
MIT License
76 stars 39 forks source link

Valid topics maps fail to build intermittently depending on size and/or location of maps #165

Open gabriel-ocp opened 2 years ago

gabriel-ocp commented 2 years ago

Using the map in https://github.com/gabriel-ocp/ocp-bare-bones/blob/main/_topic_map.yml:

The exact steps for reproducing the problem are available at:

https://source.redhat.com/groups/public/gabrielocp/videos/ab_part01_reproducing_build_issuesmp4~1

gabriel-ocp commented 2 years ago

The problem seems to how the temporary file, which is used for combining multiple maps, is written and read.

https://stackoverflow.com/questions/18052966/ruby-how-to-write-to-tempfile recommends .close or .rewind

https://ruby-doc.org/stdlib-2.5.3/libdoc/tempfile/rdoc/Tempfile.html recommends .rewind

So the solution seems to be to add a tf.rewind after writing to the tmp file, before trying to read from it.

vikram-redhat commented 2 years ago

@gabriel-ocp I assume you have been able to test this?

rohennes commented 2 years ago

I have replicated the issue with my local asciibinder build. Using @gabriel-ocp's container image with his updated version of asciibinder, I verified the fixes worked as expected.