Skip to content

BBC: Blead Breaks Text::Capitalize #24266

Description

@cjg-cguevara

This is a bug report for perl from "Carlos Guevara" carlos@carlosguevara.com,
generated with the help of perlbug 1.43 running under perl 5.43.9.


BBC: Blead Breaks Text::Capitalize

Please see https://fast2-matrix.cpantesters.org/?dist=Text-Capitalize-1.5


Flags

  • category=core
  • severity=low

Perl configuration

Site configuration information for perl 5.43.9:

Configured by cpan at Thu Mar 12 14:07:48 EDT 2026.

Summary of my perl5 (revision 5 version 43 subversion 9) configuration:
  Commit id: 3a8b14eb835bd4a1b2e2ff60bbbc09a7dd782d9b
  Platform:
    osname=linux
    osvers=6.12.0-124.43.1.el10_1.x86_64
    archname=x86_64-linux-thread-multi
    uname='linux cjg-rhel10 6.12.0-124.43.1.el10_1.x86_64 #1 smp preempt_dynamic tue mar 3 19:10:08 est 2026 x86_64 gnulinux '
    config_args='-des -Dprefix=/home/cpan/bin/perl -Dscriptdir=/home/cpan/bin/perl/bin -Dusedevel -Duse64bitall -Duseithreads'
    hint=recommended
    useposix=true
    d_sigaction=define
    useithreads=define
    usemultiplicity=define
    use64bitint=define
    use64bitall=define
    uselongdouble=undef
    usemymalloc=n
    default_inc_excludes_dot=define
  Compiler:
    cc='cc'
    ccflags ='-D_REENTRANT -D_GNU_SOURCE -fwrapv -fno-strict-aliasing -pipe -fstack-protector-strong -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -D_FORTIFY_SOURCE=2'
    optimize='-O2'
    cppflags='-D_REENTRANT -D_GNU_SOURCE -fwrapv -fno-strict-aliasing -pipe -fstack-protector-strong -I/usr/local/include'
    ccversion=''
    gccversion='14.3.1 20250617 (Red Hat 14.3.1-2)'
    gccosandvers=''
    intsize=4
    longsize=8
    ptrsize=8
    doublesize=8
    byteorder=12345678
    doublekind=3
    d_longlong=define
    longlongsize=8
    d_longdbl=define
    longdblsize=16
    longdblkind=3
    ivtype='long'
    ivsize=8
    nvtype='double'
    nvsize=8
    Off_t='off_t'
    lseeksize=8
    alignbytes=8
    prototype=define
  Linker and Libraries:
    ld='cc'
    ldflags =' -fstack-protector-strong -L/usr/local/lib'
    libpth=/usr/local/lib /usr/lib /usr/lib64 /usr/local/lib64
    libs=-lpthread -ldb -ldl -lm -lcrypt -lutil -lc
    perllibs=-lpthread -ldl -lm -lcrypt -lutil -lc
    libc=/lib/../lib64/libc.so.6
    so=so
    useshrplib=false
    libperl=libperl.a
    gnulibc_version='2.39'
  Dynamic Linking:
    dlsrc=dl_dlopen.xs
    dlext=so
    d_dlsymun=undef
    ccdlflags='-Wl,-E'
    cccdlflags='-fPIC'
    lddlflags='-shared -O2 -L/usr/local/lib -fstack-protector-strong'


---
@INC for perl 5.43.9:
    /home/cpan/bin/perl/lib/site_perl/5.43.9/x86_64-linux-thread-multi
    /home/cpan/bin/perl/lib/site_perl/5.43.9
    /home/cpan/bin/perl/lib/5.43.9/x86_64-linux-thread-multi
    /home/cpan/bin/perl/lib/5.43.9

---
Environment for perl 5.43.9:
    HOME=/home/cpan
    LANG=en_US.UTF-8
    LANGUAGE (unset)
    LC_ALL=C
    LD_LIBRARY_PATH (unset)
    LOGDIR (unset)
    PATH=/home/cpan/bin/perl/bin:/home/cpan/bin:/usr/local/bin:/usr/bin:/usr/local/sbin:/usr/sbin
    PERL_BADLANG (unset)
    SHELL=/bin/bash

Activity

  1. jkeenan commented on Mar 12, 2026

    @jkeenan
    Contributor

    Bisection points to this recent commit (b3f68b4):

    commit b3f68b479c9876437620503fb7d54e14bceadcee
    Author:     Richard Leach <rich+perl@hyphen-dash-hyphen.info>
    AuthorDate: Thu Feb 5 00:01:10 2026 +0000
    Commit:     Richard Leach <rich+perl@hyphen-dash-hyphen.info>
    CommitDate: Tue Mar 10 23:46:51 2026 +0000
    
        Convert OP_CONST hash keys in key+val lists to HEKs
    ...
    

    @richardleach, can you take a look? Thanks.

  2. added
    BBCBlead Breaks CPAN - changes in blead broke a cpan module(s)
    and removed on Mar 12, 2026
  3. self-assigned this
    on Mar 13, 2026
  4. richardleach commented on Mar 14, 2026

    @richardleach
    Contributor

    Thanks for the bisect, @jkeenan

    use utf8 is active in the failing test files but the hash keys involved in the test failures can be downgraded to non-utf8 strings.

    At first glance, I think the problem is a flags mismatch somewhere. Possibly because Perl_newSVpvn_share seems not to set the HVhek_WASUTF8 flag.

  5. richardleach commented on Mar 15, 2026

    @richardleach
    Contributor

    At first glance, I think the problem is a flags mismatch somewhere. Possibly because Perl_newSVpvn_share seems not to set the HVhek_WASUTF8 flag.

    Perl_newSVpvn_share can be tweaked to ensure the HVhek_WASUTF8 flag is set on the HEK, but then when the hash key is inserted, Perl_hv_common seems to not bother checking for HVhek_WASUTF8 when builiding flags inside is (keysv). That can also be tweaked, but then the flag still seems to be lost somewhere else.

    I'll look some more tomorrow.

    This close to the stable release, it might be best to restrict the optimization to non-UTF8 keys, with any seemingly-suitable PR for greater propagation of HVhek_WASUTF8 waiting until the next dev cycle.

  6. richardleach commented on Mar 15, 2026

    @richardleach
    Contributor

    Text::Capitalize test failures are to do with hash initialization like the following, with keys here being affected by b3f68b4:

      my %expect_capitalize_title_PRESERVE_ALLCAPS_PRESERVE_WHITESPACE = (
    ...
         'über maus' =>
            'Über Maus',
    ...
      );
    

    but it looks like the following hash insertion (not tested in Text::Capitalize) was already buggy, for the same HVhek_WASUTF8 reasons, prior to that commit:

        my %expect_capitalize_title_PRESERVE_ALLCAPS_PRESERVE_WHITESPACE;
        $expect_capitalize_title_PRESERVE_ALLCAPS_PRESERVE_WHITESPACE{'über maus' } =  'Über Maus';
    

    In both cases, the expected capitalized string is Über Maus but the string returned is üBer Maus.

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

Metadata

Metadata

Assignees

Labels

BBCBlead Breaks CPAN - changes in blead broke a cpan module(s)Release Blocker

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions