Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fwd: Re: Post-5.12 Patch: Improve PerlIO layer errors #10250

Closed
p5pRT opened this issue Mar 22, 2010 · 4 comments
Closed

Fwd: Re: Post-5.12 Patch: Improve PerlIO layer errors #10250

p5pRT opened this issue Mar 22, 2010 · 4 comments

Comments

@p5pRT
Copy link

p5pRT commented Mar 22, 2010

Migrated from rt.perl.org#73754 (status was 'resolved')

Searchable as RT73754$

@p5pRT
Copy link
Author

p5pRT commented Mar 22, 2010

From @Corion

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

--

@p5pRT
Copy link
Author

p5pRT commented Sep 27, 2010

From @cpansprout

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 0dc1749.

@p5pRT
Copy link
Author

p5pRT commented Sep 27, 2010

The RT System itself - Status changed from 'new' to 'open'

@p5pRT
Copy link
Author

p5pRT commented Sep 27, 2010

@cpansprout - Status changed from 'open' to 'resolved'

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

No branches or pull requests

1 participant