Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 518522 - dev-db/postgresql-server with dev-lang/perl-5.18.2-r1 - broken plperl functions
Summary: dev-db/postgresql-server with dev-lang/perl-5.18.2-r1 - broken plperl functions
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Server (show other bugs)
Hardware: All Linux
: Normal normal
Assignee: PgSQL Bugs
URL: http://www.postgresql.org/message-id/...
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-07-29 18:54 UTC by Chris Mayo
Modified: 2024-09-04 04:08 UTC (History)
2 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Chris Mayo 2014-07-29 18:54:31 UTC
Is discussed on pgsql-general:
http://www.postgresql.org/message-id/CAFaPBrSvM_hsNVWRezucJMCCaJzAQg2f-TfzYh8VacihqrgFHQ@mail.gmail.com

Simple test query from the above link:
do $$ "\N{U+263A}" =~ /[[:punct:]]/$$ language plperl;

Results in:
ERROR:  Unable to load utf8.pm into plperl at line 1.
BEGIN failed--compilation aborted.

A workaround is to change the function language from plperl to the untrusted plperlu.
Comment 1 Andreas K. Hüttel archtester gentoo-dev 2014-09-10 19:36:44 UTC
http://dba.stackexchange.com/questions/65268/how-can-i-load-utf8-into-plperl-by-default

The quoted URL has a workaround, could you please check if that helps?

