Hi all--and especially Keith Marshall! :) Maybe Werner or Gaius, or anyone who understands the \O suppression escapes, could assist as well.
I just pushed the following commit--I've got a problem I'm having a devil of a time figuring it out. As noted below, I caused a regression a couple of days ago, but one that was hard to see since it didn't break the build. The table of contents was not getting relocated in pdfmark.pdf. The only evidence of this (if you didn't so something crazy like view the file) was a stray line in the build: pdfroff-option:set toc_relocation=enabled This is emitted by spdf.tmac, and normally, apparently, something eats it. So if you see it, it indicates the TOC relocation failed--at least it did in this case. Now that the error condition is caught and troff doesn't exit unexpectedly, the regression is fixed. (Should pdfroff be checking groff's exit status?) But the wheels turning here mystify me. What is causing the `image_filename` (formerly `last_image_filename`) to go uninitialized, why only in very specific circumstances? commit 01a65469b56f7284041365b0b179b6b4b9153b9c Author: G. Branden Robinson <g.branden.robin...@gmail.com> Date: Thu Jul 29 19:15:40 2021 +1000 [troff]: Add sanity check to prevent SEGV. * src/roff/troff/node.cpp (suppress_node::tprint): If emitting bounding box limits for an image filename, ensure that `image_filename` is not a null pointer (and furthermore that it's not a zero-length string even if the pointer is valid). Emit an error diagnostic and skip further processing of the node if they are. This problem implies nonsensical input (so we should guard against it), but I cannot reproduce the problem _except_ with pdfroff during a build of the groff tree, which has been reliably failing to relocate the table of contents in pdfmark.pdf since commit e876d4bfd193abb9a7d1fb6e76519349bded482a, 27 July. If I extract the groff and troff commands that pdfroff is running and execute them in the build directory, they complete successfully, which suggests to me an environment problems or a race condition. This commit produces nonstandard indentation in the `else` brace block; I did that to keep the logic and scope of the change clear. I'm attaching a patch that gets the state of the build examinable as far as I've been able to manage. You can also change the `abort()` in node.cpp to a `sleep(60)` or so to leave the process alive long enough to attach a debugger to it. I'd really appreciate some guidance here--I'm stumped. Regards, Branden
diff --git a/contrib/pdfmark/pdfroff.sh b/contrib/pdfmark/pdfroff.sh index 4179918c..00b7fec8 100644 --- a/contrib/pdfmark/pdfroff.sh +++ b/contrib/pdfmark/pdfroff.sh @@ -531,7 +531,14 @@ # filtering them into the reference dictionary; discard incomplete 'groff' output # at this stage. # + echo >/dev/tty $STREAM $GROFF_STYLE -Z 1\>$NULLDEV 2\>$WRKFILE $REFCOPY $INPUT_FILES eval $STREAM $GROFF_STYLE -Z 1>$NULLDEV 2>$WRKFILE $REFCOPY $INPUT_FILES + STATUS=$? + if test $STATUS -ne 0 + then + echo >/dev/tty PROBLEM: press CTRL+Z and inspect temporary files + sleep 600 + fi $AWK '/^gropdf-info:href/ {$1 = ".pdfhref D -N"; print}' $WRKFILE > $REFFILE done $SAY >&2 " done" diff --git a/src/roff/troff/node.cpp b/src/roff/troff/node.cpp index c93d8bc6..6393af57 100644 --- a/src/roff/troff/node.cpp +++ b/src/roff/troff/node.cpp @@ -4090,9 +4090,11 @@ void suppress_node::tprint(troff_output_file *out) else { // Now check whether the suppress node requires us to issue limits. if (emit_limits) { - if ((0 == image_filename) || (strlen(image_filename) == 0)) + if ((0 == image_filename) || (strlen(image_filename) == 0)) { error("cannot emit suppresion node placement information" " without a (saved) filename; skipping"); + abort(); + } else { const size_t namebuflen = 8192; char name[namebuflen] = { '\0' };
signature.asc
Description: PGP signature