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

5.6, source filters, modules, and __END__ go boom #1503

Closed
p5pRT opened this issue Mar 25, 2000 · 9 comments
Closed

5.6, source filters, modules, and __END__ go boom #1503

p5pRT opened this issue Mar 25, 2000 · 9 comments

Comments

@p5pRT
Copy link

p5pRT commented Mar 25, 2000

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

Searchable as RT2717$

@p5pRT
Copy link
Author

p5pRT commented Mar 25, 2000

From [email protected]

When you have a source filter in a module that has an __END__ or
__DATA__ block, Perl cores after executing the code in the module.
Yes, I know modules aren't supposed to have __END__, but it does
the same thing with __DATA__.

Main program​:

  #!/data/perl/bin/perl -w

  use Module;

Module.pm​:

  package Module;
  use MyFilter;
  warn "executing\n";
  1;

  __END__

MyFilter.pm​:

  package MyFilter;
  use Filter​::Util​::Call;
  sub import {
  my ($type) = @​_;
  filter_add(bless []);
  }
  sub filter {
  filter_read();
  }
  1;

This was originally from Rocco Caputo, the POE author. The core is
coming when an SV is cleared​:

#0 0x28163a6c in closedir () from /usr/lib/libc.so.3
#1 0x809cf74 in Perl_sv_clear (sv=0x80f4508) at sv.c​:3624
#2 0x809d236 in Perl_sv_free (sv=0x80f4508) at sv.c​:3785
#3 0x8091871 in Perl_av_undef (av=0x80f4628) at av.c​:452
#4 0x809cfc2 in Perl_sv_clear (sv=0x80f4628) at sv.c​:3640
#5 0x809d236 in Perl_sv_free (sv=0x80f4628) at sv.c​:3785
#6 0x80ae156 in Perl_leave_scope (base=137) at scope.c​:675
#7 0x80acfb1 in Perl_pop_scope () at scope.c​:144
#8 0x80b5f91 in Perl_pp_leaveeval () at pp_ctl.c​:3357
#9 0x8092a52 in Perl_runops_standard () at run.c​:25
#10 0x805b716 in S_call_body (myop=0xbfbfd9a8, is_eval=0) at perl.c​:1761
#11 0x805b4ef in perl_call_sv (sv=0x80f270c, flags=6) at perl.c​:1677
#12 0x805dbe4 in S_call_list_body (cv=0x80f270c) at perl.c​:3600
#13 0x805d950 in Perl_call_list (oldscope=1, paramList=0x80f279c)
  at perl.c​:3528
#14 0x807c06f in Perl_newATTRSUB (floor=78, o=0x80e7da0, proto=0x0, attrs=0x0,
  block=0x80f34c0) at op.c​:4641
#15 0x807963b in Perl_utilize (aver=1, floor=78, version=0x0, id=0x80e7d00,
  arg=0x0) at op.c​:3162
#16 0x8073764 in Perl_yyparse () at perly.y​:377
#17 0x805aae4 in S_parse_body (env=0x0, xsinit=0x8058924 <xs_init>)
  at perl.c​:1249
#18 0x805a0cf in perl_parse (my_perl=0x80e8030, xsinit=0x8058924 <xs_init>,
  argc=3, argv=0xbfbfdbf0, env=0x0) at perl.c​:857
#19 0x80588ec in main (argc=3, argv=0xbfbfdbf0, env=0xbfbfdc00)
  at perlmain.c​:50
#20 0x8058829 in _start ()

Source filters use the directory portion of the IO SV. They have a
flag to mark the directory handle as fake. Somehow there's an SV
with the compiled code that has the directory handle flag set, but
which isn't a directory handle. I assumed it was the copy of rsfp
that's made in toke.c's handling of __END__, but even when I made
sure the fake flag was set on the new IO structure, it was still
coredumping in the same way.

Here's the offending IO sv​:

