Closed qosobrin closed 1 year ago
I know that messages Use of uninitialized value in regexp compilation at /usr/share/sympa/lib/Sympa/List.pm line 5194, <GEN2> line 103.
are related to the sympa.log entries:
Jan 20 09:52:48 hostname sympa[865836]: info Sympa::List::_load_list_config_file() Expecting a single line for "profile" parameter in /var/lib/sympa/list_data/example.domain.com/list1/config
Jan 20 09:52:48 hostname sympa[865836]: info Sympa::List::_load_list_config_file() Bad entry "profile normal" in /var/lib/sympa/list_data/example.domain.com/list1/config
Jan 20 09:52:48 hostname sympa[865836]: info Sympa::List::_load_list_config_file() Expecting a single line for "reception" parameter in /var/lib/sympa/list_data/example.domain.com/list1/config
Jan 20 09:52:48 hostname sympa[865836]: info Sympa::List::_load_list_config_file() Bad entry "reception mail" in /var/lib/sympa/list_data/example.domain.com/list1/config
and are related with the presence of these two lines profile normal
and reception mail
inthe config.tt2 file. As far as I know the syntax of these lines is ok and their presence should not generate any error or warning. It seems like the problem with them is that they are not expected there (I'm guessing here, I have no proof for that).
But, aside form that warning, there are two more that I do not have any clue where they are coming from: Use of uninitialized value in subroutine entry at /usr/lib/sympa/bin/sympa.pl line 1746.
and Use of uninitialized value in join or string at /usr/share/sympa/lib/Sympa/List.pm line 4858.
I have come up with a solution to the problem of message Use of uninitialized value in regexp compilation at /usr/share/sympa/lib/Sympa/List.pm line 5194, <GEN2> line 103.
It seems related not with the presence but with the position of some configuration elements in the config.tt2
file. For exemple, changing this paragraph:
[% FOREACH o = owner %]
owner
email [% o.email %]
[% IF o.gecos -%]
gecos [% o.gecos %]
[% END %]
profile normal
visibility conceal
reception mail
[% END %]
to
[% FOREACH o = owner %]
owner
profile normal
visibility conceal
reception mail
email [% o.email %]
[% IF o.gecos -%]
gecos [% o.gecos %]
[% END %]
[% END %]
results in a instantiation process without this message. I feel like there seems to be some kind of problem in the sympa.pl file that expects them in a given position. The same happens to the editor paragraph, that had to be changed to:
[% IF editor %]
[% FOREACH e = editor %]
editor
reception mail
visibility conceal
email [% e.email %]
[% IF e.gecos -%]
gecos [% e.gecos %]
[% END %]
[% END %]
[% END %]
in order for it to work properly. I understand that this requirement to set some elements in a given position in the config.tt2
file is a bug that should be corrected. If it is not a bug and it is there by design, then it should be documented somewhere.
The template
[% FOREACH o = owner %]
owner
email [% o.email %]
[% IF o.gecos -%]
gecos [% o.gecos %]
[% END %]
profile normal
visibility conceal
reception mail
[% END %]
generates
owner
email luis@domain.com
gecos Luis
profile normal
visibility conceal
reception mail
...
That is, the newlines before [%
and after %]
aren't removed.
Instead, you'd be better to do:
[% FOREACH o = owner -%]
owner
email [% o.email %]
[% IF o.gecos -%]
gecos [% o.gecos %]
[% END -%]
profile normal
visibility conceal
reception mail
[% END -%]
The newlines before [%-
and after -%]
are removed.
Thank you very much, @ikedas, for your corrections to my tt2 file; they did the trick for the warnings related to line 5194 in file /usr/share/sympa/lib/Sympa/List.pm
Unfortunatelly there are still two other warnings that show up during family instantiation: Use of uninitialized value in subroutine entry at /usr/lib/sympa/bin/sympa.pl line 1746.
and Use of uninitialized value in join or string at /usr/share/sympa/lib/Sympa/List.pm line 4858.
Any idea where they can come from?
Best regards.
Hi @qosobrin ,
Did you correct template for editor
paragraph?
Hi @qosobrin , Did you correct template for
editor
paragraph?
Sure, I corrected both owner
and editor
paragraphs. I tried the new config.tt2
file by removing the previous family and reinstantiating a new one and warnings related to line 5194 in file /usr/share/sympa/lib/Sympa/List.pm
all disappeared but the two other that I mentioned in my previous entry are still there.
Thank you very much. Best regards.
What are the contents of /usr/lib/sympa/bin/sympa.pl line 1746 and /usr/share/sympa/lib/Sympa/List.pm line 4858 ?
/usr/lib/sympa/bin/sympa.pl
1715 ## listname
1716 my @children = $list_elt->getChildrenByTagName('listname');
1717
1718 if ($#children < 0) {
1719 $log->syslog(
1720 'err',
1721 '"listname" element is required in "list" element, line: %s',
1722 $list_elt->line_number()
1723 );
1724 return undef;
1725 }
1726 if ($#children > 0) {
1727 my @error;
1728 foreach my $i (@children) {
1729 push(@error, $i->line_number());
1730 }
1731 $log->syslog(
1732 'err',
1733 'Only one "listname" element is allowed for "list" element, lines: %s',
1734 join(", ", @error)
1735 );
1736 return undef;
1737 }
1738 my $listname_elt = shift @children;
1739 my $listname = $listname_elt->textContent();
1740 $listname =~ s/^\s*//;
1741 $listname =~ s/\s*$//;
1742 $listname = lc $listname;
1743 my $filename = $listname . ".xml";
1744
1745 ## creating list XML document
1746 my $list_doc =
1747 XML::LibXML::Document->createDocument($doc->version(),
1748 $doc->encoding());
1749 $list_doc->setDocumentElement($list_elt);
1750
1751 ## creating the list xml file
1752 unless ($list_doc->toFile("$family->{'dir'}/$filename", 0)) {
1753 $log->syslog(
1754 'err',
1755 'Cannot create list file %s',
1756 $family->{'dir'} . '/' . $filename,
1757 $list_elt->line_number()
1758 );
1759 return undef;
1760 }
1761
1762 push @list_to_generate, $listname;
1763 }
1764 return [@list_to_generate];
1765 }
1766
1767 __END__
/usr/share/sympa/lib/Sympa/List.pm
4820 } elsif (ref($pinfo->{$key}{'file_format'}) eq 'HASH') {
4821 $fd->print(sprintf "%s\n", $key);
4822 foreach my $k (keys %{$p}) {
4823
4824 if (defined($pinfo->{$key}{'file_format'}{$k}{'scenario'})) {
4825 ## Skip if empty value
4826 next
4827 unless defined $p->{$k}{'name'}
4828 and $p->{$k}{'name'} =~ /\S/;
4829
4830 $fd->print(sprintf "%s %s\n", $k, $p->{$k}{'name'});
4831
4832 } elsif (($pinfo->{$key}{'file_format'}{$k}{'occurrence'} =~ /n$/)
4833 && $pinfo->{$key}{'file_format'}{$k}{'split_char'}) {
4834 next unless $p->{$k} and @{$p->{$k}};
4835
4836 $fd->print(
4837 sprintf "%s %s\n",
4838 $k,
4839 join(
4840 $pinfo->{$key}{'file_format'}{$k}{'split_char'},
4841 @{$p->{$k}}
4842 )
4843 );
4844 } else {
4845 ## Skip if empty value
4846 next unless defined $p->{$k} and $p->{$k} =~ /\S/;
4847
4848 $fd->print(sprintf "%s %s\n", $k, $p->{$k});
4849 }
4850 }
4851 $fd->print("\n");
4852
4853 } else {
4854 if (($pinfo->{$key}{'occurrence'} =~ /n$/)
4855 && $pinfo->{$key}{'split_char'}) {
4856 ### " avant de debugger do_edit_list qui crée des nouvelles
4857 ### entrées vides
4858 my $string = join($pinfo->{$key}{'split_char'}, @{$p});
4859 $string =~ s/\,\s*$//;
4860
4861 $fd->print(sprintf "%s %s\n\n", $key, $string);
4862 } elsif ($key eq 'digest') {
4863 my $value = sprintf '%s %d:%d', join(',', @{$p->{'days'}}),
4864 $p->{'hour'}, $p->{'minute'};
4865 $fd->print(sprintf "%s %s\n\n", $key, $value);
4866 } else {
4867 $fd->print(sprintf "%s %s\n\n", $key, $p);
4868 }
4869 }
4870
4871 return 1;
4872 }
I added the line numbers for your convenience and some more lines for context. Should you need me to post the whole files, please, let me know.
Thank you very much. Best regards.
These codes have been almost entirely rewritten in recent versions. If you have upgraded to a more recent version of Sympa and still get the same warnings, please submit a new bug report.
No, I am running the Debian packaged Sympa, so I will have to wait until a new Debian comes out. If there is not solution available then you can close the issue.
Thank you very much for your prompt answers and all your help.
Best regards.
With Debian package, recent versions are available. https://packages.debian.org/en/bookworm/sympa
Also in bullseye-backports.
Thank to both of you, @ikedas and @racke This is a production server with 175+ lists and some other software running on it that needs time to be moved to a new version.
Best regards.
Version
6.2.20
Installation method
Debian Package
Expected behavior
Family instantiation should not cause any error or warning. A clean output is expected
Actual behavior
Family instantiation generates a number of warnings even though the family is correctly instantiated.
Steps to reproduce
I instantiate my family with this command:
/usr/lib/sympa/bin/sympa.pl --instantiate_family titulaciones --robot example.domain.com --input_file /etc/sympa/example.domain.com/families/titulaciones/titulaciones.xml
Additional information
This is the output of the instantiation of the family:
This is the sympa.log for this execution:
These are the files used for the configuration of the list family.
config.tt2
edit_list.conf
info.tt2
param_constraint.conf
titulaciones.xml