bug-groff
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[bug #65961] [grohtml] pre-html.cpp: suppress certain warnings from pnmc


From: G. Branden Robinson
Subject: [bug #65961] [grohtml] pre-html.cpp: suppress certain warnings from pnmcrop
Date: Tue, 9 Jul 2024 13:28:32 -0400 (EDT)

Follow-up Comment #4, bug #65961 (group groff):

[comment #3 comment #3:]

> Be that as it may, pnmcrop is _also_ throwing the diagnostic on 
> images that do have content: processing the latest ms.ms with the 
> latest grohtml produces the diagnostic 59 times with my version 
> of netpbm (10.70.0), even though all 59 images generated have 
> content (per comment 1 of bug #65936).

Quoting that comment:

> When running your command, the newer groff does generate 59 lines
> of "pnmcrop: The image is entirely background; there is nothing
> to crop" on stderr.  But the images look OK despite these
> diagnostics.

That may in fact be a Netpbm bug.  But, if your installed Netpbm recognizes
the option discussed in this ticket, help is on the way.

My working copy:


commit 92f307bbf0a7fce40555e321a26f6095f331a830
Author: G. Branden Robinson <g.branden.robinson@gmail.com>
Date:   Tue Jul 9 10:51:44 2024 -0500

    [grohtml]: Fix Savannah #65961 (quieten pnmcrop).
    
    [grohtml]: Pass `-blank-image=pass` to pnmcrop(1) if supported by the
    installed version of Netpbm.
    
    * m4/groff.m4 (GROFF_PNMTOOLS_CAN_BE_QUIET): Set up an Autoheader
      template for the C/C++ preprocessor symbol `PNMCROP_PASS`.  Report the
      detected option (if any) as the result of this configuration test.
      Get the expansion into the "config.h" file with `AC_DEFINE_UNQUOTED`.
    * src/preproc/html/pre-html.cpp (imageList::createImage): Use the
      preprocessor symbol.
    
    Fixes <https://savannah.gnu.org/bugs/?65961>.  Thanks to Bjarni Ingi
    Gislason for the report.
    
    Build-tested in Debian bookworm and bullseye environments.  In the
    former, the "netpbm" package lacks `-blank-image=pass` support, and the
    latter has it.
[...]
diff --git a/m4/groff.m4 b/m4/groff.m4
index fd4545b8c..b25f6f946 100644
--- a/m4/groff.m4
+++ b/m4/groff.m4
@@ -447,16 +447,19 @@
 ])
 
 
-# Check whether the pnm tools accept the -quiet option.
+# See how to make Netpbm commands quiet where we need them to be.
 
-dnl Any macro that tests $pnmtools_quiet should AC_REQUIRE this.
+dnl Any macro that tests $pnmtools_quiet or $pnmcrop_pass_blank_image
+dnl should AC_REQUIRE this.
 
 AC_DEFUN([GROFF_PNMTOOLS_CAN_BE_QUIET], [
   AC_REQUIRE([GROFF_CHECK_GROHTML_PROGRAMS])
 
   AH_TEMPLATE([PNMTOOLS_QUIET], [Command-line option to quiet Netpnm.])
+  AH_TEMPLATE([PNMCROP_PASS], [Command-line option to quiet pnmcrop.])
 
   pnmtools_quiet=
+  pnmcrop_pass=
 
   if test "$use_grohtml" = yes
   then
@@ -465,15 +468,22 @@
     then
       pnmtools_quiet=-quiet
     fi
-    if test -n "$pnmtools_quiet"
+    if echo P2 2 2 255 0 1 2 0 | pnmcrop "$pnmtools_quiet" \
+      -blank-image=pass > /dev/null 2>&1
     then
-      AC_MSG_RESULT([$pnmtools_quiet])
+      pnmcrop_pass=-blank-image=pass
+    fi
+    if test -n "$pnmtools_quiet$pnmcrop_pass"
+    then
+      AC_MSG_RESULT([$pnmtools_quiet $pnmcrop_pass])
     else
       AC_MSG_RESULT([(none)])
     fi
   fi
   AC_SUBST([pnmtools_quiet])
+  AC_SUBST([pnmcrop_pass])
   AC_DEFINE_UNQUOTED([PNMTOOLS_QUIET], ["$pnmtools_quiet"])
+  AC_DEFINE_UNQUOTED([PNMCROP_PASS], ["$pnmcrop_pass"])
 ])
 
 
diff --git a/src/preproc/html/pre-html.cpp b/src/preproc/html/pre-html.cpp
index 751cba78e..90a93510e 100644
--- a/src/preproc/html/pre-html.cpp
+++ b/src/preproc/html/pre-html.cpp
@@ -1007,7 +1007,7 @@ void imageList::createImage(imageItem *i)
             + 1 + IMAGE_BORDER_PIXELS;
     if (createPage(i->pageNo) == 0) {
       s = make_string("pamcut%s %d %d %d %d < %s "
-                     "| pnmcrop%s " PNMTOOLS_QUIET
+                     "| pnmcrop%s " PNMTOOLS_QUIET " " PNMCROP_PASS
                      "| pnmtopng%s " PNMTOOLS_QUIET " %s"
                      "> %s\n",
                      EXE_EXT,


That patch will not apply as-is.  It depends some other groundwork from my
working copy.  But it should get the idea across.


    _______________________________________________________

Reply to this item at:

  <https://savannah.gnu.org/bugs/?65961>

_______________________________________________
Message sent via Savannah
https://savannah.gnu.org/

Attachment: signature.asc
Description: PGP signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]