Bug 28838

Summary: locale issue with cacti perl script
Product: Mageia Reporter: Yann Ciret <mageia>
Component: RPM PackagesAssignee: Mageia Bug Squad <bugsquad>
Status: UPSTREAM --- QA Contact:
Severity: major    
Priority: High CC: mageia, ouaurelien
Version: 8   
Target Milestone: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Source RPM: iputils-20200821-2.mga8.src.rpm CVE:
Status comment:

Description Yann Ciret 2021-04-26 00:51:21 CEST
My system is configured to use fr_FR.UTF-8 locale by default.

yann@localhost ~]$ locale
LANG=fr_FR.UTF-8
LC_CTYPE="fr_FR.UTF-8"
LC_NUMERIC="fr_FR.UTF-8"
LC_TIME="fr_FR.UTF-8"
LC_COLLATE="fr_FR.UTF-8"
LC_MONETARY="fr_FR.UTF-8"
LC_MESSAGES="fr_FR.UTF-8"
LC_PAPER="fr_FR.UTF-8"
LC_NAME="fr_FR.UTF-8"
LC_ADDRESS="fr_FR.UTF-8"
LC_TELEPHONE="fr_FR.UTF-8"
LC_MEASUREMENT="fr_FR.UTF-8"
LC_IDENTIFICATION="fr_FR.UTF-8"
LC_ALL=


On mageia 6 and 7, the ping.pl script provided by cacti works well:
[yann@localhost ~]$ perl /var/www/html/cacti/scripts/ping.pl localhost
0.059

But on mageia 8, it didn’t and always return U:
[yann@localhost ~]$ perl /var/www/html/cacti/scripts/ping.pl localhost
U

If I force the locale with LC_ALL=C in the bash CLI, script is working well:
[yann@localhost ~]$ LC_ALL=C perl /var/www/html/cacti/scripts/ping.pl localhost
0.031

It is like the line "$ENV{LANG}='en_US.UTF-8';" in the script is not taken into account.


For understand the issue, I made some modifications in ping.pl script…
Replace the line:
open(PROCESS, "$pingcmd 2>&1 | grep -E '(icmp_[s|r]eq.*time|unknown host|Unknown host|not supported|Name or service not known|No address associated with name)' 2>/dev/null |");

By the line:
open(PROCESS, "$pingcmd 2>&1 | grep -E '(icmp_[s|r]eq|unknown host|Unknown host|not supported|Name or service not known|No address associated with name)' 2>/dev/null |");

And just after line:
chomp($ping);

Add the line:
print "Test:".$ping."\n";


Then there is the new results:
[yann@localhost ~]$ LC_ALL=C perl /var/www/html/cacti/scripts/ping.pl localhost
Test:64 bytes from localhost (::1): icmp_seq=1 ttl=64 time=0.058 ms
0.058[yann@localhost ~]$ 
[yann@localhost ~]$ 
[yann@localhost ~]$ perl /var/www/html/cacti/scripts/ping.pl localhost
Test:64 octets de localhost (::1) : icmp_seq=1 ttl=64 temps=0.042 ms
U

In the second case, it is interesting to note this is "temps" and not "time" that is used in the result. And it explains why script always failed.

For me, this is a regression in Mageia 8.

Regards,
Yann
Yann Ciret 2021-04-26 00:52:10 CEST

CC: (none) => mageia

Comment 1 Aurelien Oudelet 2021-04-30 10:23:41 CEST
Hi, thanks reporting this.

Assigning to Perl Stack maintainer.

Assignee: bugsquad => perl
CC: (none) => ouaurelien

Comment 2 Yann Ciret 2021-05-18 01:14:19 CEST
Hello,

I update severity and priority because it is a blocker for my migration to latest mageia release.

thank you

Priority: Normal => High
Severity: normal => major

Comment 3 David Walser 2021-06-01 02:49:43 CEST
Sounds like it's an issue that needs to reported upstream to cacti.  We don't provide that in Mageia.
Comment 4 Yann Ciret 2021-06-03 00:33:08 CEST
Hello David,

I know cacti is not packaged for Mageia 8.
But before open a ticket to cacti part, I would like to understand what has changed in Perl between mageia 6 and 7 which worked and mageia 8 for which the script no longer works because of the locale.
Because I can see that in my cacti ticket, I will be told to open a Mageia ticket ;)
Comment 5 David Walser 2021-07-25 17:47:51 CEST
Could be an upstream change in perl or ping (iputils) that the script needs to adapt to (or possibly a bug in one of those).
Comment 6 Yann Ciret 2021-09-02 00:32:36 CEST
Hello,

it seems to be an iputils issue when IPv6 is disabled: https://github.com/iputils/iputils/issues/293
Comment 7 Yann Ciret 2021-10-23 00:07:48 CEST
A fix was published:
https://github.com/iputils/iputils/commit/79d713eab6181e219bf932b404706f6f59ff2539

Please include it in current Mageia 8.

Source RPM: perl-5.32.1-1.mga8.src.rpm => iputils-20200821-2.mga8.src.rpm
Status: NEW => UPSTREAM

Yann Ciret 2021-10-23 00:09:19 CEST

Assignee: perl => bugsquad