Front page | perl.perl5.porters |
Postings from December 2017
[perl #132665] Always use STOP_AT_PARTIAL in PerlIO::encoding
From:
Leon Timmermans
Date:
December 29, 2017 13:11
Subject:
[perl #132665] Always use STOP_AT_PARTIAL in PerlIO::encoding
Message ID:
rt-4.0.24-25458-1514553098-1774.132665-75-0@perl.org
# New Ticket Created by Leon Timmermans
# Please include the string: [perl #132665]
# in the subject line of all future correspondence about this issue.
# <URL: https://rt.perl.org/Ticket/Display.html?id=132665 >
This is a bug report for perl from fawaka@gmail.com,
generated with the help of perlbug 1.40 running under perl 5.24.0.
-----------------------------------------------------------------
[Please describe your issue here]
PerlIO::encoding has a $fallback variable that allows one to set the
behavior on a encoding/decoding error, for example to make it throw an
exception on error. What is not documented (actually the example in the
documentation is even missing this) is that PerlIO::encoding needs the
(equally undocumented) Encode::STOP_AT_PARTIAL flag to be set, otherwise
a multi-byte character spanning buffer boundaries will be interpreted as
two invalid byte sequences. I could have fixed the documentation, but
instead I fixed the code to always pass this flag to Encode, simplifying
the use and making the current documentation correct again.
[Please do not change anything below this line]
-----------------------------------------------------------------
---
Flags:
category=library
severity=low
module=PerlIO::encoding
---
Site configuration information for perl 5.24.0:
Configured by leont at Thu Jun 9 10:14:26 CEST 2016.
Summary of my perl5 (revision 5 version 24 subversion 0) configuration:
Platform:
osname=linux, osvers=4.5.4-1-arch, archname=x86_64-linux-thread-multi
uname='linux leon-laptop 4.5.4-1-arch #1 smp preempt wed may 11
22:21:28 cest 2016 x86_64 gnulinux '
config_args='-de
-Dprefix=/home/leont/perl5/perlbrew/perls/perl-5.24.0 -Dusethreads
-Aeval:scriptdir=/home/leont/perl5/perlbrew/perls/perl-5.24.0/bin'
hint=recommended, useposix=true, d_sigaction=define
useithreads=define, usemultiplicity=define
use64bitint=define, use64bitall=define, uselongdouble=undef
usemymalloc=n, bincompat5005=undef
Compiler:
cc='cc', ccflags ='-D_REENTRANT -D_GNU_SOURCE -fwrapv
-fno-strict-aliasing -pipe -fstack-protector-strong
-I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64',
optimize='-O2',
cppflags='-D_REENTRANT -D_GNU_SOURCE -fwrapv -fno-strict-aliasing
-pipe -fstack-protector-strong -I/usr/local/include'
ccversion='', gccversion='6.1.1 20160501', gccosandvers=''
intsize=4, longsize=8, ptrsize=8, doublesize=8,
byteorder=12345678, doublekind=3
d_longlong=define, longlongsize=8, d_longdbl=define,
longdblsize=16, longdblkind=3
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-strong -L/usr/local/lib'
libpth=/usr/local/lib
/usr/lib/gcc/x86_64-pc-linux-gnu/6.1.1/include-fixed /usr/lib
/lib/../lib /usr/lib/../lib /lib /lib64 /usr/lib64
libs=-lpthread -lnsl -lgdbm -ldb -ldl -lm -lcrypt -lutil -lc -lgdbm_compat
perllibs=-lpthread -lnsl -ldl -lm -lcrypt -lutil -lc
libc=libc-2.23.so, so=so, useshrplib=false, libperl=libperl.a
gnulibc_version='2.23'
Dynamic Linking:
dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags='-Wl,-E'
cccdlflags='-fPIC', lddlflags='-shared -O2 -L/usr/local/lib
-fstack-protector-strong'
Locally applied patches:
Devel::PatchPerl 1.40
---
@INC for perl 5.24.0:
/home/leont/perl5/perlbrew/perls/perl-5.24.0/lib/site_perl/5.24.0/x86_64-linux-thread-multi
/home/leont/perl5/perlbrew/perls/perl-5.24.0/lib/site_perl/5.24.0
/home/leont/perl5/perlbrew/perls/perl-5.24.0/lib/5.24.0/x86_64-linux-thread-multi
/home/leont/perl5/perlbrew/perls/perl-5.24.0/lib/5.24.0
.
---
Environment for perl 5.24.0:
HOME=/home/leont
LANG=en_US.UTF-8
LANGUAGE=en_US.UTF-8
LC_MEASUREMENT=en_IE.UTF-8
LC_MESSAGES=POSIX
LC_MONETARY=en_IE.UTF-8
LC_PAPER=en_IE.UTF-8
LC_TIME=en_IE.UTF-8
LD_LIBRARY_PATH (unset)
LOGDIR (unset)
PATH=/home/leont/perl5/perlbrew/bin:/home/leont/perl5/perlbrew/perls/perl-5.24.0/bin:/usr/local/bin:/usr/local/sbin:/usr/bin:/usr/bin/site_perl:/usr/bin/vendor_perl:/usr/bin/core_perl
PERLBREW_HOME=/home/leont/.perlbrew
PERLBREW_MANPATH=/home/leont/perl5/perlbrew/perls/perl-5.24.0/man
PERLBREW_PATH=/home/leont/perl5/perlbrew/bin:/home/leont/perl5/perlbrew/perls/perl-5.24.0/bin
PERLBREW_PERL=perl-5.24.0
PERLBREW_ROOT=/home/leont/perl5/perlbrew
PERLBREW_SHELLRC_VERSION=0.82
PERLBREW_VERSION=0.82
PERL_BADLANG (unset)
SHELL=/bin/bash
-
[perl #132665] Always use STOP_AT_PARTIAL in PerlIO::encoding
by Leon Timmermans