On Wed, Aug 30, 2023 at 10:48:19AM +0200, Jonas Hahnfeld wrote: > Not quite, I'm fine with warnings not resulting in errors (even though > a -Werror like flag would be a nice addition!) > > > However, I don't fully understand what the problem is with carrying on. > > Could you not test the code with "-c TEXINFO_OUTPUT_FORMAT=parse " just > > to see if any messages are printed with the customization code, without > > doing the conversion to HTML? > > Much of the more elaborate customization code will only run during > conversion to HTML, so this *MUST* be part of the testing process. The > problem I've been running into a lot (not being a versed Perl dev) are > syntax errors in the customization file. To give the most simple > example to reproduce, create a file error.init with the content "syntax > error;" (ok, I'm also not that bad in writing Perl, but a forgotten > semicolon here and there was certainly part of the story...) > > $ texi2any --html --init-file error.init --error-limit 0 short_sample.texi > texi2any: warning: error loading ./error.init: Can't locate object method > "syntax" via package "error" (perhaps you forgot to load "error"?) at > ./error.init line 1. > $ echo $? > 0 >
Okay, in this case there doesn't seem to be any point in continuing the program (and the exit status should be non-zero). We'll have to see if these errors can be distinguished from mere warnings. I can imagine the current behaviour could cause problems if texi2any is run by the "make" program as part of a build system and the build continues after texi2any appears to complete successfully. > Using the builtin error mechanism of returning a non-true value only > results in a warning; put "return 0;" into a file return0.init: > $ texi2any --html --init-file return0.init --error-limit 0 short_sample.texi > texi2any: warning: error loading ./return0.init: ./return0.init did not > return a true value at /usr/share/texinfo/Texinfo/Config.pm line 130. > $ echo $? > 0 This Perl mechanism is not appropriate, I seem to recall, for signalling errors in loading the module. Instead, you can use the texinfo_register_init_loading_error and texinfo_register_init_loading_warning functions to deliberately raise an error or warning. https://lists.gnu.org/archive/html/bug-texinfo/2022-08/msg00059.html.