(gdb) print *(struct xpvio *)sv
$2 = {xpv_pv = 0x80ea700 "`W\021\b", xpv_cur = 0, xpv_len = 67371023,
  xiv_iv = 135173528, xnv_nv = 2.5653433295941419e-289, xmg_magic = 0x80f38c0,
  xmg_stash = 0x9, xio_ifp = 0x600d, xio_ofp = 0x80e95a4, xio_dirp = 0x1,
  xio_lines = 67371012, xio_page = 135494240, xio_page_len = 1,
  xio_lines_left = 12, xio_top_name = 0x8104b90 "", xio_top_gv = 0x1,
  xio_fmt_name = 0x2000100b <Address 0x2000100b out of bounds>,
  xio_fmt_gv = 0x80f22ac, xio_bottom_name = 0x3 "", xio_bottom_gv = 0xc,
  xio_subprocess = -18532, xio_type = 14 '\016', xio_flags = 8 '\b'}

Perhaps it's something that isn't an IO SV but which is marked as
such? I lack the patience to step through and see where this is going
wrong, so I'm hoping someone (Sarathy? Paul?) can spot the cause
immediately.

Nat

@p5pRT
Copy link
Author

p5pRT commented Mar 25, 2000

From @gsar

On Sat, 25 Mar 2000 23​:15​:33 MST, Nathan Torkington wrote​:

This was originally from Rocco Caputo, the POE author. The core is
coming when an SV is cleared​:

#0 0x28163a6c in closedir () from /usr/lib/libc.so.3
#1 0x809cf74 in Perl_sv_clear (sv=0x80f4508) at sv.c​:3624
[...]
Source filters use the directory portion of the IO SV. They have a
flag to mark the directory handle as fake. Somehow there's an SV
with the compiled code that has the directory handle flag set, but
which isn't a directory handle. I assumed it was the copy of rsfp
that's made in toke.c's handling of __END__, but even when I made
sure the fake flag was set on the new IO structure, it was still
coredumping in the same way.

PL_rsfp doesn't have IoDIRP set, so the IOf_FAKE_DIRP flag is not
applicable there.

Here's the offending IO sv​:

(gdb) print *(struct xpvio *)sv
$2 = {xpv_pv = 0x80ea700 "`W\021\b", xpv_cur = 0, xpv_len = 67371023,
xiv_iv = 135173528, xnv_nv = 2.5653433295941419e-289, xmg_magic = 0x80f38c0,
xmg_stash = 0x9, xio_ifp = 0x600d, xio_ofp = 0x80e95a4, xio_dirp = 0x1,
xio_lines = 67371012, xio_page = 135494240, xio_page_len = 1,
xio_lines_left = 12, xio_top_name = 0x8104b90 "", xio_top_gv = 0x1,
xio_fmt_name = 0x2000100b <Address 0x2000100b out of bounds>,
xio_fmt_gv = 0x80f22ac, xio_bottom_name = 0x3 "", xio_bottom_gv = 0xc,
xio_subprocess = -18532, xio_type = 14 '\016', xio_flags = 8 '\b'}

Perhaps it's something that isn't an IO SV but which is marked as
such? I lack the patience to step through and see where this is going
wrong, so I'm hoping someone (Sarathy? Paul?) can spot the cause
immediately.

If I were you, I'd check Filter to see if it creates any io structure,
and if it does, fix it to set IOf_FAKE_DIRP on such io.

Sarathy
gsar@​ActiveState.com

@p5pRT
Copy link
Author

p5pRT commented Mar 25, 2000

From @gsar

On Sat, 25 Mar 2000 22​:41​:55 PST, I wrote​:

Perhaps it's something that isn't an IO SV but which is marked as
such? I lack the patience to step through and see where this is going
wrong, so I'm hoping someone (Sarathy? Paul?) can spot the cause
immediately.

If I were you, I'd check Filter to see if it creates any io structure,
and if it does, fix it to set IOf_FAKE_DIRP on such io.

