Bug 1855963 - Safe in Perl 5.30 does not preload utf8_heavy.pl preventing from running Bugzilla checksetup.pl script: Undefined subroutine utf8::SWASHNEW
Summary: Safe in Perl 5.30 does not preload utf8_heavy.pl preventing from running Bugz...
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Fedora
Classification: Fedora
Component: perl
Version: 31
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Petr Pisar
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2020-07-11 10:36 UTC by Sjoerd Mullender
Modified: 2020-08-18 01:37 UTC (History)
11 users (show)

Fixed In Version: perl-5.30.3-455.fc32 perl-5.30.3-454.fc31 perl-5.30-3120200803114857.a9ea5770 perl-5.30-3220200803114857.35f641a4
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2020-07-16 01:14:35 UTC
Type: Bug


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Github Perl perl5 issues 17271 0 None open Safe.pm 2020-07-11 10:36:29 UTC
Mozilla Foundation 1588175 0 -- RESOLVED Undefined subroutine utf8::SWASHNEW called at Bugzilla/Util.pm line 109. 2020-07-11 10:36:29 UTC

Description Sjoerd Mullender 2020-07-11 10:36:30 UTC
Description of problem:
See bugs https://bugzilla.mozilla.org/show_bug.cgi?id=1588175 for a description of the bugzilla side of things, and see https://github.com/Perl/perl5/issues/17271 for the perl side of things.

The problem is, when running checksetup.pl, perl at some point complains about Undefined subroutine utf8::SWASHNEW.  It seems that perl needs to pre-load this function in Safe.pm, but the way it attempts to do so is outdated.

Version-Release number of selected component (if applicable):
perl-interpreter-5.30.3-452.fc31.x86_64
perl-interpreter-5.30.3-453.fc32.x86_64

Since the perl bug report says the bug has been fixes, I assume there is a newer version available.  Otherwise the simple patch described in the perl bug report should be applied.

How reproducible:


Steps to Reproduce:
1. install and configure a minimal bugzilla (in a VM)
2. cd /usr/share/Bugzilla
3. ./checksetup.pl

Actual results:
Error message about Undefined subroutine utf8::SWASHNEW

Expected results:
No such error.

Additional info:

Comment 1 Petr Pisar 2020-07-13 08:41:49 UTC
The Perl bug is still open and the fix was not merged into Perl sources. Bugzilla bug is closed.
Can you please provide a minimal Perl reproducer that does not involve installing Bugzilla?

Comment 2 Sjoerd Mullender 2020-07-13 09:14:55 UTC
I can't provide a reproducer.  I haven't done any serious Perl programming since about 1988 and have no intention of starting now.
A simple google search on utf8::SWASHNEW shows quite a few instances of this problem, but they all involve checksetup.pl in bugzilla.

Comment 3 Petr Pisar 2020-07-13 11:03:05 UTC
I managed to minimize it; main.pl:

#!/usr/bin/perl
BEGIN {
    require Safe;
    Safe->new;
}
tr/\x{100}//;

$ perl main.pl 
Undefined subroutine utf8::SWASHNEW called at main.pl line 6.

It happens when a tr/// with a 255-above code point is compiled after creating a Safe object. (Bugzilla checksetup.pl has "new Safe" in Bugzilla::Install::Util::_get_string_from_file() and tr/// in Bugzilla::Util.)

In my opinion it's an unintended effect of the Safe implementation. Safe should affect only a code ($unsafe_code) compiled (reval()) inside a Safe object ($compartment) as read in the documentation:

      use Safe;
      $compartment = new Safe;
      $compartment->permit(qw(time sort :browse));
      $result = $compartment->reval($unsafe_code);

Comment 4 Petr Pisar 2020-07-13 11:14:01 UTC
perl-libs-5.30.3-452.fc31 is affected.
perl-libs-5.32.0-456.fc33 is not affected, because utf8_heavy.pl whose loading is prevented by Safe was removed in perl 5.31.6 and is not loaded anymore. That's probably the reason why Perl upstream has never fixed it.

Comment 5 Fedora Update System 2020-07-13 13:44:17 UTC
FEDORA-2020-59f945f4be has been submitted as an update to Fedora 32. https://bodhi.fedoraproject.org/updates/FEDORA-2020-59f945f4be

Comment 6 Fedora Update System 2020-07-13 13:44:27 UTC
FEDORA-2020-54c4dc151a has been submitted as an update to Fedora 31. https://bodhi.fedoraproject.org/updates/FEDORA-2020-54c4dc151a

Comment 7 Fedora Update System 2020-07-14 01:07:20 UTC
FEDORA-2020-59f945f4be has been pushed to the Fedora 32 testing repository.
In short time you'll be able to install the update with the following command:
`sudo dnf upgrade --enablerepo=updates-testing --advisory=FEDORA-2020-59f945f4be`
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2020-59f945f4be

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

Comment 8 Fedora Update System 2020-07-14 01:09:11 UTC
FEDORA-2020-54c4dc151a has been pushed to the Fedora 31 testing repository.
In short time you'll be able to install the update with the following command:
`sudo dnf upgrade --enablerepo=updates-testing --advisory=FEDORA-2020-54c4dc151a`
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2020-54c4dc151a

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

Comment 9 Fedora Update System 2020-07-16 01:14:35 UTC
FEDORA-2020-59f945f4be has been pushed to the Fedora 32 stable repository.
If problem still persists, please make note of it in this bug report.

Comment 10 Fedora Update System 2020-07-28 15:01:22 UTC
FEDORA-2020-54c4dc151a has been pushed to the Fedora 31 stable repository.
If problem still persists, please make note of it in this bug report.

Comment 11 Fedora Update System 2020-08-04 07:49:50 UTC
FEDORA-MODULAR-2020-bfc9507514 has been submitted as an update to Fedora 32 Modular. https://bodhi.fedoraproject.org/updates/FEDORA-MODULAR-2020-bfc9507514

Comment 12 Fedora Update System 2020-08-04 07:51:54 UTC
FEDORA-MODULAR-2020-b67d5de786 has been submitted as an update to Fedora 31 Modular. https://bodhi.fedoraproject.org/updates/FEDORA-MODULAR-2020-b67d5de786

Comment 13 Fedora Update System 2020-08-05 02:14:01 UTC
FEDORA-MODULAR-2020-bfc9507514 has been pushed to the Fedora 32 Modular testing repository.

You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-MODULAR-2020-bfc9507514

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

Comment 14 Fedora Update System 2020-08-05 02:21:51 UTC
FEDORA-MODULAR-2020-b67d5de786 has been pushed to the Fedora 31 Modular testing repository.

You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-MODULAR-2020-b67d5de786

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

Comment 15 Fedora Update System 2020-08-18 01:30:31 UTC
FEDORA-MODULAR-2020-b67d5de786 has been pushed to the Fedora 31 Modular stable repository.
If problem still persists, please make note of it in this bug report.

Comment 16 Fedora Update System 2020-08-18 01:37:16 UTC
FEDORA-MODULAR-2020-bfc9507514 has been pushed to the Fedora 32 Modular stable repository.
If problem still persists, please make note of it in this bug report.


Note You need to log in before you can comment on or make changes to this bug.