summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTye McQueen <tye@metronet.com>2010-09-26 18:35:39 -0700
committerFather Chrysostomos <sprout@cpan.org>2010-09-26 20:30:00 -0700
commit0dc1749808f7658dd7e4af08e1854e0d622b105d (patch)
treea1549feaa7ecc96748f29d5dc0695874b64a76c9
parent6797b0fef2e51d44193184687a5343e7bd3b5874 (diff)
downloadperl-0dc1749808f7658dd7e4af08e1854e0d622b105d.tar.gz
[perl #73754] Better error message for PerlIO layer implementations
please find attached a patch against blead originating from [1] , that improves the "Layer does not match this perl" error message by telling the user which IO layer failed and how. I've tested the patch against a recent bleadperl and even without the modifications to perldiag.t all tests pass. Still, for completeness, I've patched perldiag.t as well. The code is not mine, it was written and posted by Tye McQueen, I've just tested it [2] and ferry the information. I'm aware that this patch is too late for 5.12 , but in the sense of improving Perl in the long run, I hope the change still makes it into a version of Perl. -max [1] http://perlmonks.org/?node_id=829815 [2] Certified Works On My Machine, 2010
-rw-r--r--perlio.c11
-rw-r--r--t/porting/diag.t3
2 files changed, 10 insertions, 4 deletions
diff --git a/perlio.c b/perlio.c
index 79b7efae22..547f0b44b2 100644
--- a/perlio.c
+++ b/perlio.c
@@ -1211,13 +1211,18 @@ 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");
+ 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)) {
- goto mismatch;
+ Perl_croak( aTHX_
+ "%s (%d) smaller than %s (%d)",
+ "PerlIO layer instance size", tab->size,
+ "size expected by this perl", sizeof(PerlIOl) );
}
/* Real layer with a data area */
if (f) {
diff --git a/t/porting/diag.t b/t/porting/diag.t
index 36173422ee..2978a5b9a0 100644
--- a/t/porting/diag.t
+++ b/t/porting/diag.t
@@ -276,6 +276,8 @@ sub check_file {
# PLEASE DO NOT ADD TO THIS LIST. Instead, write an entry in
# pod/perldiag.pod for your new (warning|error).
__DATA__
+%s (%d) does not match %s (%d),
+%s (%d) smaller than %s (%d),
Argument "%s" isn't numeric
Argument "%s" isn't numeric in %s
Attempt to clear deleted array
@@ -368,7 +370,6 @@ Invalid type ',' in %s
It is proposed that "\c{" no longer be valid. It has historically evaluated to ";". If you disagree with this proposal, send email to perl5-porters@perl.org Otherwise, or in the meantime, you can work around this failure by changing "\c{" to ";"
'j' not supported on this platform
'J' not supported on this platform
-Layer does not match this perl
leaving effective gid failed
leaving effective uid failed
List form of piped open not implemented