A quick look shows Filter/Call/Call.xs annihilates IoFLAGS​:

  #define CODE_REF(sv) IoFLAGS(sv)
  [...]
  void
  real_import(object, perlmodule, coderef)
  [...]
  CODE_REF(sv) = coderef ;

Oops.

Sarathy
gsar@​ActiveState.com

@p5pRT
Copy link
Author

p5pRT commented Mar 26, 2000

From [Unknown Contact. See original ticket]

Gurusamy Sarathy writes​:

A quick look shows Filter/Call/Call.xs annihilates IoFLAGS​:

\#define CODE\_REF\(sv\)            IoFLAGS\(sv\)
\[\.\.\.\]
void
real\_import\(object\, perlmodule\, coderef\)
\[\.\.\.\]
        CODE\_REF\(sv\)   = coderef ;

Oops.

I think the idea is that this is a special kind of SV, which ought
never to be released into the wild. I've spent >1 hour in gdb and
the source code wondering just where that SV is and why it's being
freed, and I've decided it's beyond me :-)

If someone would like to go through that stack trace showing me
which functions correspond to what compiletime/runtime action, I'd
be forever grateful.

I've worked out​:

main Perl parse
  #16 0x8073778 in Perl_yyparse () at perly.y​:377

use Module
  #15 0x807964f in Perl_utilize (aver=1, floor=78, version=0x0, id=0x80e7d00,
  arg=0x0) at op.c​:3162

execution of the Module's code in a BEGIN block or is it that 'use'
corresponds to BEGIN { require ... ; import ... }?
#14 0x807c083 in Perl_newATTRSUB (floor=78, o=0x80e7da0, proto=0x0, attrs=0x0,
  block=0x80f34c0) at op.c​:4641

These are from the execution of the module's code​:
  #9 0x8092a66 in Perl_runops_standard () at run.c​:25
  #10 0x805b716 in S_call_body (myop=0xbfbfd9a8, is_eval=0) at perl.c​:1761
  #11 0x805b4ef in perl_call_sv (sv=0x80f270c, flags=6) at perl.c​:1677
  #12 0x805dbe4 in S_call_list_body (cv=0x80f270c) at perl.c​:3600
  #13 0x805d950 in Perl_call_list (oldscope=1, paramList=0x80f279c)
  at perl.c​:3528

When the file scope of the module's code ends, there's scope cleanup​:
  #6 0x80ae16a in Perl_leave_scope (base=137) at scope.c​:675
  #7 0x80acfc5 in Perl_pop_scope () at scope.c​:144
  #8 0x80b5fa5 in Perl_pp_leaveeval () at pp_ctl.c​:3357

And now there's the weird mess of things being freed, which I can't
track down​:
  #0 0x28163a6c in closedir () from /usr/lib/libc.so.3
  #1 0x809cf88 in Perl_sv_clear (sv=0x80f4508) at sv.c​:3624
  #2 0x809d24a in Perl_sv_free (sv=0x80f4508) at sv.c​:3785
  #3 0x8091885 in Perl_av_undef (av=0x80f4628) at av.c​:452
  #4 0x809cfd6 in Perl_sv_clear (sv=0x80f4628) at sv.c​:3640
  #5 0x809d24a in Perl_sv_free (sv=0x80f4628) at sv.c​:3785

Nat

@p5pRT
Copy link
Author

p5pRT commented Mar 26, 2000

From @pmqs

From​: Gurusamy Sarathy [gsar@​ActiveState.com]

On Sat, 25 Mar 2000 22​:41​:55 PST, I wrote​:

Perhaps it's something that isn't an IO SV but which is marked as
such? I lack the patience to step through and see where this is going
wrong, so I'm hoping someone (Sarathy? Paul?) can spot the cause
immediately.

If I were you, I'd check Filter to see if it creates any io structure,
and if it does, fix it to set IOf_FAKE_DIRP on such io.

A quick look shows Filter/Call/Call.xs annihilates IoFLAGS​:

