List Info

Thread: sizeof(PerlInterpreter) is wrong in win32/win32.c




sizeof(PerlInterpreter) is wrong in win32/win32.c
user name
2007-09-17 16:56:08
# New Ticket Created by  dktetsuo.karasik.eu.org 
# Please include the string:  [perl #45495]
# in the subject line of all future correspondence about
this issue. 
# <URL: h
ttp://rt.perl.org/rt3/Ticket/Display.html?id=45495 >



This is a bug report for perl from dmitrykarasik.eu.org
generated with the help of perlbug 1.35 running under perl
v5.8.8.


------------------------------------------------------------
-----
[Please enter your report here]

I've noticed that sizeof(PerlInterpreter) is different in
win32/win32.c and
(f.ex) pp_sys.c, which might lead to strange bugs . The
reason is that win32.c
declares

  #if !defined(PERLIO_IS_STDIO) &&
!defined(USE_SFIO)
  #define PerlIO FILE
  #endif

and perlio.h does 

  #ifndef PerlIO
  /* ----------- PerlIO implementation ---------- */
  /* PerlIO not #define-d to something else - define the
implementation */
  ...
  #define PERLIO_LAYERS 1
  ...
  #endif

whereas intrpvar.h declares

  #ifdef PERLIO_LAYERS
  PERLVARI(Iperlio, PerlIO *,NULL)
  PERLVARI(Iknown_layers, PerlIO_list_t *,NULL)
  PERLVARI(Idef_layerlist, PerlIO_list_t *,NULL)
  #endif
 
which is exactly the reason why sizeof(PerlInterpreter) is
less in win32.c
than in core files.  I've fixed this by the following
patch:

--- win32.c.orig	2007-09-17 23:12:34.000000000 +0200
+++ win32.c	2007-09-17 22:16:24.000000000 +0200
 -54,6
+54,7 
 
 #if !defined(PERLIO_IS_STDIO) &&
!defined(USE_SFIO)
 #define PerlIO FILE
+#define PERLIO_LAYERS 1
 #endif
 
 #include <sys/stat.h>

but possibly , if I'm not mistaken, the default notion of
PerlIO=FILE is
obsolete, so the removal of the whole if-endif block will
probably be even
better.

[Please do not change anything below this line]
------------------------------------------------------------
-----
---
Flags:
    category=core
    severity=medium
---

Summary of my perl5 (revision 5 version 10 subversion 0
patchlevel 31876) configuration:
  Platform:
    osname=MSWin32, osvers=5.00,
archname=MSWin32-x86-multi-thread
    uname=''
    config_args='undef'
    hint=recommended, useposix=true, d_sigaction=undef
    useithreads=define, usemultiplicity=define
    useperlio=define, d_sfio=undef, uselargefiles=define,
usesocks=undef
    use64bitint=undef, use64bitall=undef,
uselongdouble=undef
    usemymalloc=n, bincompat5005=undef
  Compiler:
    cc='cl', ccflags ='-nologo -GF -W3 -Od -MD -Zi -DWIN32
-D_CONSOLE -DNO_STRICT -DHAVE_DES_FCRYPT 
-DUTF8_FILENAME_SEMANTICS -DPERL_IMPLICIT_CONTEXT
-DPERL_IMPLICIT_SYS -DUSE_PERLIO -DPERL_MSVCRT_READFIX',
    optimize='-Od -MD -Zi',
    cppflags='-DWIN32'
    ccversion='11.00.7022', gccversion='', gccosandvers=''
    intsize=4, longsize=4, ptrsize=4, doublesize=8,
byteorder=1234
    d_longlong=undef, longlongsize=8, d_longdbl=define,
longdblsize=10
    ivtype='long', ivsize=4, nvtype='double', nvsize=8,
Off_t='__int64', lseeksize=8
    alignbytes=8, prototype=define
  Linker and Libraries:
    ld='link', ldflags ='-nologo -nodefaultlib -debug 
-libpath:"c:usrlocalperlbleadlibCORE" 
-machine86'
    libpth=lib
    libs=  oldnames.lib kernel32.lib user32.lib gdi32.lib
winspool.lib  comdlg32.lib advapi32.lib shell32.lib
ole32.lib oleaut32.lib  netapi32.lib uuid.lib ws2_32.lib
mpr.lib winmm.lib  version.lib odbc32.lib odbccp32.lib
msvcrt.lib
    perllibs=  oldnames.lib kernel32.lib user32.lib
gdi32.lib winspool.lib  comdlg32.lib advapi32.lib
shell32.lib ole32.lib oleaut32.lib  netapi32.lib uuid.lib
ws2_32.lib mpr.lib winmm.lib  version.lib odbc32.lib
odbccp32.lib msvcrt.lib
    libc=msvcrt.lib, so=dll, useshrplib=true,
libperl=perl59.lib
    gnulibc_version=''
  Dynamic Linking:
    dlsrc=dl_win32.xs, dlext=dll, d_dlsymun=undef,
ccdlflags=' '
    cccdlflags=' ', lddlflags='-dll -nologo -nodefaultlib
-debug 
-libpath:"c:usrlocalperlbleadlibCORE" 
-machine86'


Characteristics of this binary (from libperl): 
  Compile-time options: MULTIPLICITY PERL_DONT_CREATE_GVSV
                        PERL_IMPLICIT_CONTEXT
PERL_IMPLICIT_SYS
                        PERL_MALLOC_WRAP PL_OP_SLAB_ALLOC
USE_ITHREADS
                        USE_LARGE_FILES USE_PERLIO
  Locally applied patches:
	DEVEL
  Built under MSWin32
  Compiled at Sep 17 2007 23:37:43
  %ENV:
  INC:
    C:/home/src/perl-current/lib
    .


RE: sizeof(PerlInterpreter) is wrong in win32/win32.c
user name
2007-09-19 08:04:57
dktetsuo.karasik.eu.org (via RT) wrote:
> # New Ticket Created by  dktetsuo.karasik.eu.org
> # Please include the string:  [perl #45495]
> # in the subject line of all future correspondence
about this issue.
> # <URL: h
ttp://rt.perl.org/rt3/Ticket/Display.html?id=45495 >
[...]
> but possibly , if I'm not mistaken, the default notion
of PerlIO=FILE
> is 
> obsolete, so the removal of the whole if-endif block
will probably be
> even 
> better.

Which if-endif block are you referring to there?

Defining PERLIO_LAYERS 1 doesn't feel right if we're not
using the
PerlIO implementation, but I'm not really sure. Removing
obsolete code
sounds better, but I also don't know whether it really is
dead or not.
Anyone know?

[1-2]

about | contact  Other archives ( Real Estate discussion Medical topics )