texinfo-commits
[Top][All Lists]
Advanced

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

branch master updated: * texi2any.pl: use Storable::dclone to copy parse


From: Patrice Dumas
Subject: branch master updated: * texi2any.pl: use Storable::dclone to copy parser configuration for each file and command line options for each file. A shallow copy is not enough to make sure that the initial information is not modified with arrays or hashes. This happened in practice for 'INCLUDE_DIRECTORIES'.
Date: Sat, 04 Sep 2021 19:21:37 -0400

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 fa93c1a  * texi2any.pl: use Storable::dclone to copy parser 
configuration for each file and command line options for each file.  A shallow 
copy is not enough to make sure that the initial information is not modified 
with arrays or hashes.  This happened in practice for 'INCLUDE_DIRECTORIES'.
fa93c1a is described below

commit fa93c1a0418f3e576a5c67854c185708e6e8aedd
Author: Patrice Dumas <pertusus@free.fr>
AuthorDate: Sun Sep 5 01:21:28 2021 +0200

    * texi2any.pl: use Storable::dclone to copy parser configuration
    for each file and command line options for each file.  A shallow
    copy is not enough to make sure that the initial information is not
    modified with arrays or hashes.  This happened in practice for
    'INCLUDE_DIRECTORIES'.
---
 ChangeLog      |  8 ++++++++
 tp/TODO        |  4 ----
 tp/texi2any.pl | 14 ++++++++++----
 3 files changed, 18 insertions(+), 8 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 64cf748..1739989 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,13 @@
 2021-09-05  Patrice Dumas  <pertusus@free.fr>
 
+       * texi2any.pl: use Storable::dclone to copy parser configuration
+       for each file and command line options for each file.  A shallow
+       copy is not enough to make sure that the initial information is not
+       modified with arrays or hashes.  This happened in practice for
+       'INCLUDE_DIRECTORIES'.
+
+2021-09-05  Patrice Dumas  <pertusus@free.fr>
+
        * tp/Texinfo/Translations.pm (complete_indices): do not delete
        $entry->{'command'}->{'extra'}->{'documentlanguage'} from tree.
 
diff --git a/tp/TODO b/tp/TODO
index f2ff851..ef1f5f6 100644
--- a/tp/TODO
+++ b/tp/TODO
@@ -15,10 +15,6 @@ Before next release
 
 Rename _set_global_multiple_commands
 
-check @{$converter_options->{'INCLUDE_DIRECTORIES'}} with more 
-than one output file
-FIXME isn't that done for each output file?
-
 complete_indices, gdt, some code in Text: add documentlanguage arg to gdt
 
 not internal (maybe move?)
diff --git a/tp/texi2any.pl b/tp/texi2any.pl
index 60d90cb..adaba05 100755
--- a/tp/texi2any.pl
+++ b/tp/texi2any.pl
@@ -35,6 +35,8 @@ use File::Basename;
 use Getopt::Long qw(GetOptions);
 # for carp
 #use Carp;
+# for dclone
+use Storable;
 
 Getopt::Long::Configure("gnu_getopt");
 
@@ -1134,7 +1136,10 @@ while(@input_files) {
   my $input_file_base = $input_file_name;
   $input_file_base =~ s/\.te?x(i|info)?$//;
 
-  my $parser_file_options = { %$parser_options };
+  # a shallow copy is not sufficient for arrays and hashes to make
+  # sure that the $parser_options are not modified if $parser_file_options
+  # are modified
+  my $parser_file_options = Storable::dclone($parser_options);
 
   my @prepended_include_directories = ('.');
   push @prepended_include_directories, $input_directory
@@ -1142,7 +1147,6 @@ while(@input_files) {
   @prepended_include_directories =
     (@prepend_dirs, @prepended_include_directories);
 
-  # FIXME isn't that done for each output file?
   unshift @{$parser_file_options->{'INCLUDE_DIRECTORIES'}},
           @prepended_include_directories;
 
@@ -1323,7 +1327,10 @@ while(@input_files) {
   if ($format eq 'structure') {
     next;
   }
-  my $file_cmdline_options = { %$cmdline_options };
+  # a shallow copy is not sufficient for arrays and hashes to make
+  # sure that the $cmdline_options are not modified if $file_cmdline_options
+  # are modified
+  my $file_cmdline_options = Storable::dclone($cmdline_options);
 
   if ($file_number != 0) {
     delete $file_cmdline_options->{'OUTFILE'}
@@ -1341,7 +1348,6 @@ while(@input_files) {
   $converter_options->{'structuring'} = $structure_informations;
   $converter_options->{'output_format'} = $format;
   $converter_options->{'language_config_dirs'} = \@language_config_dirs;
-  # FIXME isn't that done for each output file?
   unshift @{$converter_options->{'INCLUDE_DIRECTORIES'}},
           @prepended_include_directories;
 



reply via email to

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