in reply to Layer does not match this perl

I found at least the location...
This error is thrown in PerlIO_push() in perlio.c:

PerlIO * PerlIO_push(pTHX_ PerlIO *f, PERLIO_FUNCS_DECL(*tab), const char *mode +, SV *arg) { if (tab->fsize != sizeof(PerlIO_funcs)) { mismatch: Perl_croak(aTHX_ "Layer does not match this perl"); } if (tab->size) { PerlIOl *l; if (tab->size < sizeof(PerlIOl)) { goto mismatch; }

As for the meaning.... dunno. Has an incompatible IO layer been pushed onto $sock (wild guess) ?

Replies are listed 'Best First'.
Re^2: Layer does not match this perl
by BrowserUk (Patriarch) on Mar 20, 2010 at 17:29 UTC

    Thanks shmem I also found the source.

    The puzzling thing is, the code doesn't give that (or any other) error, when run normally. It only happens when run under the auspices of a binary debugger. Actually just an api tracer along the lines of strace.

    Which implies that the debugger is modifying the contents of memory, except I can run it on any number of other apps without problems. I can even run it perl.exe running any number of other scripts without this problem.

    I suspect that it has something to do with that hookey goto.


    Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
    "Science is about questioning the status quo. Questioning authority".
    In the absence of evidence, opinion is indistinguishable from prejudice.
Re^2: Layer does not match this perl (sigh)
by tye (Sage) on Mar 21, 2010 at 17:29 UTC

    *sigh* Reasonable code would be more like:

    if (tab->fsize != sizeof(PerlIO_funcs)) { Perl_croak( aTHX_ "%s (%d) does not match %s (%d)", "PerlIO layer function table size", tab->fsize, "size expected by this perl", sizeof(PerlIO_funcs) ); } if (tab->size) { PerlIOl *l; if (tab->size < sizeof(PerlIOl)) { Perl_croak( aTHX_ "%s (%d) smaller than %s (%d)", "PerlIO layer instance size", tab->size, "size expected by this perl", sizeof(PerlIOl) ); }

    See also http://perl5.git.perl.org/perl.git/blob?f=pod/perliol.pod.

    - tye        

        Thanks very much for submitting that. I suggest the diagnostics be made more specific. Instead of:

        +%s (%d) does not match %s (%d), +%s (%d) smaller than %s (%d),

        Use:

        "PerlIO layer function table size (%d) does not match size expected by + this perl (%d)", "PerlIO layer instance size (%d) smaller than size expected by this pe +rl (%d)",

        But I also don't know if the format strings not matching the format strings used in the source code could present some type of problem.

        - tye