groff-commit
[Top][All Lists]
Advanced

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

[groff] 04/07: [grog]: Fix logic error.


From: G. Branden Robinson
Subject: [groff] 04/07: [grog]: Fix logic error.
Date: Tue, 29 Jun 2021 00:19:22 -0400 (EDT)

gbranden pushed a commit to branch master
in repository groff.

commit 77510f82a9e8bb38a84dcbe22309f3b927b167ec
Author: G. Branden Robinson <g.branden.robinson@gmail.com>
AuthorDate: Mon Jun 28 20:38:12 2021 +1000

    [grog]: Fix logic error.
    
    ...which could lead to pointlessly duplicated -m arguments to groff.
    
    * src/utils/grog/grog.pl (construct_command): Correct comment and
      related logic error.  Clear the inferred main macro package if _any_
      `-m` argument matching any main macro package is given.  Warn only if
      what is specified doesn't match the inference.
---
 ChangeLog              |  4 ++++
 src/utils/grog/grog.pl | 15 ++++++++-------
 2 files changed, 12 insertions(+), 7 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 6434a4f..ef01064 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -12,6 +12,10 @@
        one major implementation thereof (man-db man), and not used by
        other types of roff documents; at this point, we don't yet know
        if the document we're processing is a man page.
+       (construct_command): Correct comment and related logic error.
+       Clear the inferred main macro package if _any_ `-m` argument
+       matching any main macro package is given.  Warn only if what is
+       specified doesn't match the inference.
 
 2021-06-28  G. Branden Robinson <g.branden.robinson@gmail.com>
 
diff --git a/src/utils/grog/grog.pl b/src/utils/grog/grog.pl
index 2c4f7c8..5f66412 100644
--- a/src/utils/grog/grog.pl
+++ b/src/utils/grog/grog.pl
@@ -891,15 +891,16 @@ sub construct_command {
 
   my @msupp = ();
 
-  # If a full-service package was explicitly requested, it had better
-  # not clash with what we inferred.  If it does, explicitly unset
-  # $inferred_main_package so that the -m arguments are placed in the
+  # If a full-service package was explicitly requested, clear any
+  # inferred package (and warn if the inference differs from the
+  # request).  This also ensures that all -m arguments are placed in the
   # same order that the user gave them; caveat dictator.
   for my $pkg (@requested_package) {
-    if (grep(/$pkg/, @main_package)
-       && ($pkg ne $inferred_main_package)) {
-      &warn("overriding inferred package '$inferred_main_package'"
-           . " with requested package '$pkg'");
+    if (grep(/$pkg/, @main_package)) {
+      if ($pkg ne $inferred_main_package) {
+        &warn("overriding inferred package '$inferred_main_package'"
+             . " with requested package '$pkg'");
+      }
       $inferred_main_package = '';
     }
     push @msupp, '-m' . $pkg;



reply via email to

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