plperl.on_init = 'use utf8; use re; package utf8; require "utf8_heavy.pl";'
Comment 2 Chris Mayo 2014-09-11 16:25:09 UTC
Seems to be working OK after adding to /etc/postgresql-9.3/postgresql.conf:
plperl.on_init = 'use utf8; use re; package utf8; require "utf8_heavy.pl";'
Comment 3 Andreas K. Hüttel archtester gentoo-dev 2014-09-12 21:19:14 UTC
(In reply to Chris Mayo from comment #2)
> Seems to be working OK after adding to /etc/postgresql-9.3/postgresql.conf:
> plperl.on_init = 'use utf8; use re; package utf8; require "utf8_heavy.pl";'

OK. Keeping this bug open, but it isnt blocking Perl 5.18 anymore.
Comment 4 Aaron W. Swenson gentoo-dev 2014-12-04 11:33:13 UTC
I have this fixed in my overlay. The ebuild appends the workaround.
Comment 5 Aaron W. Swenson gentoo-dev 2014-12-28 18:12:24 UTC
Fixed, but only new installs will have the workaround appended.
Comment 6 Pascal Jufer 2015-02-12 18:05:14 UTC
This additional parameter should only be applied if PostgreSQL is installed with the perl USE flag. Otherwise the parameter isn't recognized and starting the server will fail with the following error:

 * Caching service dependencies ...                                                                     
 * /run/postgresql: creating directory
 * /run/postgresql: correcting owner
 * Starting PostgreSQL ...
FATAL:  unrecognized configuration parameter "plperl.on_init"
 * start-stop-daemon: failed to start `/usr/lib64/postgresql-9.1/bin/postgres'
 * Check the log for a possible explanation of the above error. The log may be
 *     /var/lib/postgresql/9.1/data/postmaster.log
 * Or wherever you configured PostgreSQL 9.1 log messages to be sent.                                   
 * ERROR: postgresql-9.1 failed to start
 These settings are initialized by initdb, but they can be changed.
Comment 7 devsk 2015-02-16 05:03:15 UTC
Running into this issue that Pascal ran into with 9.1 as well. No perl in this setup.
Comment 8 Larry the Git Cow gentoo-dev 2024-05-11 02:36:48 UTC
The bug has been referenced in the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=433856b93366defbd2ef42e55bf474c6d7f25ecf

commit 433856b93366defbd2ef42e55bf474c6d7f25ecf
Author:     Sam James <sam@gentoo.org>
AuthorDate: 2024-05-11 02:32:01 +0000
Commit:     Sam James <sam@gentoo.org>
CommitDate: 2024-05-11 02:32:01 +0000

    dev-db/postgresql: drop old Perl workaround
    
    The code being removed here can't work with modern Perl:
    ```
    $ perl -e 'use utf8; use re; package utf8; require "utf8_heavy.pl";';
    Can't locate utf8_heavy.pl in @INC (@INC entries checked: /etc/perl /usr/local/lib64/perl5/5.38/x86_64-linux /usr/local/lib64/perl5/5.38 /usr/lib64/perl5/vendor_perl/5.38/x86_64-linux /usr/lib64/perl5/vendor_perl/5.38 /usr/lib64/perl5/5.38/x86_64-linux /usr/lib64/perl5/5.38) at -e line 1.
    ```
    
    The original reporter of the bug it was added for (bug #518522) was Chris Mayo
    who can't reproduce the original problem. Given it now actively causes an issue,
    let's drop it, and not worry about replacing it with something else right now -
    it's unclear anything is needed now.
    
    This still leaves pollution in postgresql.conf - which I leave to the pgsql
    maintainers to resolve, but at least we're not adding it for new installs now.
    
    Note that it's likely https://bugs.gentoo.org/518522#c6 was still an issue
    and this will be resolved now too.
    
    Bug: https://bugs.gentoo.org/518522
    Bug: https://bugs.gentoo.org/792537
    Signed-off-by: Sam James <sam@gentoo.org>

 dev-db/postgresql/postgresql-12.18.ebuild    | 7 -------
 dev-db/postgresql/postgresql-12.19-r1.ebuild | 7 -------
 dev-db/postgresql/postgresql-13.14.ebuild    | 7 -------
 dev-db/postgresql/postgresql-13.15-r1.ebuild | 7 -------
 dev-db/postgresql/postgresql-14.11.ebuild    | 7 -------
 dev-db/postgresql/postgresql-14.12-r1.ebuild | 7 -------
 dev-db/postgresql/postgresql-15.6.ebuild     | 7 -------
 dev-db/postgresql/postgresql-15.7-r1.ebuild  | 7 -------
 dev-db/postgresql/postgresql-16.2.ebuild     | 7 -------
 dev-db/postgresql/postgresql-16.3-r1.ebuild  | 7 -------
 dev-db/postgresql/postgresql-9999.ebuild     | 7 -------
 11 files changed, 77 deletions(-)
Comment 9 John L. Poole 2024-09-04 03:52:34 UTC
I was about to log a bug because my attempt to install the Perl extension kept failing, on several servers.  I found this bug and others and share the following:

The postgresql.conf last line has:

822  plperl.on_init = 'use utf8; use re; package utf8; require "utf8_heavy.pl";'

I modified it (since I read that utf8_heavy.pl was dropped in an earlier version of Perl; also using "require" is an indicator of older Perl code) to:

plperl.on_init = 'use utf8; use re; package utf8;'

I removed the " require "utf8_heavy.pl";" portion.

What happens is in psql, if you try to create the perl extension:

postgres=# create extension plperl;
ERROR:
CONTEXT:  while running Perl initialization
postgres=# 

The postgresql log at /var/lib/postgresql/16/data/postmaster.log revealed:

2024-09-03 20:06:12.441 PDT [12677] LOG:  database system is ready to accept connections
Can't locate utf8_heavy.pl in @INC (@INC entries checked: /etc/perl /usr/local/lib64/perl5/5.40/x86_64-linux /usr/local/lib64/perl5/5.40 /usr/lib64/perl5/vendor_perl/5.40/x86_64-linux /usr/lib64/perl5/vendor_perl/5.40 /usr/lib64/perl5/5.40/x86_64-linux /usr/lib64/perl5/5.40 /usr/lib64/perl5/5.38 /usr/lib64/perl5/vendor_perl/5.38) at -e line 102.
2024-09-03 20:06:31.595 PDT [12695] ERROR:
2024-09-03 20:06:31.595 PDT [12695] CONTEXT:  while running Perl initialization
2024-09-03 20:06:31.595 PDT [12695] STATEMENT:  create extension plperl;

After removing the "heavy" require statement, I bounced postgres and successfully created the Perl extension.

Therefore, I recommend 
1) this bug be re-opened, and 
2) that the following characters be removed from the configuration file:

 require "utf8_heavy.pl";
Comment 10 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2024-09-04 04:08:41 UTC
That's bug 931701.