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

FILE* typemap screw up filehandles #12355

Open
p5pRT opened this issue Aug 27, 2012 · 1 comment
Open

FILE* typemap screw up filehandles #12355

p5pRT opened this issue Aug 27, 2012 · 1 comment

Comments

@p5pRT
Copy link

p5pRT commented Aug 27, 2012

Migrated from rt.perl.org#114608 (status was 'new')

Searchable as RT114608$

@p5pRT
Copy link
Author

p5pRT commented Aug 27, 2012

From @Leont

This is a bug report for perl from fawaka@​gmail.com,
generated with the help of perlbug 1.39 running under perl 5.16.1.


The XS Typemap file FILE* pushes a :stdio layer on top of the
filehandle but never removes it, carpeting over the existing layers.
This is particularly troublesome with encoding layers. For example
(this uses Sys​::Mmap, but any module using the FILE* typemap should
give the same result)​:

$ perl -MSys​::Mmap -E 'open my $fh, "<​:encoding(utf-8)", "Changes";
say join "​:", PerlIO​::get_layers($fh); mmap my $var, -s $fh,
PROT__READ, MAP_SHARED, $fh, 0; say join "​:", PerlIO​::get_layers($fh)'
unix​:perlio​:encoding(utf-8-strict)​:utf8
unix​:perlio​:encoding(utf-8-strict)​:utf8​:stdio

The latter is effectively the same as just «stdio» (until a
PerlIO_releaseFILE/PerlIO_pop). A conversion should never result in a
variable changing in nature or lose data, this is plain wrong.



Flags​:
  category=core
  severity=low


Site configuration information for perl 5.16.1​:

Configured by leon at Thu Aug 9 12​:30​:13 EEST 2012.

Summary of my perl5 (revision 5 version 16 subversion 1) configuration​:

  Platform​:
  osname=linux, osvers=3.2.0-27-generic, archname=x86_64-linux-thread-multi
  uname='linux leon-laptop 3.2.0-27-generic #43-ubuntu smp fri jul 6
14​:25​:57 utc 2012 x86_64 x86_64 x86_64 gnulinux '
  config_args='-de
-Dprefix=/home/leon/perl5/perlbrew/perls/perl-5.16.1 -Duseshrplib
-Dusethreads'
  hint=recommended, useposix=true, d_sigaction=define
  useithreads=define, usemultiplicity=define
  useperlio=define, d_sfio=undef, uselargefiles=define, usesocks=undef
  use64bitint=define, use64bitall=define, uselongdouble=undef
  usemymalloc=n, bincompat5005=undef
  Compiler​:
  cc='cc', ccflags ='-D_REENTRANT -D_GNU_SOURCE -fno-strict-aliasing
-pipe -fstack-protector -I/usr/local/include -D_LARGEFILE_SOURCE
-D_FILE_OFFSET_BITS=64',
  optimize='-O2',
  cppflags='-D_REENTRANT -D_GNU_SOURCE -fno-strict-aliasing -pipe
-fstack-protector -I/usr/local/include'
  ccversion='', gccversion='4.6.3', gccosandvers=''
  intsize=4, longsize=8, ptrsize=8, doublesize=8, byteorder=12345678
  d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=16
  ivtype='long', ivsize=8, nvtype='double', nvsize=8, Off_t='off_t',
lseeksize=8
  alignbytes=8, prototype=define
  Linker and Libraries​:
  ld='cc', ldflags =' -fstack-protector -L/usr/local/lib'
  libpth=/usr/local/lib /lib/x86_64-linux-gnu /lib/../lib
/usr/lib/x86_64-linux-gnu /usr/lib/../lib /lib /usr/lib
  libs=-lnsl -ldb -ldl -lm -lcrypt -lutil -lpthread -lc
  perllibs=-lnsl -ldl -lm -lcrypt -lutil -lpthread -lc
  libc=, so=so, useshrplib=true, libperl=libperl.so
  gnulibc_version='2.15'
  Dynamic Linking​:
  dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags='-Wl,-E
-Wl,-rpath,/home/leon/perl5/perlbrew/perls/perl-5.16.1/lib/5.16.1/x86_64-linux-thread-multi/CORE'
  cccdlflags='-fPIC', lddlflags='-shared -O2 -L/usr/local/lib
-fstack-protector'

Locally applied patches​:


@​INC for perl 5.16.1​:
  /home/leon/perl5/perlbrew/perls/perl-5.16.1/lib/site_perl/5.16.1/x86_64-linux-thread-multi
  /home/leon/perl5/perlbrew/perls/perl-5.16.1/lib/site_perl/5.16.1
  /home/leon/perl5/perlbrew/perls/perl-5.16.1/lib/5.16.1/x86_64-linux-thread-multi
  /home/leon/perl5/perlbrew/perls/perl-5.16.1/lib/5.16.1
  .


Environment for perl 5.16.1​:
  HOME=/home/leon
  LANG=en_US.UTF-8
  LANGUAGE=en_US​:en
  LC_ADDRESS=en_US.UTF-8
  LC_IDENTIFICATION=en_US.UTF-8
  LC_MEASUREMENT=en_US.UTF-8
  LC_MONETARY=en_US.UTF-8
  LC_NAME=en_US.UTF-8
  LC_NUMERIC=en_US.UTF-8
  LC_PAPER=en_US.UTF-8
  LC_TELEPHONE=en_US.UTF-8
  LC_TIME=en_US.UTF-8
  LD_LIBRARY_PATH (unset)
  LOGDIR (unset)
  PATH=/home/leon/perl5/perlbrew/bin​:/home/leon/perl5/perlbrew/perls/perl-5.16.1/bin​:/home/leon/bin​:/usr/lib/lightdm/lightdm​:/usr/local/sbin​:/usr/local/bin​:/usr/sbin​:/usr/bin​:/sbin​:/bin​:/usr/games
  PERLBREW_HOME=/home/leon/.perlbrew
  PERLBREW_PATH=/home/leon/perl5/perlbrew/bin​:/home/leon/perl5/perlbrew/perls/perl-5.16.1/bin
  PERLBREW_PERL=perl-5.16.1
  PERLBREW_ROOT=/home/leon/perl5/perlbrew
  PERLBREW_VERSION=0.25
  PERL_BADLANG (unset)
  SHELL=/bin/bash

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

2 participants