bugGNU Octave - Bugs: bug #62648, build problem with texinfo>6.8

 
 

bug #62648: build problem with texinfo>6.8

Submitter:  gabriele balducci <balducci>
Submitted:  Fri 17 Jun 2022 01:37:50 PM UTC
   
 
Category:  Configuration and Build System Severity:  5 - Blocker
Priority:  7 - High Item Group:  Build Failure
Status:  Fixed Assigned to:  None
Originator Name:  Open/Closed:  * Closed
Release:  * dev Operating System:  * Any
Fixed Release:  None Planned Release:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Jump to the original submission

Fri 18 Nov 2022 08:41:06 AM UTC, comment #43: 
Arun Giridhar <arungiridhar>
Group Member
Wed 16 Nov 2022 03:10:06 PM UTC, comment #42: 

Pushed here: https://hg.savannah.gnu.org/hgweb/octave/rev/dccc52324b0b

Marking as Ready for Test.

Arun Giridhar <arungiridhar>
Group Member
Wed 16 Nov 2022 02:17:00 PM UTC, comment #41: 

Found the same test failure in _unimplemented_ here: https://github.com/gnu-octave/octave/actions/runs/3475926948/jobs/5811838136#step:11:406  so it's not OS-specific, which is good.

Updated diff:

diff -r 0924234dd747 scripts/help/__unimplemented__.m
--- a/scripts/help/__unimplemented__.m  Tue Nov 15 18:37:58 2022 -0800
+++ b/scripts/help/__unimplemented__.m  Wed Nov 16 09:16:15 2022 -0500
@@ -1340,8 +1340,8 @@ endfunction

 %!test
 %! str = __unimplemented__ ("matlabrc");
-%! assert (str(1:71), "matlabrc is not implemented.  Octave uses the file '.octaverc' instead.");
+%! assert (regexp (str, "matlabrc is not implemented\.  Octave uses the file .\.octaverc. instead\."));

 %!test
 %! str = __unimplemented__ ("MException");
-%! assert (str(1:58), "The 'MException' function is not yet implemented in Octave");
+%! assert (regexp (str, "The .MException. function is not yet implemented in Octave"));


Arun Giridhar <arungiridhar>
Group Member
Wed 16 Nov 2022 02:07:44 PM UTC, comment #40: 

A `.` in the pattern also matches a literal '.'. But it might be a good idea to escape the dot after "implemented" to check for a literal match.

Markus Mützel <mmuetzel>
Group administrator
Wed 16 Nov 2022 02:05:03 PM UTC, comment #39: 

What did I do?! I was so absorbed in getting that regexp to satisfy all combinations of punctuation that I forgot to wrap it in assert! Facepalm.

New diff:

diff -r 0924234dd747 scripts/help/__unimplemented__.m
--- a/scripts/help/__unimplemented__.m  Tue Nov 15 18:37:58 2022 -0800
+++ b/scripts/help/__unimplemented__.m  Wed Nov 16 09:03:11 2022 -0500
@@ -1340,8 +1340,8 @@ endfunction

 %!test
 %! str = __unimplemented__ ("matlabrc");
-%! assert (str(1:71), "matlabrc is not implemented.  Octave uses the file '.octaverc' instead.");
+%! assert (regexp (str, "matlabrc is not implemented.  Octave uses the file .\.octaverc. instead\."));

 %!test
 %! str = __unimplemented__ ("MException");
-%! assert (str(1:58), "The 'MException' function is not yet implemented in Octave");
+%! assert (regexp (str, "The .MException. function is not yet implemented in Octave"));


Arun Giridhar <arungiridhar>
Group Member
Wed 16 Nov 2022 01:57:01 PM UTC, comment #38: 

The tests you are proposing are likely to never fail. You need some kind of `assert` or `error` somewhere in the test.
See, e.g., Rik's change here:
https://hg.savannah.gnu.org/hgweb/octave/rev/21b5e1c4d36e


The macOS runners fail fairly frequently on downloading TeX. You'll need to find a run where it succeeded.

Markus Mützel <mmuetzel>
Group administrator
Wed 16 Nov 2022 01:46:50 PM UTC, comment #37: 

The following fix works for me. Please review and test.

diff -r 0924234dd747 scripts/help/__unimplemented__.m
--- a/scripts/help/__unimplemented__.m  Tue Nov 15 18:37:58 2022 -0800
+++ b/scripts/help/__unimplemented__.m  Wed Nov 16 08:41:38 2022 -0500
@@ -1340,8 +1340,8 @@ endfunction

 %!test
 %! str = __unimplemented__ ("matlabrc");
-%! assert (str(1:71), "matlabrc is not implemented.  Octave uses the file '.octaverc' instead.");
+%! regexp (str(1:71), "matlabrc is not implemented.  Octave uses the file .\.octaverc. instead\.");

 %!test
 %! str = __unimplemented__ ("MException");
-%! assert (str(1:58), "The 'MException' function is not yet implemented in Octave");
+%! regexp (str(1:58), "The .MException. function is not yet implemented in Octave");


I made it against stable because that way it can go to Octave 8.1 instead of only Octave 9.

I couldn't understand the Github Actions log -- it looks like all the recent MacOS builds are failing in the installation of dependencies and are not proceeding to building Octave itself. Is that right?

Arun Giridhar <arungiridhar>
Group Member
Wed 16 Nov 2022 01:09:13 PM UTC, comment #36: 

You can check yourself in the logs of the GitHub runners:
https://github.com/gnu-octave/octave/actions

There are many test suite errors because of bug #61704 on macOS. I might have missed a couple new ones.

Re-opening report.

Markus Mützel <mmuetzel>
Group administrator
Wed 16 Nov 2022 12:23:19 PM UTC, comment #35: 

My system upgraded Texinfo to 7.0. I'm getting the following two apostrophe errors during make check:


>>>>> processing .../octave/scripts/help/__unimplemented__.m
***** test
 str = __unimplemented__ ("matlabrc");
 assert (str(1:71), "matlabrc is not implemented.  Octave uses the file '.octaverc' instead.");
!!!!! test failed
ASSERT errors for:  assert (str (1:71),"matlabrc is not implemented.  Octave uses the file '.octaverc' instead.")

  Location  |  Observed  |  Expected  |  Reason
     []      matlabrc is not implemented.  Octave uses the file ’.octaverc’ inst matlabrc is not implemented.  Octave uses the file '.octaverc' instead.   Strings don't match
***** test
 str = __unimplemented__ ("MException");
 assert (str(1:58), "The 'MException' function is not yet implemented in Octave");
!!!!! test failed
ASSERT errors for:  assert (str (1:58),"The 'MException' function is not yet implemented in Octave")

  Location  |  Observed  |  Expected  |  Reason
     []      The ’MException’ function is not yet implemented in Oc The 'MException' function is not yet implemented in Octave   Strings don't match


Is this error not showing on the macOS CI?

Arun Giridhar <arungiridhar>
Group Member
Wed 16 Nov 2022 11:10:31 AM UTC, comment #34: 

Sounds reasonable.

The test is passing on macOS with texinfo 7.0 from Homebrew now.

Closing as fixed.

Markus Mützel <mmuetzel>
Group administrator
Tue 15 Nov 2022 05:16:01 PM UTC, comment #33: 

I think we should keep the original test (with get_first_help_sentence) because part of the idea is to test for an unusual input for which the function might fail.  Very generic text, such as for the function 'light' is very likely to pass.

