Skip to content

t/run/locale.t: uninitialized value warnings on OpenBSD #23268

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

Open
wants to merge 1 commit into
base: blead
Choose a base branch
from

Conversation

jkeenan
Copy link
Contributor

@jkeenan jkeenan commented May 7, 2025

In the course of testing #23265 on OpenBSD-6.9, I observed previously unnoticed uninitialized value warnings.

Use of uninitialized value $locale in concatenation (.) or string at run/locale.t line 618.
Use of uninitialized value $locale in concatenation (.) or string at run/locale.t line 641.

See, e.g., https://perl.develop-help.com/dblog/5511983.

These warnings began to appear in my own OpenBSD smoke-test logs in early March. In all likelihood these warnings began to be emitted following this commit:

commit fecfa476ebefab8d99c628450d82a8b28a2fff42
Author:     Karl Williamson <[email protected]>
AuthorDate: Thu Jan 30 18:09:27 2025 -0700
Commit:     Karl Williamson <[email protected]>
CommitDate: Sun Feb 9 16:36:20 2025 -0700

    run/locale.t: Add test for UTF-8 string non-UTF8 locale
    
    This was suggested by Tony Cook at
    https://github.com/Perl/perl5/pull/22811#discussion_r1868633416

... as that commit contained 4 instances of:

+    my $locale = $non_utf8_locales[0];

... which were not checked for definedness before being used.

The branch in this pull request guarantees that $locale is initialized to an empty string if not otherwise defined. Please review.

There were cases discovered during smoke-testing on OpenBSD since
fecfa47 was committed in February 2025 where
$locale was undefined and emitting a runtime warning.
@jkeenan jkeenan force-pushed the smoke-me/jkeenan/run-locale-uninit-20250507 branch from 704caf3 to c30411f Compare May 7, 2025 23:36
@jkeenan
Copy link
Contributor Author

jkeenan commented May 8, 2025

@khwilliamson can you take a look at this p.r.? Thanks.

@khwilliamson
Copy link
Contributor

It appears to me that the bug is more fundamental than this. Those entries should be defined; I would need to experiment on an OpenBSD system to figure it out.

@afresh1
Copy link
Contributor

afresh1 commented May 9, 2025

@khwilliamson : I can probably get you access to an OpenBSD machine if you need. I'm away this weekend, but we can figure something out next week.

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

Successfully merging this pull request may close these issues.

3 participants