Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deep recursion when creating objects for specific regions #41

Closed
bschmalhofer opened this issue Dec 1, 2023 · 4 comments
Closed

Deep recursion when creating objects for specific regions #41

bschmalhofer opened this issue Dec 1, 2023 · 4 comments

Comments

@bschmalhofer
Copy link

I added translation of country names to a web application using Locale::CLDR. Testing with BV, Bouvet Island, caused high processor load on the web server.

This can be reproduced with a simple script.

$ perl bouvet.pl 
Deep recursion on subroutine "Locale::CLDR::new" at /usr/local/share/perl/5.34.0/Locale/CLDR.pm line 1456.
Deep recursion on subroutine "Locale::CLDR::BUILD" at (eval 444) line 1520.
Deep recursion on anonymous subroutine at (eval 425) line 16.

The debugger shows that the recursion occurs when the likely subtags are determined. I suppose that an infinite loop is entered because of some specific likely subtags.

$ grep -r "=> 'und_" local/lib/perl5/Locale/CLDR/LikelySubtags.pm 
		'und_AQ'	=> 'und_Latn_AQ',
		'und_BV'	=> 'und_Latn_BV',
		'und_CP'	=> 'und_Latn_CP',
		'und_GS'	=> 'und_Latn_GS',
		'und_HM'	=> 'und_Latn_HM',

The regions AQ, BV, CP, GS, and HM all show the deep recursion.

bouvet.pl.txt

@ThePilgrim
Copy link
Owner

Thank you for your bug report, I hadn't considered recursion with likely subtags. I'll take a look as soon as I can.

@ThePilgrim
Copy link
Owner

ThePilgrim commented Dec 2, 2023

I'm generating a development version of 0.34.4
I'll add a note here once it's uploaded to CPAN
New version uploaded to CPAN

@bschmalhofer
Copy link
Author

Thanks @ThePilgrim , I will test https://metacpan.org/release/JGNI/Locale-CLDR-v0.34.4-TRIAL1 on the weekend.

@bschmalhofer
Copy link
Author

Hi @ThePilgrim,

I tested the web app with Locale::CLDR 0.34.4 and the translation of country names worked fine. Thanks for fixing this bug!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants