Your message dated Sat, 16 Mar 2019 17:05:01 +0000
with message-id <[email protected]>
and subject line Bug#924517: fixed in perl 5.28.1-5
has caused the Debian Bug report #924517,
regarding perl: POSIX::mblen() broken
to be marked as done.
This means that you claim that the problem has been dealt with.
If this is not the case it is now your responsibility to reopen the
Bug report if necessary, and/or fix the problem forthwith.
(NB: If you are a system administrator and have no idea what this
message is talking about, this may indicate a serious mail system
misconfiguration somewhere. Please contact [email protected]
immediately.)
--
924517: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=924517
Debian Bug Tracking System
Contact [email protected] with problems
--- Begin Message ---
Package: perl
Version: 5.28.1-4
Tags: upstream patch
As reported in https://bugs.launchpad.net/bugs/1818953 POSIX::mblen()
is broken on threaded perls with glibc.
% perl -MPOSIX=mblen -e 'mblen("a", 1)'
perl: mbrtowc.c:105: __mbrtowc: Assertion `__mbsinit (data.__statep)' failed.
zsh: abort (core dumped) perl -MPOSIX=mblen -e 'mblen("a", 1)'
This is a 5.28 regression. I've reported it upstream with the attached
proposed patch, which should be trivial to backport to 5.28.
Will update this bug with the upstream ticket number once I get one.
--
Niko Tyni [email protected]
>From aaf1159fe2b891f63f819b2d496b0f938456a36d Mon Sep 17 00:00:00 2001
From: Niko Tyni <[email protected]>
Date: Sun, 10 Mar 2019 19:40:42 +0200
Subject: [PATCH] Fix POSIX::mblen mbstate_t initialization on threaded perls
with glibc
As reported in https://bugs.launchpad.net/bugs/1818953 POSIX::mblen()
is broken on threaded perls with glibc.
% perl -MPOSIX=mblen -e 'mblen("a", 1)'
perl: mbrtowc.c:105: __mbrtowc: Assertion `__mbsinit (data.__statep)' failed.
zsh: abort (core dumped) perl -MPOSIX=mblen -e 'mblen("a", 1)'
This broke in v5.27.8-134-g6c9ff7e96e which made the function
use mbrlen(3) under the hood on threaded perls.
The problem is initialization of the shift state with
mbrlen(NULL, 0, &ps));
The glibc documentation for mbrlen(3) at
https://www.gnu.org/software/libc/manual/html_node/Converting-a-Character.html#Converting-a-Character
does not mention initialization by passing in a null pointer for the
string, only a pointer to a NUL wide character.
If the next multibyte character corresponds to the NUL wide character,
the return value is 0. If the next n bytes form a valid multibyte
character, the number of bytes belonging to this multibyte character
byte sequence is returned.
Use memset(3) instead for mbstate_t initialization, as suggested in
https://www.gnu.org/software/libc/manual/html_node/Keeping-the-state.html
with the hope that this is more portable.
While at it, add a few basic test cases. These are in a new file because
they need fresh_perl_is() from test.pl while the existing ones use
Test::More (and conversion of at least posix.t looks way too involved.)
Bug-Ubuntu: https://bugs.launchpad.net/bugs/1818953
---
MANIFEST | 1 +
ext/POSIX/POSIX.xs | 2 +-
ext/POSIX/lib/POSIX.pm | 2 +-
ext/POSIX/t/mb.t | 45 ++++++++++++++++++++++++++++++++++++++++++
4 files changed, 48 insertions(+), 2 deletions(-)
create mode 100644 ext/POSIX/t/mb.t
diff --git a/MANIFEST b/MANIFEST
index 4cf40a8eec..57465859b9 100644
--- a/MANIFEST
+++ b/MANIFEST
@@ -4182,6 +4182,7 @@ ext/POSIX/POSIX.xs POSIX extension external subroutines
ext/POSIX/t/export.t Test @EXPORT and @EXPORT_OK
ext/POSIX/t/iscrash See if POSIX isxxx() crashes with threads on Win32
ext/POSIX/t/math.t Basic math tests for POSIX
+ext/POSIX/t/mb.t Multibyte function tests for POSIX
ext/POSIX/t/posix.t See if POSIX works
ext/POSIX/t/sigaction.t See if POSIX::sigaction works
ext/POSIX/t/sigset.t See if POSIX::SigSet works
diff --git a/ext/POSIX/POSIX.xs b/ext/POSIX/POSIX.xs
index 1ebc358af4..27051c1fdb 100644
--- a/ext/POSIX/POSIX.xs
+++ b/ext/POSIX/POSIX.xs
@@ -3329,7 +3329,7 @@ mblen(s, n)
#endif
CODE:
#if defined(USE_ITHREADS) && defined(HAS_MBRLEN)
- PERL_UNUSED_RESULT(mbrlen(NULL, 0, &ps)); /* Initialize state */
+ memset(&ps, 0, sizeof(ps)); /* Initialize state */
RETVAL = mbrlen(s, n, &ps); /* Prefer reentrant version */
#else
RETVAL = mblen(s, n);
diff --git a/ext/POSIX/lib/POSIX.pm b/ext/POSIX/lib/POSIX.pm
index 25392be4b1..4de039410f 100644
--- a/ext/POSIX/lib/POSIX.pm
+++ b/ext/POSIX/lib/POSIX.pm
@@ -4,7 +4,7 @@ use warnings;
our ($AUTOLOAD, %SIGRT);
-our $VERSION = '1.87';
+our $VERSION = '1.88';
require XSLoader;
diff --git a/ext/POSIX/t/mb.t b/ext/POSIX/t/mb.t
new file mode 100644
index 0000000000..4c60c22bae
--- /dev/null
+++ b/ext/POSIX/t/mb.t
@@ -0,0 +1,45 @@
+#!./perl
+
+# These tests are in a separate file, because they use fresh_perl_is()
+# from test.pl.
+
+# The mb* functions use the "underlying locale" that is not affected by
+# the Perl one. So we run the tests in a separate "fresh_perl" process
+# with the correct LC_CTYPE set in the environment.
+
+BEGIN {
+ require Config; import Config;
+ if ($^O ne 'VMS' and $Config{'extensions'} !~ /\bPOSIX\b/) {
+ print "1..0\n";
+ exit 0;
+ }
+ unshift @INC, "../../t";
+ require 'loc_tools.pl';
+ require 'test.pl';
+}
+
+plan tests => 3;
+
+use POSIX qw();
+
+SKIP: {
+ skip("mblen() not present", 3) unless $Config{d_mblen};
+
+ is(&POSIX::mblen("a", &POSIX::MB_CUR_MAX), 1, 'mblen() basically works');
+
+ skip("LC_CTYPE locale support not available", 2)
+ unless locales_enabled('LC_CTYPE');
+
+ my $utf8_locale = find_utf8_ctype_locale();
+ skip("no utf8 locale available", 2) unless $utf8_locale;
+
+ local $ENV{LC_CTYPE} = $utf8_locale;
+
+ fresh_perl_is(
+ 'use POSIX; print &POSIX::mblen("\x{c3}\x{28}", &POSIX::MB_CUR_MAX)',
+ -1, {}, 'mblen() recognizes invalid multibyte characters');
+
+ fresh_perl_is(
+ 'use POSIX; print &POSIX::mblen("\N{GREEK SMALL LETTER SIGMA}", &POSIX::MB_CUR_MAX)',
+ 2, {}, 'mblen() works on UTF-8 characters');
+}
--
2.20.1
--- End Message ---
--- Begin Message ---
Source: perl
Source-Version: 5.28.1-5
We believe that the bug you reported is fixed in the latest version of
perl, which is due to be installed in the Debian FTP archive.
A summary of the changes between this version and the previous one is
attached.
Thank you for reporting the bug, which will now be closed. If you
have further comments please address them to [email protected],
and the maintainer will reopen the bug report if appropriate.
Debian distribution maintenance software
pp.
Niko Tyni <[email protected]> (supplier of updated perl package)
(This message was generated automatically at their request; if you
believe that there is a problem with it please contact the archive
administrators by mailing [email protected])
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256
Format: 1.8
Date: Sat, 16 Mar 2019 16:02:28 +0200
Source: perl
Architecture: source
Version: 5.28.1-5
Distribution: unstable
Urgency: medium
Maintainer: Niko Tyni <[email protected]>
Changed-By: Niko Tyni <[email protected]>
Closes: 922609 923409 924506 924517 924719
Changes:
perl (5.28.1-5) unstable; urgency=medium
.
* Patch perlbug to use "editor" as the default editor. (Closes: #922609)
* Add a Breaks entry for older versions of libdist-inkt-perl.
(Closes: #924506)
* Add a README.Debian note about overriding the default perldoc formatter.
(See: #917530)
* Include arch-specific data for NDBM and GDBM autopkgtests.
(Closes: #923409)
* Break older versions of libmarc-charset-perl, broken by libgdbm changes.
(Closes: #924719)
+ Build-Depend on a current libgdbm-dev to guarantee compatibility
with the new LFS-enabled database binary format.
* Fix crashing POSIX::mblen(). (Closes: #924517)
Checksums-Sha1:
fa391d5f89041ce590022bae8c4f01896fc984d8 2835 perl_5.28.1-5.dsc
c77f47040e72c4230c6acdf28b05f1f57f47e5e2 178628 perl_5.28.1-5.debian.tar.xz
5cc8af047aac0b5b3fb259e55c41fa1ae839e4db 4678 perl_5.28.1-5_source.buildinfo
Checksums-Sha256:
a0fa371a5563da70cb671f67662e8e69c799c70904a64f67820c27defc1bc8dd 2835
perl_5.28.1-5.dsc
d5ac8e9177d400efffc963a806746ba68127882375f7966ffa6156fc673fd550 178628
perl_5.28.1-5.debian.tar.xz
6312ac6bfdbd77ebcd318a14e7ac87257fb7d3f095b3aec74662381da860e823 4678
perl_5.28.1-5_source.buildinfo
Files:
9f6f18fcd33473de5910650fdb32fa9e 2835 perl standard perl_5.28.1-5.dsc
f79065a3666e66e8797f39dce578614d 178628 perl standard
perl_5.28.1-5.debian.tar.xz
6ee40a8bf5a6cbb94f2c0df838bfd902 4678 perl standard
perl_5.28.1-5_source.buildinfo
-----BEGIN PGP SIGNATURE-----
iQJFBAEBCAAvFiEEdqKOQsmBHZHoj7peLsD/s7cwGx8FAlyNHusRHG50eW5pQGRl
Ymlhbi5vcmcACgkQLsD/s7cwGx/6/w//RpkUSsA1doSS033QVHDq6KlYDks7BWf1
W0gbEVu3OSIfx9XsGm/F9CYS8LJ7gNEKlwW4F4Poj7EZ7ke1W040R6D16HYjEHrj
H4hyutCL6ktw9U8J+d6r07z8txjbQMvouzS7jjeiVoKRktr+X1D3P4eU5Bjma4Cb
0ctgO8NxLJIp0DyzWrPQs0E1lU8rLMwPt2y8FrtktHulT43Me6roQJmltmewjAKO
sPCL8s6hm0z42+KrLqulwRADRyFQelyHwAGbvsfOhkT+3gFy0ZKHIQJVloLGb9hJ
YREiahuw9Qk0GtO5i6ErRuM6bD+UKuOSarmJsOM6TufUDXrTHL8LKvanuXElGHaM
luvQYrjj5pnZFvgH+Ii+XKsb4pM7LxhSro54xSqeLfvdz+0oYTmn/N2im6TylXHu
PULlU5FHgYmElUMqa9u/QSIhbAaIq7gj2rldoIubOkYviwNFdg3R+3//Rc+2GCTg
N+Xc+dK9q3qoRSMIbIFG5KZs8+l+rAlAFJrpnNAv8jx8XUyOdCM7Err0ysBV6sr7
fdgJOOksJUp++WElTIGFWJ4cRWTKqwJp7tj/kwv0j6AtwfG4myAxksLmmvbSeGux
mUl3JGApMYk3Qy47EUBF5FbqL1yOuVGhycviOlDkKyYn1S+3D/asZA3FiEr8jPvC
k/TWeyr5TZs=
=ornr
-----END PGP SIGNATURE-----
--- End Message ---