Giter Club home page Giter Club logo

Comments (10)

mauke avatar mauke commented on August 28, 2024 1

OK, I'm confused.

U32uf used to be defined entirely in perl.h (based on preprocessor heuristics). These tests were moved to Configure in commit a503b74 (in 2022), which was first released with perl 5.38.0. Now U32uf is defined in config.h based on the value of the shell variable u32uformat (as recorded in config.sh).

However, in your case this variable doesn't exist (which makes no sense) and so the macro expands to nothing (which is bad because it breaks all format strings the macro is used in).

Another anomaly is that your config.sh contains definitions for ansi2knr and d_bcmp. The last traces of these symbols were removed in commits c9db53f and e5d7f4e (both in 2017). The last perl release that had these was 5.26.3 (in 2018).

It looks like somehow you're using (parts of?) the perl configure infrastructure from 2018 (or before) together with perl headers from 2024, so you're missing all kinds of symbols.

from perl5.

mauke avatar mauke commented on August 28, 2024 1

The current state of things: The OpenWRT perl is cross-compiled with a custom config.sh. This config.sh was originally created for perl v5.26 or earlier; it has since been manually updated with a few new values and symbols, but it has not been kept in sync with the state of Configure in the perl source tree.

The net result is that OpenWRT's config.sh still defines symbols that are no longer used by perl (like ansi2knr), which is harmless, but it is also missing a bunch of other symbols that perl implicitly relies on existing. In particular, several format string definitions are missing, which results in a miscompiled perl v5.38 and v5.40.

As far as I can tell, there is nothing for us to do here: Our Configure creates the symbols we expect. OpenWRT needs to update its config.sh template to add the symbols that perl v5.40 expects to exist (and maybe should delete the old symbols that are no longer used). As a safeguard against this specific kind of misconfiguration, I have added a check that the format strings in question are not empty (commit c5df4fd).ยน

Therefore I am going to close this ticket until something else comes up.


ยน Now that I think about it, the problem is not that these strings are empty; it's that they don't exist. So instead of tripping a static assertion, this code would be an undeclared symbol error on current OpenWRT (util.c:125:27: error: โ€˜I32dfโ€™ undeclared here). But in either case, the net result is the same: The compiler will produce an error instead of creating a miscompiled perl executable.

from perl5.

mauke avatar mauke commented on August 28, 2024

This is at least two different issues.

The first issue is that the locale code is throwing an error (presumably because LC_ALL is set to an invalid value, or at least what it considers to be invalid).

The second issue is that the code that tries to throw the error crashes. I suspect U32uf is set to "" for some reason.

What does perl -V:u32uformat say on your platform?

from perl5.

egorenar avatar egorenar commented on August 28, 2024

What does perl -V:u32uformat say on your platform?

$ perl -V:u32uformat
u32uformat='UNKNOWN';

from perl5.

mauke avatar mauke commented on August 28, 2024

Huh.
Did you compile this perl yourself? If so, can you post the generated config.sh and config.h files?

from perl5.

egorenar avatar egorenar commented on August 28, 2024

Huh. Did you compile this perl yourself? If so, can you post the generated config.sh and config.h files?

It was built as part of OpenWrt router image for my ARM router.
There was a version bump recently to 5.40. Since then the problem has appeared.

config.h:

#define U32uf               /**/

config.h.gz
config.sh.gz

from perl5.

egorenar avatar egorenar commented on August 28, 2024

Thanks for looking into this.
And i think you are right, it seems OpenWrt generates a custom config.sh file based on
https://github.com/openwrt/packages/blob/master/lang/perl/files/base.config
which explains ansi2knr ๐Ÿ˜„
So, OpenWrt's Perl package configuration is broken at the moment.

from perl5.

egorenar avatar egorenar commented on August 28, 2024

I fixed all outdated symbols and added new ones and now got this:

$ perl
locale.c: 1480: panic: 'C.UTF-8;C;C;C;C;C' needs an '=' to split name=value
; errno=0
Called by locale.c: 4097

Any hint what Perl expects here exactly ?
LC_ALL looks okay to me ๐Ÿ˜•

From locale.c:

#  ifndef PERL_LC_ALL_USES_NAME_VALUE_PAIRS

        if (! name_value) {
            /* Get the index of the category in this position */
            index = map_LC_ALL_position_to_index[component_number++];
        }
        else

#  endif

        {   /* Get the category part when each component is the
             * 'category=locale' form */

            category_end = strchr(s, '=');

            /* The '=' terminates the category name.  If no '=', is improper
             * form */
            if (! category_end) {
                error = no_equals;
                goto failure;
            }

It seems PERL_LC_ALL_USES_NAME_VALUE_PAIRS is defined ?

This means: d_perl_lc_all_uses_name_value_pairs='define'

from perl5.

khwilliamson avatar khwilliamson commented on August 28, 2024

I haven't been closely following this conversation, but this value is defined from a Configure probe. I skimmed the conversation and see mention of cross compilation. Could it be that this is a result of a mismatch between things? Platforms use two different methods to denote LC_ALL when not all locale categories have the same locale. The system you ran perl on uses the positional notation, but the configuration that is being used is expecting name=value notation. Here's some relevant lines from a FreeBSD box that has positional notation

/*#define PERL_LC_ALL_USES_NAME_VALUE_PAIRS     / **/
#define  PERL_LC_ALL_SEPARATOR "/"      /**/
#define  PERL_LC_ALL_CATEGORY_POSITIONS_INIT  { 1, 2, 3, 4, 5, 6 }      /**/

In your case the separator is a semi-colon instead of a slash. It is likely that the 1..6 is correct for your box.

If you changed your config.h to correspond, locale.c would not generate this error. But I don't know why the incorrect values were generated.

from perl5.

egorenar avatar egorenar commented on August 28, 2024

Yep, figured it out, OpenWrt's d_perl_lc_all_* and corresponding perl_lc_all_* weren't set properly in config.sh.
After fixing it everything works as expected.
Thanks!

from perl5.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.