\#define CODE\_REF\(sv\)            IoFLAGS\(sv\)
\[\.\.\.\]
void
real\_import\(object\, perlmodule\, coderef\)
\[\.\.\.\]
        CODE\_REF\(sv\)   = coderef ;

Oops.

I can't reproduce the __END__/__DATA__ problem on my Linux box at all
(Mandrake 6.1), but I've removed the use of IoFLAGS anyway. I don't think I
need to set the IOf_FAKE_DIRP flag in the filters myself because toke.c
takes care of it. I've also added a couple of tests to check that __END__ &
__DATA__ will work with Call.pm

This patch applies over a fresh copy of Filter-1.17. As well as the
__(END|DATA)__ problem, it includes Sarathy's threading patch. If it works
for those folk who were having the __(END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MA)4I?1"X+M0'`;]8'P3%T9Q2'^;FS.A#*4\?DE4>I0^E1?I0DOJ0S)?H0X*I
M3D\)-QZI#Z6L/D0SY.I#*​:L/I90^E%+2\+6"]G1U​:"Q4A\WOJPY//]'R@​P?.
M\7>^L)8TWP\@​XJ['%])28YZG@​"9Q8U]5K,+["[_-@​+.+_JT'S4AO7RZ=?1,F
M7RZ;Z7.XY(9​:NF94DR\Q/?J?>N0E'X"<)^9-)"1[Y/T[`91<`L48%Y^**NM=
M=RZ4^;1%]DJO-[9-O*Z\+;Z​:KXBU(P^=Q​::.*0)*SH;W;W"VDGZ/,)6]VBZS
M.#])_Q_EZ_\)QG<O&2W​:LZ^_?2@​V)+JC&FV)>/[YFY(;1%>U6N​:K("*E58BL
MH&S%;^SCG8​:"R(OA73<.`<,V<_E-[\*Y5LK"&RNDA)&>Y05DF8%9OHDC_T+J
MK$YXK\F9Q95^K.F1;X*WZ$1$C​:H;_2.%6CKX_$​:\,WN6B_GE<Z">MP6UBE​:+
M33/]6X%2B65.H?@​?)Q3C9C@​?5W=6998B\C2RXX"&0H2]M9Q,1/^]@​-[(D1%"
K*N@​W,>6F)`X&#A?_4.'D_.A(%>​:[UH#`/V+]]\+W\ID0_B\[)E@​SC4L`````
`
end

@p5pRT
Copy link
Author

p5pRT commented Mar 26, 2000

From [Unknown Contact. See original ticket]

On Sun, 26 Mar 2000 22​:26​:58 +0100, Marquess,P,Paul,NEL38 R wrote​:

I can't reproduce the __END__/__DATA__ problem on my Linux box at all
(Mandrake 6.1), but I've removed the use of IoFLAGS anyway. I don't think I
need to set the IOf_FAKE_DIRP flag in the filters myself because toke.c
takes care of it. I've also added a couple of tests to check that __END__ &
__DATA__ will work with Call.pm

This patch applies over a fresh copy of Filter-1.17. As well as the
__(END|DATA)__ problem, it includes Sarathy's threading patch. If it works
for those folk who were having the __(END|DATA)__ problems, I'll upload it
to CPAN.

Paul

The problem happens on my FreeBSD machine, even with your attached patches.
Oddly, I've found a work-around​: simply don't allow the __(END|DATA)__
line to be parsed​:

  # Treat it as EOF.
  if (/^__(END|DATA)__\s*$/) {
  $_ = "\n";
  return 0;
  }

Double-oddly, it doesn't occur on perl 5.005_63+ for OS/2. Detailed
version information is included.

-- Rocco Caputo / troc@​netrus.net

unix​:/usr/home/troc/perl/xws$ perl -V
Summary of my perl5 (revision 5.0 version 5 subversion 61) configuration​:
  Platform​:
  osname=freebsd, osvers=3.1-stable, archname=i386-freebsd-thread
  uname='freebsd unix.homenet 3.1-stable freebsd 3.1-stable #14​: fri may 28 13​:58​:18 edt 1999 troc@​unix.homenet​:usrsrcsyscompilecustom i386 '
  config_args='-Dusethreads'
  hint=recommended, useposix=true, d_sigaction=define
  usethreads=define useperlio=undef d_sfio=undef
  use64bits=undef usemultiplicity=undef
  Compiler​:
  cc='cc', optimize='-O2 -g', gccversion=2.7.2.1
  cppflags='-DDEBUGGING -I/usr/local/include'
  ccflags ='-DDEBUGGING -I/usr/local/include'
  stdchar='char', d_stdstdio=undef, usevfork=true
  intsize=4, longsize=4, ptrsize=4, doublesize=8
  d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=12
  alignbytes=4, usemymalloc=n, prototype=define
  Linker and Libraries​:
  ld='cc', ldflags ='-pthread -Wl,-E -L/usr/local/lib'
  libpth=/usr/lib /usr/local/lib
  libs=-lm -lc_r -lcrypt
  libc=, so=so, useshrplib=false, libperl=libperl.a
  Dynamic Linking​:
  dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags=' '
  cccdlflags='-DPIC -fpic', lddlflags='-shared -L/usr/local/lib'

Characteristics of this binary (from libperl)​:
  Compile-time options​: DEBUGGING
  Built under freebsd
  Compiled at Sep 6 1999 14​:15​:58
  @​INC​:
  /usr/local/perl5.005_61/lib/i386-freebsd-thread
  /usr/local/perl5.005_61/lib
  /usr/local/perl5.005_61/lib/site_perl/i386-freebsd-thread
  /usr/local/perl5.005_61/lib/site_perl
  .

