Bug 2240458

Summary: Perl 5.38 breaks Irssi locale
Product: [Fedora] Fedora Reporter: Marcin Juszkiewicz <mjuszkie>
Component: perlAssignee: Jitka Plesnikova <jplesnik>
Status: CLOSED ERRATA QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 39CC: iarnell, jplesnik, kasal, kkretschmer, mfabian, mmaslano, mspacek, perl-devel, ppisar, psabata, rhughes, spotrh
Target Milestone: ---   
Target Release: ---   
Hardware: x86_64   
OS: Linux   
URL: https://github.com/irssi/scripts.irssi.org/issues/857
Whiteboard:
Fixed In Version: perl-5.38.0-501.fc39 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2023-11-03 18:26:42 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Marcin Juszkiewicz 2023-09-24 15:40:26 UTC
After upgrade to Fedora 39 beta one of scripts in irssi (irc client) broke. After checking what is going on (I do not know Perl) I found out that length of string was reported with negative sign.

Opened a ticket at Irssi github account https://github.com/irssi/scripts.irssi.org/issues/857 and went through debugging a bit.

Turned out that Perl 5.38 drops locale settings when embedded in C. There is a bug for it already: https://github.com/Perl/perl5/issues/21366


I do not know which solution should be taken to make it work properly. For irssi script I have hacky workaround. But would be nice to not have such bug on release of new Fedora version.

Reproducible: Always

Steps to Reproduce:
1. set locale to any UTF-8 one (I use pl_PL.UTF-8)
2. run irssi
3. run "/script exec print Text::CharWidth::mbswidth("─")" command

Actual Results:  
Should return "1"

Expected Results:  
Returns "-1"

irssi-1.4.4-5.fc39.x86_64
perl-5.38.0-500.fc39.x86_64

Comment 1 Jitka Plesnikova 2023-09-25 13:05:08 UTC
Thank you for report. 

The bug is fixed in perl development version and it is requested to be included in perl-5.38.1.

There was lots of changes in 'locale.c'.
I will check how to backported it to Perl 5.38.

Comment 2 Marcin Juszkiewicz 2023-09-25 13:23:12 UTC
Fedora 39 is not released yet, why not bump to 5.38.1 instead of backporting?

Comment 3 Petr Pisar 2023-09-25 14:29:29 UTC
Because 5.38.1 does not exist yet:

$ git branch -a |grep origin/maint-5\\. 
  remotes/origin/maint-5.004
  remotes/origin/maint-5.005
  remotes/origin/maint-5.10
  remotes/origin/maint-5.12
  remotes/origin/maint-5.14
  remotes/origin/maint-5.16
  remotes/origin/maint-5.18
  remotes/origin/maint-5.20
  remotes/origin/maint-5.20-votes
  remotes/origin/maint-5.22
  remotes/origin/maint-5.24
  remotes/origin/maint-5.26
  remotes/origin/maint-5.28
  remotes/origin/maint-5.28-sep18
  remotes/origin/maint-5.30
  remotes/origin/maint-5.32
  remotes/origin/maint-5.34
  remotes/origin/maint-5.36
  remotes/origin/maint-5.6
  remotes/origin/maint-5.8

Comment 4 Jitka Plesnikova 2023-09-26 07:10:48 UTC
It seems that reverting patch mention in comment [1] should be used as workaround. I tried it and irssi which I rebuilt with this perl worked as expected.

[1] https://github.com/Perl/perl5/issues/21366#issuecomment-1732560904

Comment 5 Fedora Update System 2023-10-02 08:08:22 UTC
FEDORA-2023-b182207d72 has been submitted as an update to Fedora 39. https://bodhi.fedoraproject.org/updates/FEDORA-2023-b182207d72

Comment 6 Fedora Update System 2023-10-03 03:40:01 UTC
FEDORA-2023-b182207d72 has been pushed to the Fedora 39 testing repository.
Soon you'll be able to install the update with the following command:
`sudo dnf upgrade --enablerepo=updates-testing --refresh --advisory=FEDORA-2023-b182207d72`
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2023-b182207d72

See also https://fedoraproject.org/wiki/QA:Updates_Testing for more information on how to test updates.

Comment 7 Dennis Brendel 2023-10-06 06:25:54 UTC
*** Bug 2241148 has been marked as a duplicate of this bug. ***

Comment 8 Dennis Brendel 2023-10-06 06:28:37 UTC
*** Bug 2240460 has been marked as a duplicate of this bug. ***

Comment 9 Fedora Update System 2023-11-03 18:26:42 UTC
FEDORA-2023-b182207d72 has been pushed to the Fedora 39 stable repository.
If problem still persists, please make note of it in this bug report.