I checked in a change here (http://hg.savannah.gnu.org/hgweb/octave/rev/21b5e1c4d36e) which uses regexp() for comparison and where I avoid looking at the apostrophe character.

Rik <rik5>
Group administrator
Tue 15 Nov 2022 04:37:15 PM UTC, comment #32: 

Or in case, we are worrying about different dashes, maybe this instead:

>> get_first_help_sentence('light')
ans = Create a light object in the current axes or for axes HAX.


Markus Mützel <mmuetzel>
Group administrator
Tue 15 Nov 2022 04:35:48 PM UTC, comment #31: 

Comparing up to the apostrophe would fix the test result for whichever character is used. However, it might be worthwhile to check if the entire first sentence is returned by this function (not less - but also not more).
We could also just use a different function in that test. E.g.:

>> get_first_help_sentence('quiver')
ans = Plot a 2-D vector field with arrows.


Markus Mützel <mmuetzel>
Group administrator
Tue 15 Nov 2022 04:30:18 PM UTC, comment #30: 

The directives you cite are for blocks of text that have been marked with @code, @samp, etc.  Generic text, which is what most of the documentation is written in, doesn't use that setting.

Rik <rik5>
Group administrator
Tue 15 Nov 2022 04:05:22 PM UTC, comment #29: 

It seems that behavior can be controlled in the Texinfo markup itself with

@codequoteundirected off
@codequotebacktick off

and their "on" counterparts.

https://www.gnu.org/software/texinfo/manual/texinfo/texinfo.html#Inserting-Quote-Characters

This looks the same in both Texinfo 6.8 and 7.0.


Arun Giridhar <arungiridhar>
Group Member
Tue 15 Nov 2022 03:52:34 PM UTC, comment #28: 

For comment #26, there is a Texinfo setting somewhere that decides whether apostrophes are rendered as straight vertical glyphs or as slanted glyphs.  In the old days of ASCII and limited character sets one always got the straight vertical glyph.  I know that writers, editors, and typesetters like the angled glyph.  It doesn't surprise me that Apple, which always has a design sense, has somehow chosen this option.

I don't know where this setting lives, but it is likely to be a user or system configuration file so we probably shouldn't ship a version of the configuration file with Octave to override it.

That suggests that we just compare the text up to the apostrophe.

Rik <rik5>
Group administrator
Tue 15 Nov 2022 02:46:27 PM UTC, comment #27: 

comment #24:

> > This works great with 7.0, thank you! I've applied it in Gentoo.
>
> Thanks for testing. I assume that means that you opened the GUI and checked that the documentation browser is working correctly.
>


It works and it looks great. Thanks folks!

Sam James <thesamesam>
Tue 15 Nov 2022 01:00:35 PM UTC, comment #26: 

One test is failing on macOS that might be related to the newer texinfo:

>>>>> processing /Users/runner/work/octave/octave/scripts/help/get_first_help_sentence.m
***** assert (get_first_help_sentence ('get_first_help_sentence'), ...
        "Return the first sentence of a function's help text.")
!!!!! test failed
ASSERT errors for:  assert (get_first_help_sentence ('get_first_help_sentence'),"Return the first sentence of a function's help text.")

  Location  |  Observed  |  Expected  |  Reason
     []      Return the first sentence of a function’s help text. Return the first sentence of a function's help text.   Strings don't match


Note the difference between `’` and `'` in the strings.

I haven't looked into why there is this difference. And I'm not sure if the new result is actually wrong.
It might be best to just change the test to not contain an apostrophe. What do you think?

Markus Mützel <mmuetzel>
Group administrator
Tue 15 Nov 2022 12:18:05 PM UTC, comment #25: 

Reverted the change to the macOS runner here:
https://hg.savannah.gnu.org/hgweb/octave/rev/b6dcb53aaa65

Markus Mützel <mmuetzel>
Group administrator
Tue 15 Nov 2022 12:13:44 PM UTC, comment #24: 


> This works great with 7.0, thank you! I've applied it in Gentoo.


Thanks for testing. I assume that means that you opened the GUI and checked that the documentation browser is working correctly.

@Rik: Thanks for the improved patch. Like I wrote before, my Perl knowledge is very limited. And your help is much appreciated.
I pushed your patch here:
https://hg.savannah.gnu.org/hgweb/octave/rev/ab6d276f6fcb

I'll follow up with enabling building the documentation on the macOS GitHub-runners again.

Marking as ready for test.

Markus Mützel <mmuetzel>
Group administrator
Tue 15 Nov 2022 04:59:47 AM UTC, comment #23: 

comment #22:

> I have attached a patch which is slightly more attuned to the Perl way of doing things.  Specifically, it is almost never necessary to directly check for EOF.  Per the documentation for eof() in Perl (try 'perldoc -f eof')


This works great with 7.0, thank you! I've applied it in Gentoo.


comment #17:

> @Sam James: for short term use, could you try out the WIP fix in comment #12? You can also try the non-backwards-compatible fix in comment #0 if you won't be using older Texinfo.
>
> Fixing this is listed as a high priority blocker as you see above.


Thanks! I've tried out the latest one from comment 22. Sorry, I'd missed the attachments (not as familiar with savannah as I ought to be).

Sam James <thesamesam>
Mon 14 Nov 2022 06:38:58 PM UTC, comment #22: 

I have attached a patch which is slightly more attuned to the Perl way of doing things.  Specifically, it is almost never necessary to directly check for EOF.  Per the documentation for eof() in Perl (try 'perldoc -f eof')
 

Practical hint: you almost never need to use "eof" in Perl,
because the input operators typically return "undef" when they
run out of data or encounter an error.


This expression



while (not (eof ($HTML)) and ( ($_ = <$HTML>) !~ /^<ul class="(no-bullet|toc-numbered-mark)">/ ) ) {;}


can be simplified to


while (defined ($_ = <$HTML>) and ! /^<ul class="(?:no-bullet|toc-numbered-mark)">/) {;}


where I skip eof() but use the short-circuit operator "and".  I also used the non-capturing regular expression '(?:A|B)' rather than '(A|B)'.  Perl is so fast it hardly makes a difference, but we aren't using the captured data from the regular expression so we might as well tell Perl it can discard it.



(file #53955)

Rik <rik5>
Group administrator
Mon 14 Nov 2022 02:46:45 PM UTC, comment #21: 

I tried the changes from comment #19 on the GitHub runners with our CI:
It seems to allow building with documentation enabled with the texinfo 7.0 from Homebrew on macOS. I don't know if the Qt documentation in the GUI is actually working though.

It would be nice if someone with texinfo 7.0 could check this.

Markus Mützel <mmuetzel>
Group administrator
Mon 14 Nov 2022 12:35:50 PM UTC, comment #20: 

@mmuetzel: nice fix! I see how you're covering both the old strings and the new strings. Works for me on Texinfo 6.8. Will await results from Texinfo 7.0 users.

Arun Giridhar <arungiridhar>
Group Member
Mon 14 Nov 2022 11:27:31 AM UTC, comment #19: 

I don't have access to texinfo 7.0 currently:

$ info --version
info (GNU texinfo) 6.8

Copyright (C) 2021 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.


The following changes still work with that version:

diff -r 9f4a9dd4a6ee doc/interpreter/mk-qthelp.pl
--- a/doc/interpreter/mk-qthelp.pl        Sun Nov 13 13:00:16 2022 -0500
+++ b/doc/interpreter/mk-qthelp.pl        Mon Nov 14 12:24:39 2022 +0100
@@ -26,8 +26,10 @@
 open (my $HTML, "<", $htmlfname) or die "Unable to open $htmlfname";

 # Skip through preamble of file to find start of list
-while (($_ = <$HTML>) !~ /^<div class="contents">/ ) {;}
-while (($_ = <$HTML>) !~ /^<ul class="no-bullet">/ ) {;}
+while (not (eof ($HTML)) and ( ($_ = <$HTML>) !~ /^<div class="contents">/ ) ) {;}
+while (not (eof ($HTML)) and ( ($_ = <$HTML>) !~ /^<ul class="(no-bullet|toc-numbered-mark)">/ ) ) {;}
+
+die "index.html: reached EOF: bait changed?" if eof($HTML);

 $level = 0;
 while (<$HTML>)
@@ -68,7 +70,9 @@
 open ($HTML, "<", $htmlfname) or die "Unable to open $htmlfname";

 # Skip through preamble of file to find start of list
-while (($_ = <$HTML>) !~ /^<table class="index-fn/ ) {;}
+while (not (eof ($HTML)) and ( ($_ = <$HTML>) !~ /^<table class="(index-fn|fn-entries)/ ) ) {;}
+
+die "Function-Index.html: reached EOF: bait changed?" if eof($HTML);

 while (<$HTML>)
 {


Do those changes fix the issue with texinfo 7.0?

Markus Mützel <mmuetzel>
Group administrator
Mon 14 Nov 2022 11:08:48 AM UTC, comment #18: 

Adding rik5 to cc for Perl.

Arun Giridhar <arungiridhar>
Group Member
Mon 14 Nov 2022 11:02:32 AM UTC, comment #17: 

@Sam James: for short term use, could you try out the WIP fix in comment #12? You can also try the non-backwards-compatible fix in comment #0 if you won't be using older Texinfo.

Fixing this is listed as a high priority blocker as you see above.

Arun Giridhar <arungiridhar>
Group Member
Mon 14 Nov 2022 04:18:40 AM UTC, comment #16: 

comment #6:

> I see from Distrowatch that Arch and Gentoo have upgraded to 7.0 too. No bug reports yet at those distros though.
>


We've had one in Gentoo now: https://bugs.gentoo.org/880623.

Sam James <thesamesam>
Fri 11 Nov 2022 06:14:05 PM UTC, comment #15: 

I agree we shouldn't be duplicating the file. It was only one way to get it working, not the best way. The limiting factor was my own knowledge of Perl did not extend to solving "strict subs" errors, so I fell back on bash/awk. If someone knows how to solve that within Perl, the patterns (pattern1/2/3) have been written for each version and can be substituted in.

Arun Giridhar <arungiridhar>
Group Member
Fri 11 Nov 2022 05:09:48 PM UTC, comment #14: 

I'm not sure if duplicating the entire file is a good solution for this issue.
If that is possible it might also be better to check for features instead of for versions.

Markus Mützel <mmuetzel>
Group administrator
Fri 11 Nov 2022 02:26:39 PM UTC, comment #13: 

hg diff attached for the file changes described in comment #12.

This does not include the shell commands to pull the Texinfo version. Those will have to be added to the configure script or Makefile.

In effect, mk-qthelp.pl would become a generated file.

Please adapt as needed.

(file #53947)

Arun Giridhar <arungiridhar>
Group Member
Fri 11 Nov 2022 02:20:58 PM UTC, comment #12: 

I was already at the limit of my Perl, so I solved it as follows:

  • I made two version of the Perl script, one for Texinfo 6 and one for Texinfo 7. They are named qthelp_Texinfo6.pl and qthelp_Texinfo7.pl, both attached. These include the safer loops from gabriele.


  • I deleted mk-qthelp.pl.


  • I ran the following shell commands to make a symlink named mk-qthelp.pl to the correct script:


TEXINFO_VERSION=`info --version | head -n 1 | awk '{print int($NF)}'`

ln -s qthelp_Texinfo$TEXINFO_VERSION.pl mk-qthelp.pl


Then everything builds properly.

Please verify and adapt as needed.

(file #53945, file #53946)

Arun Giridhar <arungiridhar>
Group Member
Fri 11 Nov 2022 02:01:10 PM UTC, comment #11: 

I worked around the strict subs error by adding a $ sign everywhere needed.

New diff:

diff -r 870036573716 doc/interpreter/mk-qthelp.pl
--- a/doc/interpreter/mk-qthelp.pl      Mon Nov 07 16:50:39 2022 -0500
+++ b/doc/interpreter/mk-qthelp.pl      Fri Nov 11 09:00:20 2022 -0500
@@ -25,9 +25,20 @@ if ($#ARGV != 1)
 $htmlfname = File::Spec->catfile ($basedir, $htmldir, "index.html");
 open (my $HTML, "<", $htmlfname) or die "Unable to open $htmlfname";

+
+$TEXINFO_VERSION=6;  ## TODO FIXME Pull this information from Texinfo itself
+
+$pattern1 = /^<div class="contents">/;
+
+if ($TEXINFO_VERSION < 7) {$pattern2 = /^<ul class="no-bullet">/; }
+else                      {$pattern2 = /^<ul class="toc-numbered-mark">/; }
+
+if ($TEXINFO_VERSION < 7) {$pattern3 = /^<table class="index-fn/; }
+else                      {$pattern3 = /^<table class="fn-entries/; }
+
 # Skip through preamble of file to find start of list
-while (($_ = <$HTML>) !~ /^<div class="contents">/ ) {;}
-while (($_ = <$HTML>) !~ /^<ul class="no-bullet">/ ) {;}
+while (<$HTML>) {next if $_ !~ $pattern1; last;}
+while (<$HTML>) {next if $_ !~ $pattern2; last;}

 $level = 0;
 while (<$HTML>)
@@ -68,7 +79,7 @@ die "Failed to parse index.html" if ($le
 open ($HTML, "<", $htmlfname) or die "Unable to open $htmlfname";

 # Skip through preamble of file to find start of list
-while (($_ = <$HTML>) !~ /^<table class="index-fn/ ) {;}
+while(<$HTML>) {next if $_ !~ $pattern3; last;}

 while (<$HTML>)
 {


Fewer errors now:

  GEN      doc/interpreter/octave_interpreter.qhc
Use of uninitialized value $_ in pattern match (m//) at ../doc/interpreter/mk-qthelp.pl line 31.
Use of uninitialized value $_ in pattern match (m//) at ../doc/interpreter/mk-qthelp.pl line 33.
Use of uninitialized value $_ in pattern match (m//) at ../doc/interpreter/mk-qthelp.pl line 36.
error:unrecognized input: .....doc/interpreter/octave.html/index.html:3:<!-- Created by GNU Texinfo 6.8, https://www.gnu.org/software/texinfo/ -->
make[2]: *** [Makefile:31307: doc/interpreter/octave_interpreter.qhc] Error 25


Arun Giridhar <arungiridhar>
Group Member
Fri 11 Nov 2022 01:51:21 PM UTC, comment #10: 

This is my attempt at using gabriele's patch and adapting it to be backwards compatible:


diff -r 870036573716 doc/interpreter/mk-qthelp.pl
--- a/doc/interpreter/mk-qthelp.pl      Mon Nov 07 16:50:39 2022 -0500
+++ b/doc/interpreter/mk-qthelp.pl      Fri Nov 11 08:48:27 2022 -0500
@@ -25,9 +25,20 @@ if ($#ARGV != 1)
 $htmlfname = File::Spec->catfile ($basedir, $htmldir, "index.html");
 open (my $HTML, "<", $htmlfname) or die "Unable to open $htmlfname";

+
+TEXINFO_VERSION = 6;  ## TODO FIXME Pull this information from Texinfo itself
+
+pattern1 = /^<div class="contents">/;
+
+if (TEXINFO_VERSION < 7) {pattern2 = /^<ul class="no-bullet">/; }
+else                     {pattern2 = /^<ul class="toc-numbered-mark">/; }
+
+if (TEXINFO_VERSION < 7) {pattern3 = /^<table class="index-fn/; }
+else                     {pattern3 = /^<table class="fn-entries/; }
+
 # Skip through preamble of file to find start of list
-while (($_ = <$HTML>) !~ /^<div class="contents">/ ) {;}
-while (($_ = <$HTML>) !~ /^<ul class="no-bullet">/ ) {;}
+while (<$HTML>) {next if $_ !~ $pattern1; last;}
+while (<$HTML>) {next if $_ !~ $pattern2; last;}

 $level = 0;
 while (<$HTML>)
@@ -68,7 +79,7 @@ die "Failed to parse index.html" if ($le
 open ($HTML, "<", $htmlfname) or die "Unable to open $htmlfname";

 # Skip through preamble of file to find start of list
-while (($_ = <$HTML>) !~ /^<table class="index-fn/ ) {;}
+while(<$HTML>) {next if $_ !~ $pattern3; last;}

 while (<$HTML>)
 {


It gives me the following errors:

  GEN      doc/interpreter/octave_interpreter.qhc
config.status: creating build-aux/subst-script-vals.sh-tmp
Can't modify constant item in scalar assignment at ../doc/interpreter/mk-qthelp.pl line 29, near "6;"
Bareword "TEXINFO_VERSION" not allowed while "strict subs" in use at ../doc/interpreter/mk-qthelp.pl line 29.
Bareword "pattern1" not allowed while "strict subs" in use at ../doc/interpreter/mk-qthelp.pl line 31.
Bareword "TEXINFO_VERSION" not allowed while "strict subs" in use at ../doc/interpreter/mk-qthelp.pl line 33.
Bareword "pattern2" not allowed while "strict subs" in use at ../doc/interpreter/mk-qthelp.pl line 33.
Bareword "pattern2" not allowed while "strict subs" in use at ../doc/interpreter/mk-qthelp.pl line 34.
Bareword "TEXINFO_VERSION" not allowed while "strict subs" in use at ../doc/interpreter/mk-qthelp.pl line 36.
Bareword "pattern3" not allowed while "strict subs" in use at ../doc/interpreter/mk-qthelp.pl line 36.
Bareword "pattern3" not allowed while "strict subs" in use at ../doc/interpreter/mk-qthelp.pl line 37.
Execution of ../doc/interpreter/mk-qthelp.pl aborted due to compilation errors.
make[2]: *** [Makefile:31307: doc/interpreter/octave_interpreter.qhc] Error 255


Can we disable "strict subs"?

Arun Giridhar <arungiridhar>
Group Member
Fri 11 Nov 2022 01:31:19 PM UTC, comment #9: 

The intent here in the diff below is to try the 6.8 patterns, and if they fail, then we retry with the 7.0 patterns. It is still buggy but that's the intent so far.

If there's a way to get the Texinfo version inside the Perl script itself we could try changing that.


diff -r 870036573716 doc/interpreter/mk-qthelp.pl
--- a/doc/interpreter/mk-qthelp.pl      Mon Nov 07 16:50:39 2022 -0500
+++ b/doc/interpreter/mk-qthelp.pl      Fri Nov 11 08:27:59 2022 -0500
@@ -26,8 +26,18 @@ if ($#ARGV != 1)
 open (my $HTML, "<", $htmlfname) or die "Unable to open $htmlfname";

 # Skip through preamble of file to find start of list
-while (($_ = <$HTML>) !~ /^<div class="contents">/ ) {;}
-while (($_ = <$HTML>) !~ /^<ul class="no-bullet">/ ) {;}
+$_ = <$HTML>;
+while (defined($_) && (!eof($_)) && ($_ !~ /^<div class="contents">/ )) {;}
+$_ = <$HTML>;
+while (defined($_) && (!eof($_)) && ($_ !~ /^<ul class="no-bullet">/ )) {;}
+
+if (eof($_))  # Texinfo is now 7+, need to search for a different first pattern
+{
+  $_ = <$HTML>;
+  while (defined($_) && (!eof($_)) && ($_ !~ /^<ul class="toc-numbered-mark">/ )) {;}
+  $_ = <$HTML>;
+  while (defined($_) && (!eof($_)) && ($_ !~ /^<ul class="no-bullet">/ )) {;}
+}

 $level = 0;
 while (<$HTML>)
@@ -68,7 +78,13 @@ die "Failed to parse index.html" if ($le
 open ($HTML, "<", $htmlfname) or die "Unable to open $htmlfname";

 # Skip through preamble of file to find start of list
-while (($_ = <$HTML>) !~ /^<table class="index-fn/ ) {;}
+$_ = <$HTML>;
+while (defined($_) && (!eof($_)) && ($_ !~ /^<table class="index-fn/ )) {;}
+if (eof($_))  # Texinfo is now 7+, need to search for a different first pattern
+{
+  $_ = <$HTML>;
+  while (defined($_) && (!eof($_)) && ($_ !~ /^<table class="fn-entries/ )) {;}
+}

 while (<$HTML>)
 {


Arun Giridhar <arungiridhar>
Group Member
Fri 11 Nov 2022 01:16:54 PM UTC, comment #8: 

This WIP change should prevent the infinite loops from happening:


diff -r 870036573716 doc/interpreter/mk-qthelp.pl
--- a/doc/interpreter/mk-qthelp.pl      Mon Nov 07 16:50:39 2022 -0500
+++ b/doc/interpreter/mk-qthelp.pl      Fri Nov 11 08:13:45 2022 -0500
@@ -26,8 +26,12 @@ if ($#ARGV != 1)
 open (my $HTML, "<", $htmlfname) or die "Unable to open $htmlfname";

 # Skip through preamble of file to find start of list
-while (($_ = <$HTML>) !~ /^<div class="contents">/ ) {;}
-while (($_ = <$HTML>) !~ /^<ul class="no-bullet">/ ) {;}
+$_ = <$HTML>;
+while (defined($_) && (!eof($_)) && ($_ !~ /^<div class="contents">/ )) {;}
+die("Texinfo version mismatch -- fix in progress") if (eof($_));
+$_ = <$HTML>;
+while (defined($_) && (!eof($_)) && ($_ !~ /^<ul class="no-bullet">/ )) {;}
+die("Texinfo version mismatch -- fix in progress") if (eof($_));

 $level = 0;
 while (<$HTML>)
@@ -68,7 +72,9 @@ die "Failed to parse index.html" if ($le
 open ($HTML, "<", $htmlfname) or die "Unable to open $htmlfname";

 # Skip through preamble of file to find start of list
-while (($_ = <$HTML>) !~ /^<table class="index-fn/ ) {;}
+$_ = <$HTML>;
+while (defined($_) && (!eof($_)) && ($_ !~ /^<table class="index-fn/ )) {;}
+die("Texinfo version mismatch -- fix in progress") if (eof($_));

 while (<$HTML>)
 {


Arun Giridhar <arungiridhar>
Group Member
Fri 11 Nov 2022 12:53:39 PM UTC, comment #7: 

IIUC, this is only an issue when building the documentation with newer versions of texinfo. The release tarballs already contain the documentation. If Octave in these distributions is built from a release tarball, they'll probably not see this issue. It'll probably only be noted if someone tries to build Octave from a repository checkout.

IIUC, the tag that we are trying to find also changed from `ul class="no-bullet"` to `ul class="toc-numbered-mark"`, or from `table class="index-fn` to `table class="fn-entries`.
So, a backward compatible change might be to look for one or the other?
(Also can't find `=~` in the code that is touched by the proposed changes...)

Markus Mützel <mmuetzel>
Group administrator
Fri 11 Nov 2022 12:29:49 PM UTC, comment #6: 

In addition to the patch from gabriele, there's this other workaround in Perl code:

Change this

if ($_ =~ /$foo/)


to this

if (defined($_) && ($_ =~ /$foo/))


I believe that will be backwards compatible but Perl is not my first language so please check.

I see from Distrowatch that Arch and Gentoo have upgraded to 7.0 too. No bug reports yet at those distros though.

My own distro has not upgraded Texinfo yet.  Could you check the above "defined" on Mac pls? I'll be able to prepare an hg patch in a couple of hours.

Arun Giridhar <arungiridhar>
Group Member
Fri 11 Nov 2022 08:17:01 AM UTC, comment #5: 

I (temporarily) disabled building the documentation on the macOS runners here:
https://hg.savannah.gnu.org/hgweb/octave/rev/ac08158dae9b

That will hopefully unblock them until this issue is resolved.

Markus Mützel <mmuetzel>
Group administrator
Fri 11 Nov 2022 07:39:18 AM UTC, comment #4: 

Texinfo 7.0 has been released a couple of days ago. And homebrew has already updated to that version:
https://formulae.brew.sh/formula/texinfo

It looks like that broke building Octave on that platform. E.g.:
https://github.com/gnu-octave/octave/actions/runs/3442140522/jobs/5742417901

The logs are flooded with tens of millions of lines like the following up to the point that it the overall log is more than 3 GiB large:

2022-11-11T04:59:55.6808870Z Use of uninitialized value $_ in pattern match (m//) at ../doc/interpreter/mk-qthelp.pl line 30, <$HTML> line 832.


Unfortunately, my perl-knowledge is approximately non-existent. I'd appreciate if somebody could take a look at the suggestions presented here and adapt them such that we don't break compatibility with texinfo 6.8 or before.

Raising the priority and severity now that the released version is confirmed to break the build.

Markus Mützel <mmuetzel>
Group administrator
Sat 15 Oct 2022 08:07:39 PM UTC, comment #3: 

Changing this to dev instead of targeting 7.3, since it depends on an external program update schedule.

This is the current state of Texinfo across all distros:
https://distrowatch.com/dwres-mobile.php?resource=package-in-distro&pkg=texinfo

At least one of them will have to exhibit this behavior before we can test meaningfully, otherwise it's just as likely be worked out by upstream Texinfo devs as us or other Texinfo users.

Arun Giridhar <arungiridhar>
Group Member
Thu 13 Oct 2022 03:56:20 PM UTC, comment #2: 

Thank you, gabriele.

Here's gabriele's patch converted to an hg patch against current sources:

diff -r f21b233f3274 doc/interpreter/mk-qthelp.pl
--- a/doc/interpreter/mk-qthelp.pl        Thu Oct 13 11:27:35 2022 +0200
+++ b/doc/interpreter/mk-qthelp.pl        Thu Oct 13 11:48:40 2022 -0400
@@ -26,8 +26,9 @@ if ($#ARGV != 1)
 open (my $HTML, "<", $htmlfname) or die "Unable to open $htmlfname";

 # Skip through preamble of file to find start of list
-while (($_ = <$HTML>) !~ /^<div class="contents">/ ) {;}
-while (($_ = <$HTML>) !~ /^<ul class="no-bullet">/ ) {;}
+while (<$HTML>) {next if $_ !~ /^<div class="contents">/; last;}
+while (<$HTML>) {next if $_ !~ /^<ul class="toc-numbered-mark">/; last;}
+    die "index.html: reached EOF: bait changed?" if eof($HTML);

 $level = 0;
 while (<$HTML>)
@@ -68,7 +69,8 @@ die "Failed to parse index.html" if ($le
 open ($HTML, "<", $htmlfname) or die "Unable to open $htmlfname";

 # Skip through preamble of file to find start of list
-while (($_ = <$HTML>) !~ /^<table class="index-fn/ ) {;}
+while(<$HTML>) {next if $_ !~ /^<table class="fn-entries/; last;}
+    die "Function-Index.html: reached EOF: bait changed?" if eof($HTML);

 while (<$HTML>)
 {


My Texinfo version is 6.8, texi2html version is 5.0, and the patch above causes it to error out with this:

index.html: reached EOF: bait changed? at ../doc/interpreter/mk-qthelp.pl line 31, <$HTML> line 847.
make[2]: *** [Makefile:31302: doc/interpreter/octave_interpreter.qhc] Error 255


I'll test it again when the system Texinfo upgrades.

Arun Giridhar <arungiridhar>
Group Member
Fri 17 Jun 2022 01:50:05 PM UTC, comment #1: 

oops
I now see that all the < and > chars in the original submission are being rendered as &lt; and &gt>;
Sorry about that: when I composed the report, using plain < and > messed up the preview, while typing the HTML equivalents seemed to work; so I used &lt; and &gt;.
But apparently, that hasn't worked so nicely in the final version...

gabriele balducci <balducci>
Fri 17 Jun 2022 01:37:50 PM UTC, original submission:  

hello

this isn't actually  a problem at present, but will presumably become a
problem with the next texinfo release.

So take this as a headsup more than a bug report

I just happened to build octave-7.1.90-rc vs a git pull of texinfo &gt;
6.8 (9d588505363a498d14c89db4d9236ea3d70ec3e5, revno 10427).

During the documentation build step (at least with the configuration
options I use, see below) an octave.html directory is created and
populated with:


if /bin/sh '/home/balducci/tmp/install-us-d/octave-7.1.90-rc.d/octave-7.1.90-rc/build-aux/missing' makeinfo --html   \
 -I doc/interpreter -I /home/balducci/tmp/install-us-d/octave-7.1.90-rc.d/octave-7.1.90-rc/doc/interpreter \
 --css-ref=octave.css \
 -o doc/interpreter/octave.htp `test -f 'doc/interpreter/octave.texi' || echo '/home/balducci/tmp/install-us-d/octave-7.1.90-rc.d/octave-7.1.90-rc/'`doc/interpreter/octave.texi; \
then \
  perl ./build-aux/inplace_edit.pl 's|(?<=</a&gt;): ||g' doc/interpreter/octave.htp/* && \
  rm -rf doc/interpreter/octave.html && \
  mv doc/interpreter/octave.htp doc/interpreter/octave.html && \
  touch doc/interpreter/octave.html/.octave-html-stamp; \
else \
  rm -rf doc/interpreter/octave.htp; exit 1; \
fi



Afterwards, the .html files in octave.html are used to generate
"intermediate formats for Qt Help Project (.qhp) and Qt Help
Collection Project (.qhcp)" files, with:


rm -f doc/interpreter/octave_interpreter.qhc doc/interpreter/octave_interpreter.qch && \
perl ./doc/interpreter/mk-qthelp.pl octave.html doc/interpreter/octave_interpreter && \
qcollectiongenerator  doc/interpreter/octave_interpreter.qhcp -o doc/interpreter/octave_interpreter.qhc &gt;/dev/null && \
rm -f doc/interpreter/octave_interpreter.qhcp doc/interpreter/octave_interpreter.qhp


The mk-qthelp.pl perl script relies upon text baits in index.html and
Function-Index.html to do its job:


while (($_ = <$HTML&gt;) !~ /^&lt;div class="contents"&gt;/ ) {;}
while (($_ = <$HTML&gt;) !~ /^&lt;ul class="no-bullet"&gt;/ ) {;}
[...]
while (($_ = <$HTML&gt;) !~ /^&lt;table class="index-fn/ ) {;}


And here comes the problem. With texinfo&gt;6.8 (or, at least, with the
git pull I used), the html code generated by "makeinfo &dash;&dash;html" has changed.

In particular, there are no more


/^&lt;div class="contents"&gt;/

and

/^&lt;table class="index-fn/


baits, which must be replaced, AFAICS, by


/^&lt;ul class="toc-numbered-mark"&gt;/

and

/^&lt;table class="fn-entries/


respectively.

As a result, two of the three while loops above become infinite and
perl (both 5.36.0 and 5.34.1, as I could verify) endlessly dumps the
message:


Use of uninitialized value $_ in pattern match (m//) at ./doc/interpreter/mk-qthelp.pl line 30, &lt;$HTML&gt; line 831.

to stderr.

If you are capturing the output of the (unattended) build process into
a file, you end up with an utterly filled up disk (which actually
happened to me).

So I see two fothcoming problems here:
1. mk-qthelp.pl should be extended to catch up with the upcoming changes   in
   "makeinfo --html" output
2. the perl code should be made more robust wrt possible infinite
   loops

Just to make clearer the problem I'm reporting, this (crude, no back
compatible) workaround fixes things for me, allowing the build to
complete successfully:


diff -c doc/interpreter/mk-qthelp.pl.FIX_MK_QTHELP_PL doc/interpreter/mk-qthelp.pl
*** doc/interpreter/mk-qthelp.pl.FIX_MK_QTHELP_PL        2022-06-17 13:20:51.636488560 +0200
--- doc/interpreter/mk-qthelp.pl        2022-06-17 13:20:51.636488560 +0200
***************
*** 26,33 ****
  open (my $HTML, "&lt;", $htmlfname) or die "Unable to open $htmlfname";

  # Skip through preamble of file to find start of list
! while (($_ = &lt;$HTML&gt;) !~ /^&lt;div class="contents"&gt;/ ) {;}
! while (($_ = &lt;$HTML&gt;) !~ /^&lt;ul class="no-bullet"&gt;/ ) {;}

  $level = 0;
  while (&lt;$HTML&gt;)
--- 26,34 ----
  open (my $HTML, "&lt;", $htmlfname) or die "Unable to open $htmlfname";

  # Skip through preamble of file to find start of list
! while (&lt;$HTML&gt;){next if $_ !~ /^&lt;div class="contents"&gt;/;last;}
! while (&lt;$HTML&gt;){next if $_ !~ /^&lt;ul class="toc-numbered-mark"&gt;/;last;}
!     die "index.html: reached EOF: bait changed?" if eof($HTML);

  $level = 0;
  while (&lt;$HTML&gt;)
***************
*** 68,74 ****
  open ($HTML, "&lt;", $htmlfname) or die "Unable to open $htmlfname";

  # Skip through preamble of file to find start of list
! while (($_ = &lt;$HTML&gt;) !~ /^&lt;table class="index-fn/ ) {;}

  while (&lt;$HTML&gt;)
  {
--- 69,76 ----
  open ($HTML, "&lt;", $htmlfname) or die "Unable to open $htmlfname";

  # Skip through preamble of file to find start of list
! while(&lt;$HTML&gt;){next if $_ !~ /^&lt;table class="fn-entries/;last;}
!     die "Function-Index.html: reached EOF: bait changed?" if eof($HTML);

  while (&lt;$HTML&gt;)
  {


Building on GNU/linux:

Linux 5.18.1 #1 SMP Tue May 31 08:16:21 CEST 2022 x86_64 GNU/Linux


Configuring with:

--enable-shared
--disable-silent-rules


Thank you very much for your valuable work

ciao
-gabriele

gabriele balducci <balducci>

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:
   
   
Comment:
   

Attached Files
file #53955:  bug62648.cset added by rik5 (2KiB - application/octet-stream)
file #53947:  tex.patch added by arungiridhar (19KiB - text/x-patch)
file #53945:  qthelp_Texinfo6.pl added by arungiridhar (6KiB - application/x-perl)
file #53946:  qthelp_Texinfo7.pl added by arungiridhar (6KiB - application/x-perl)

 

Depends on the following items: None found

Digest:
   bug dependencies.

 

Carbon-Copy List
  • -email is unavailable- added by rik5 (Updated the item)
  • -email is unavailable- added by arungiridhar
  • -email is unavailable- added by thesamesam (Posted a comment)
  • -email is unavailable- added by mmuetzel (Posted a comment)
  • -email is unavailable- added by arungiridhar (Posted a comment)
  • -email is unavailable- added by siko1056 (Updated the item)
  • -email is unavailable- added by balducci (Submitted the item)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only group members can vote.

     

    Follow 22 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2023-02-16 mmuetzel Dependencies- bugs #63810 is dependent
    2022-11-18 arungiridhar StatusReady For Test Fixed
        Open/ClosedOpen Closed
    2022-11-16 arungiridhar StatusIn Progress Ready For Test
    2022-11-16 mmuetzel StatusFixed In Progress
        Open/ClosedClosed Open
    2022-11-16 mmuetzel StatusReady For Test Fixed
        Open/ClosedOpen Closed
    2022-11-15 mmuetzel StatusPatch Submitted Ready For Test
    2022-11-14 rik5 Attached File- Added bug62648.cset, #53955
    2022-11-14 mmuetzel StatusConfirmed Patch Submitted
    2022-11-14 arungiridhar Carbon-Copy- Added rik5
    2022-11-11 arungiridhar Attached File- Added tex.patch, #53947
    2022-11-11 arungiridhar Attached File- Added qthelp_Texinfo6.pl, #53945
        Attached File- Added qthelp_Texinfo7.pl, #53946
    2022-11-11 mmuetzel Summaryforthcoming build problem with texinfo&gt;6.8 build problem with texinfo>6.8
    2022-11-11 mmuetzel Severity3 - Normal 5 - Blocker
        Priority5 - Normal 7 - High
        StatusNone Confirmed
        Operating SystemGNU/Linux Any
    2022-10-15 arungiridhar Release7.2.0 dev
    2022-10-13 siko1056 Release7.1.90 7.2.0

    Back to the top

    Powered by Savane 3.13-f8d8.
    Corresponding source code