[d​:\home\troc>perl -V
Summary of my perl5 (5.0 patchlevel 5 subversion 53) configuration​:
  Platform​:
  osname=os2, osvers=2.30, archname=os2
  uname='os2 karetnikova 2 2.30 i386 '
  hint=recommended, useposix=true, d_sigaction=define
  usethreads=undef useperlio=undef d_sfio=undef
  Compiler​:
  cc='gcc', optimize='-O2 -fomit-frame-pointer -malign-loops=2 -malign-jumps=2 -malign-functions=2 -s', gccversion=2.7.2.1
  cppflags='-Zomf -Zmt -DDOSISH -DOS2=2 -DEMBED -I.'
  ccflags ='-Zomf -Zmt -DDOSISH -DOS2=2 -DEMBED -I.'
  stdchar='char', d_stdstdio=define, usevfork=false
  intsize=4, longsize=4, ptrsize=4, doublesize=8
  d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=12
  alignbytes=4, usemymalloc=y, prototype=define
  Linker and Libraries​:
  ld='gcc', ldflags ='-Zexe -Zomf -Zmt -Zcrtdll -Zstack 32000'
  libpth=d​:/usr/local/lib d​:/emx/lib d​:/emx/lib/mt
  libs=-lsocket -lm -lbsd
  libc=d​:/emx/lib/mt/c_import.lib, so=dll, useshrplib=true, libperl=libperl.lib
  Dynamic Linking​:
  dlsrc=dl_dlopen.xs, dlext=dll, d_dlsymun=undef, ccdlflags=' '
  cccdlflags='-Zdll', lddlflags='-Zdll -Zomf -Zmt -Zcrtdll -s'

Characteristics of this binary (from libperl)​:
  Built under os2
  Compiled at Nov 12 1998 23​:44​:28
  %ENV​:
  PERL5LIB="d​:/usr/local/lib/perl5;d​:\usr\lib\perl5\site_lib/os2;d​:\usr\lib\perl5\site_lib"
  PERLLIB_PREFIX="F​:/perllib/lib;D​:\USR\LIB\PERL5"
  PERL_SH_DIR="D​:\BIN"
  @​INC​:
  d​:/usr/local/lib/perl5
  d​:\usr\lib\perl5\site_lib/os2
  d​:\usr\lib\perl5\site_lib
  D​:/USR/LIB/PERL5/5.00553/os2
  D​:/USR/LIB/PERL5/5.00553
  D​:/USR/LIB/PERL5/site_perl/5.00553/os2
  D​:/USR/LIB/PERL5/site_perl/5.00553
  .

@p5pRT
Copy link
Author

p5pRT commented Mar 28, 2000

From @pmqs

From​: Rocco Caputo [mailto​:troc@​netrus.net]

On Sun, 26 Mar 2000 22​:26​:58 +0100, Marquess,P,Paul,NEL38 R wrote​:

I can't reproduce the __END__/__DATA__ problem on my Linux box at all
(Mandrake 6.1), but I've removed the use of IoFLAGS anyway. I don't think
I
need to set the IOf_FAKE_DIRP flag in the filters myself because toke.c
takes care of it. I've also added a couple of tests to check that __END__
&
__DATA__ will work with Call.pm

This patch applies over a fresh copy of Filter-1.17. As well as the
__(END|DATA)__ problem, it includes Sarathy's threading patch. If it
works
for those folk who were having the __(END|DATA)__ problems, I'll upload
it
to CPAN.

Paul

The problem happens on my FreeBSD machine, even with your attached
patches.
Oddly, I've found a work-around​: simply don't allow the __(END|DATA)__
line to be parsed​:

# Treat it as EOF.
if (/^__(END|DATA)__\s*$/) {
$_ = "\n";
return 0;
}

The workaround will work most of the time. It would be difficult to do get
right all the time

  $a = <<EOM ;

  hello
  __END__
  EOM

  print $a ;

Double-oddly, it doesn't occur on perl 5.005_63+ for OS/2. Detailed
version information is included.

Hmmm, I think this may be due to IOf_FAKE_DIRP being a recent addition to
Perl. Seems to have been added in 5.005_63.

Do you have a 5.6.0 about to try a before and after test?

Paul

@p5pRT
Copy link
Author

p5pRT commented Mar 28, 2000

From [Unknown Contact. See original ticket]

On Mon, 27 Mar 2000 13​:34​:50 +0100, paul.marquess@​bt.com wrote​:

From​: Rocco Caputo [mailto​:troc@​netrus.net]

On Sun, 26 Mar 2000 22​:26​:58 +0100, Marquess,P,Paul,NEL38 R wrote​:

This patch applies over a fresh copy of Filter-1.17. As well as the
__(END|DATA)__ problem, it includes Sarathy's threading patch. If it works
for those folk who were having the __(END|DATA)__ problems, I'll upload it
to CPAN.

Paul

The problem happens on my FreeBSD machine, even with your attached patches.
Oddly, I've found a work-around​: simply don't allow the __(END|DATA)__
line to be parsed​:

# Treat it as EOF.
if (/^__(END|DATA)__\s*$/) {
$_ = "\n";
return 0;
}

The workaround will work most of the time. It would be difficult to do get
right all the time

$a = <<EOM ;

hello
__END__
EOM

print $a ;

True, true. I'm currently the target audience for the POE​::Preprocessor
module, so I've apprised myself of its caveats and promised myself a fix
should I ever need one. As Programmer Barbie says, "Parsing Perl is
*hard*!" :)

Double-oddly, it doesn't occur on perl 5.005_63+ for OS/2. Detailed
version information is included.

Hmmm, I think this may be due to IOf_FAKE_DIRP being a recent addition to
Perl. Seems to have been added in 5.005_63.

Do you have a 5.6.0 about to try a before and after test?

I don't, sorry, but I can test it on 5.005_63.

Paul

-- Rocco Caputo / troc@​netrus.net

@p5pRT
Copy link
Author

p5pRT commented Jul 6, 2003

[email protected] - 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