develooper Front page | perl.perl5.porters | Postings from September 2010

[perl #73754] Fwd: Re: Post-5.12 Patch: Improve PerlIO layer errors

From:
Father Chrysostomos via RT
Date:
September 26, 2010 20:31
Subject:
[perl #73754] Fwd: Re: Post-5.12 Patch: Improve PerlIO layer errors
Message ID:
rt-3.6.HEAD-24759-1285558267-1682.73754-15-0@perl.org
On Mon Mar 22 10:52:25 2010, corion@corion.net wrote:
> A number please
> 
> -------- Original-Nachricht --------
> Betreff: Re: Post-5.12 Patch: Improve PerlIO layer errors
> Datum: Mon, 22 Mar 2010 13:48:15 -0400
> Von: Jesse Vincent <jesse@fsck.com>
> An: Max Maischein <corion@corion.net>
> 
> please send this to perlbug so it doesn't get lost.
> 
> 
> On Mon, Mar 22, 2010 at 06:39:46PM +0100, Max Maischein wrote:
> > Hi Perl5-porters,
> >
> > 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
> 
> > From e25ccf6ea2caff7c1e8fef61bc2094aedc1b3f96 Mon Sep 17 00:00:00
> 2001
> > From: Max Maischein <corion@corion.net>
> > Date: Sun, 21 Mar 2010 20:44:45 +0100
> > Subject: [PATCH] Better error message for PerlIO layer
> implementations
> >
> > ---
> >  perlio.c         |   11 ++++++++---
> >  t/porting/diag.t |    3 ++-
> >  2 files changed, 10 insertions(+), 4 deletions(-)
> >
> > diff --git a/perlio.c b/perlio.c
> > index ddcc357..c475544 100644
> > --- a/perlio.c
> > +++ b/perlio.c
> > @@ -1212,13 +1212,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 06f9849..771d96c 100644
> > --- a/t/porting/diag.t
> > +++ b/t/porting/diag.t
> > @@ -182,6 +182,8 @@ sub check_file {
> >  # Lists all missing things as of the inaguration of this script, so
> we
> >  # don't have to go from "meh" to perfect all at once.
> >  __DATA__
> > +%s (%d) does not match %s (%d),
> > +%s (%d) smaller than %s (%d),
> >  Ambiguous call resolved as CORE::%s(), %s
> >  Ambiguous use of %c resolved as operator %c
> >  Ambiguous use of %c{%s} resolved to %c%s
> > @@ -284,7 +286,6 @@ Invalid version format (misplaced _ in number)
> >  Invalid version object
> >  '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
> > --
> > 1.6.5.1.1367.gcd48
> >
> 

Thank you. I’ve applied this as 0dc1749808f7658dd7e4af08e1854e0d622b105d.




nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About