develooper Front page | perl.perl5.porters | Postings from November 2006

Trouble with PERLIO_INIT/PERLIO_TERM changes

Thread Next
Steve Hay
November 29, 2006 08:04
Trouble with PERLIO_INIT/PERLIO_TERM changes
Message ID:
I've found that my Win32-SharedFileOpen module currently fails a bunch 
of tests using bleadperl: the test scripts croak with the error:

refcnt_dec: fd 3: 0 <= 0

It works OK at patchlevel 29059. Change 29060 is probably the culprit, 
but actually broke the build on Win32 so it is difficult to be sure. 
Change 29065 fixed the linker error, but the "nmake install" step still 
falls over. That was finally fixed by 29074, and from that patchlevel 
onwards my module no longer works.

Change 29060 defined PERLIO_INIT and PERLIO_TERM and added PERLIO_TERM 

Change 29074 added PERLIO_INIT to PERL_SYS_INIT, which was apparently 
forgotten in 29060.

Change 29077 extended the above to other *ish.h headers (only unixish.h 
and dosish.h had been addressed until then).

In the course of trawling through all this I noticed that:

1. #29060 seems to have cocked up something else too: it added 
PERLIO_TERM into PERL_SYS_TERM() in the general case, but failed to 
notice that the WIN32 case defined PERL_SYS_TERM() as Perl_win32_term(), 
which hasn't been updated to suit. I think therefore that the attached 
patch is required?

2. #29077 has perhaps forgotten symbian/symbian.ish?

are not covered in every *ish.h file either. Should they be?

Unfortunately, even with the attached patch applied, I still haven't 
resolved the failure of my module's tests.

I've whittled the problem down to this:

perl -Mblib -MWin32::SharedFileOpen -e "fsopen(FH, 'README', 'r', 
SH_DENYNO); close FH"

which croaks with the error "refcnt_dec: fd 3: 0 <= 0" emitted from here:

 >	perl59.dll!PerlIOUnix_refcnt_dec(int fd=3)  Line 2357	C
  	perl59.dll!PerlIOStdio_close(interpreter * my_perl=0x00254224, 
_PerlIO * * f=0x01823134)  Line 3115 + 0x9 bytes	C
  	perl59.dll!PerlIOBase_close(interpreter * my_perl=0x00254224, _PerlIO 
* * f=0x018249c4)  Line 2157 + 0x10 bytes	C
  	perl59.dll!PerlIOBuf_close(interpreter * my_perl=0x00254224, _PerlIO 
* * f=0x018249c4)  Line 3994 + 0xd bytes	C
  	perl59.dll!PerlIO__close(interpreter * my_perl=0x00254224, _PerlIO * 
* f=0x018249c4)  Line 1399 + 0x10 bytes	C
  	perl59.dll!Perl_PerlIO_close(interpreter * my_perl=0x00254224, 
_PerlIO * * f=0x018249c4)  Line 1412 + 0xd bytes	C
  	perl59.dll!Perl_io_close(interpreter * my_perl=0x00254224, io * 
io=0x0199c0f4, char not_implicit='')  Line 977 + 0x12 bytes	C
  	perl59.dll!Perl_do_close(interpreter * my_perl=0x00254224, gv * 
gv=0x0025520c, char not_implicit='')  Line 940 + 0x11 bytes	C
  	perl59.dll!Perl_pp_close(interpreter * my_perl=0x00254224)  Line 600 
+ 0xf bytes	C

Any ideas?

(Note: This is all using trusty ol' VC6, so it can't simply be blamed on 


Radan Computational Ltd.

The information contained in this message and any files transmitted with it are confidential and intended for the addressee(s) only. If you have received this message in error or there are any problems, please notify the sender immediately. The unauthorized use, disclosure, copying or alteration of this message is strictly forbidden. Note that any views or opinions presented in this email are solely those of the author and do not necessarily represent those of Radan Computational Ltd. The recipient(s) of this message should check it and any attached files for viruses: Radan Computational will accept no liability for any damage caused by any virus transmitted by this email.

Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About