texinfo-commits
[Top][All Lists]
Advanced

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

branch master updated: * tp/Texinfo/ParserNonXS.pm (_next_text): remove


From: Patrice Dumas
Subject: branch master updated: * tp/Texinfo/ParserNonXS.pm (_next_text): remove 'fh' at the end of STDIN too. Report from Arsen Arsenović.
Date: Wed, 01 Mar 2023 18:46:46 -0500

This is an automated email from the git hooks/post-receive script.

pertusus pushed a commit to branch master
in repository texinfo.

The following commit(s) were added to refs/heads/master by this push:
     new 14ec61e043 * tp/Texinfo/ParserNonXS.pm (_next_text): remove 'fh' at 
the end of STDIN too.  Report from Arsen Arsenović.
14ec61e043 is described below

commit 14ec61e043528f11b9ec8b0f4a4b919dc1045f4b
Author: Patrice Dumas <pertusus@free.fr>
AuthorDate: Thu Mar 2 00:46:35 2023 +0100

    * tp/Texinfo/ParserNonXS.pm (_next_text): remove 'fh' at the end of
    STDIN too.  Report from Arsen Arsenović.
---
 ChangeLog                 |  5 +++++
 tp/Texinfo/ParserNonXS.pm | 54 +++++++++++++++++++++++++++--------------------
 2 files changed, 36 insertions(+), 23 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 13f1ada231..20b000017d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2023-03-01  Patrice Dumas  <pertusus@free.fr>
+
+       * tp/Texinfo/ParserNonXS.pm (_next_text): remove 'fh' at the end of
+       STDIN too.  Report from Arsen Arsenović.
+
 2023-03-01  Patrice Dumas  <pertusus@free.fr>
 
        Remove extra misc_args for special and lineraw line commands
diff --git a/tp/Texinfo/ParserNonXS.pm b/tp/Texinfo/ParserNonXS.pm
index e4470555ff..ca468acb24 100644
--- a/tp/Texinfo/ParserNonXS.pm
+++ b/tp/Texinfo/ParserNonXS.pm
@@ -2368,29 +2368,30 @@ sub _next_text($;$)
           . "$top_value\n"
             if ($self->{'DEBUG'});
       }
-    # Don't close STDIN
-    } elsif ($input->{'fh'}
-             and $input->{'input_source_info'}->{'file_name'} ne '-') {
-      if (!close($input->{'fh'})) {
-        # decode for the message, to have character strings in perl
-        # that will be encoded on output to the locale encoding.
-        # Done differently for the file names in source_info
-        # which are byte strings and end up unmodified in output error
-        # messages.
-        my $file_name_encoding;
-        if (defined($input->{'file_name_encoding'})) {
-          $file_name_encoding = $input->{'file_name_encoding'};
-        } else {
-          $file_name_encoding = $self->get_conf('COMMAND_LINE_ENCODING');
-        }
-        my $decoded_file_name = $input->{'input_file_path'};
-        if (defined($file_name_encoding)) {
-          $decoded_file_name = decode($file_name_encoding,
-                                      $input->{'input_file_path'});
+    } elsif ($input->{'fh'}) {
+      # Don't close STDIN
+      if ($input->{'input_source_info'}->{'file_name'} ne '-') {
+        if (!close($input->{'fh'})) {
+          # decode for the message, to have character strings in perl
+          # that will be encoded on output to the locale encoding.
+          # Done differently for the file names in source_info
+          # which are byte strings and end up unmodified in output error
+          # messages.
+          my $file_name_encoding;
+          if (defined($input->{'file_name_encoding'})) {
+            $file_name_encoding = $input->{'file_name_encoding'};
+          } else {
+            $file_name_encoding = $self->get_conf('COMMAND_LINE_ENCODING');
+          }
+          my $decoded_file_name = $input->{'input_file_path'};
+          if (defined($file_name_encoding)) {
+            $decoded_file_name = decode($file_name_encoding,
+                                        $input->{'input_file_path'});
+          }
+          $self->{'registrar'}->document_warn($self,
+                               sprintf(__("error on closing %s: %s"),
+                                       $decoded_file_name, $!));
         }
-        $self->{'registrar'}->document_warn($self,
-                             sprintf(__("error on closing %s: %s"),
-                                     $decoded_file_name, $!));
       }
       delete $input->{'fh'};
     }
@@ -6825,7 +6826,14 @@ sub _parse_texi($$$)
   if ($empty_last_input->{'th'} or $empty_last_input->{'fh'}
       or $empty_last_input->{'source_mark'}
       or scalar(@{$self->{'input'}})) {
-    $self->_bug_message("Non empty last input at the end\n");
+    my $msg = '';
+    $msg .= 'th set, ' if ($empty_last_input->{'th'});
+    $msg .= 'fh set, ' if ($empty_last_input->{'fh'});
+    $msg .= 'mark, ' if ($empty_last_input->{'source_mark'});
+    $msg .= scalar(@{$self->{'input'}}).' input, '
+      if (scalar(@{$self->{'input'}}));
+
+    $self->_bug_message("Non empty last input at the end: $msg\n");
     die;
   }
 



reply via email to

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