gbranden pushed a commit to branch master
in repository groff.

commit 21d5356b77b48a3e4ce2231698fec856603c2489
Author: G. Branden Robinson <[email protected]>
AuthorDate: Fri May 16 19:24:38 2025 -0500

    [troff]: Add assertions (INSTALL FAILS).
    
    * src/roff/troff/node.cpp (real_output_file::on, real_output_file::off):
      Add `assert()`ions of complementary Boolean state before
      unconditionally assigning the other.  One of them fails, in a quiet
      and underhanded way, when using grohtml to format "doc/pic.ms", which
      scandalously doesn't provoke a build failure.  No automated tests trip
      it, either.  A document in the wild could conceivably trip either.  If
      one does, we want to hear about it, preferably with a core file
      generated by an unstripped troff executable.
    
    I have a fairly hard rule about not pushing commits that break the
    build.  Technically this doesn't.  groff _builds_ just fine.  But if you
    try to install it, it will fail:
    
      .../share/doc/groff-1.23.0/html/img
    /usr/bin/install: cannot stat '.../GIT/groff/build/doc/img/pic*': No such 
file or directory
    
    ...and sure enough, the pic-1.png and other image files to be inlined
    into the generated HTML files aren't there.
    
    Why aren't they there?  Why didn't the build fail earlier?  Why didn't
    groff throw a fit when grohtml couldn't generate the desired output?
    ("Why aren't you over there stomping Private Pyle's guts out?!")
    
    Two reasons.
    
    1.  src/roff/groff/pipeline.c appears to have a 33-year-old bug in it.
    2.  Our doc/doc.am script doesn't try hard enough to detect failure.
    
    Over the past 8 years, I've on rare occasions seen mysterious failures
    from grohtml, usually when formatting pic.ms, but they've always
    neglected to leave behind evidence of the crime (like a core dump), and
    worse, like in this case, usually weren't detectable if all you did was
    build everything, as opposed to trying to install it.
    
    Now at last I think I have my fingers around the throat of the problem.
    
    In the next commits I'll address the two issues above.
---
 ChangeLog               | 12 ++++++++++++
 src/roff/troff/node.cpp |  6 ++++--
 2 files changed, 16 insertions(+), 2 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index c2669aed4..9157128a0 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,15 @@
+2025-05-15  G. Branden Robinson <[email protected]>
+
+       * src/roff/troff/node.cpp (real_output_file::on)
+       (real_output_file::off): Add `assert()`ions of complementary
+       Boolean state before unconditionally assigning the other.
+       One of them fails, in a quiet and underhanded way, when using
+       grohtml to format "doc/pic.ms", which scandalously doesn't
+       provoke a build failure.  No automated tests trip it, either.  A
+       document in the wild could conceivably trip either.  If one
+       does, we want to hear about it, preferably with a core file
+       generated by an unstripped troff executable.
+
 2025-05-15  G. Branden Robinson <[email protected]>
 
        [troff]: Boolify output enablement-related (meaning: not
diff --git a/src/roff/troff/node.cpp b/src/roff/troff/node.cpp
index 4cd9fcf0b..dc2a5e2c0 100644
--- a/src/roff/troff/node.cpp
+++ b/src/roff/troff/node.cpp
@@ -1831,13 +1831,15 @@ void real_output_file::really_put_filename(const char 
*, int)
 void real_output_file::on()
 {
   really_on();
-  if (!is_output_on)
-    is_output_on = true;
+  // XXX: Assertion fails when generating pic.html.  Find out why.
+  assert(!is_output_on);
+  is_output_on = true;
 }
 
 void real_output_file::off()
 {
   really_off();
+  assert(is_output_on);
   is_output_on = false;
 }
 

_______________________________________________
groff-commit mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/groff-commit

Reply via email to