user/dev discussion of public-inbox itself
 help / color / mirror / code / Atom feed
Search results ordered by [date|relevance]  view[summary|nested|Atom feed]
thread overview below | download mbox.gz: |
* Re: [PATCH 2/2] doc: lei: add manpages for remaining commands
  2021-10-16 17:03  6%       ` Eric Wong
@ 2021-10-16 17:21  0%         ` Kyle Meyer
  0 siblings, 0 replies; 4+ results
From: Kyle Meyer @ 2021-10-16 17:21 UTC (permalink / raw)
  To: Eric Wong; +Cc: meta

Eric Wong writes:

> The failure is probably caused by
> 00d5dff2cce9d2c9 (eml: avoid Encode 2.87..3.12 leak, 2021-10-13)
> but I can't reproduce it across CentOS 7.x, FreeBSD 11.x, nor
> Debian 10 & 11.

Hmm, yeah, as mentioned in my other reply, I'm now not having any luck
triggering this either.

> Which versions of Encode and Perl are you using?

Perl v5.32.1 from Debian 11 and...

> At least in Debian, libencode-perl is available as a separate package
> but it's also part of libperl5.xx (possibly w/ a different version);
> only the latter is required for us, but two packages offering
> the same thing gets confusing :/
>
> I use: perl -MEncode -E 'say $Encode::VERSION'
> to determine which gets loaded.

... it looks like I'm using the on that's ships with libperl5:

  $ perl -MEncode -E 'say $Encode::VERSION'
  3.06

  $ apt-cache policy libencode-perl
  libencode-perl:
    Installed: (none)
    Candidate: 3.08-1+deb11u1
    Version table:
       3.08-1+deb11u1 500
          500 http://ftp.us.debian.org/debian bullseye/main amd64 Packages
          500 http://security.debian.org/debian-security bullseye-security/main amd64 Packages

^ permalink raw reply	[relevance 0%]

* Re: [PATCH 2/2] doc: lei: add manpages for remaining commands
  @ 2021-10-16 17:03  6%       ` Eric Wong
  2021-10-16 17:21  0%         ` Kyle Meyer
  0 siblings, 1 reply; 4+ results
From: Eric Wong @ 2021-10-16 17:03 UTC (permalink / raw)
  To: Kyle Meyer; +Cc: meta

Kyle Meyer <kyle@kyleam.com> wrote:
> Thanks, sorry about the mix up.

No worries, will push a regen.

> [*] I did run `make check' before sending, and it looks like that also
>     checks MANIFEST _after_ running the test suite.  That didn't help me
>     catch the MANIFEST sorting issue in this case because the test suite
>     is failing on my end.
> 
>     I believe these failures are recent and was planning on looking into
>     them today, either sending a patch or just reporting, depending on
>     whether I could figure out a fix.  Anyway, here they are:
> 
>       t/psgi_multipart_not.t .......
>       ok 1 - use HTTP::Request::Common;
>       ok 2 - use Plack::Test;
>       ok 3 - use PublicInbox::WWW;
>       not ok 4 - /v2test/?q=%22ain't what it used to be%22&x=t
>       not ok 5 - /v2test/?q=%22ain't what it used to be%22&x=t warns
>       Failed 2/5 subtests

The failure is probably caused by
00d5dff2cce9d2c9 (eml: avoid Encode 2.87..3.12 leak, 2021-10-13)
but I can't reproduce it across CentOS 7.x, FreeBSD 11.x, nor
Debian 10 & 11.

Which versions of Encode and Perl are you using?

At least in Debian, libencode-perl is available as a separate package
but it's also part of libperl5.xx (possibly w/ a different version);
only the latter is required for us, but two packages offering
the same thing gets confusing :/

I use: perl -MEncode -E 'say $Encode::VERSION'
to determine which gets loaded.

^ permalink raw reply	[relevance 6%]

* [PATCH 4/7] eml: avoid Encode 2.87..3.12 leak
  2021-10-13 10:16  6% ` [PATCH 0/7] workaround Encode leak, several test fixes Eric Wong
@ 2021-10-13 10:16  7%   ` Eric Wong
  0 siblings, 0 replies; 4+ results
From: Eric Wong @ 2021-10-13 10:16 UTC (permalink / raw)
  To: meta

Encode::FB_CROAK leaks memory in old versions of Encode:
<https://rt.cpan.org/Public/Bug/Display.html?id=139622>

Since I expect there's still many users on old systems and old
Perls, we can use "$SIG{__WARN__} = \&croak" here with
Encode::FB_WARN to emulate Encode::FB_CROAK behavior.
---
 lib/PublicInbox/Eml.pm | 25 ++++++++++++++++---------
 1 file changed, 16 insertions(+), 9 deletions(-)

diff --git a/lib/PublicInbox/Eml.pm b/lib/PublicInbox/Eml.pm
index 0867a016..69c26932 100644
--- a/lib/PublicInbox/Eml.pm
+++ b/lib/PublicInbox/Eml.pm
@@ -28,7 +28,7 @@ package PublicInbox::Eml;
 use strict;
 use v5.10.1;
 use Carp qw(croak);
-use Encode qw(find_encoding decode encode); # stdlib
+use Encode qw(find_encoding); # stdlib
 use Text::Wrap qw(wrap); # stdlib, we need Perl 5.6+ for $huge
 use MIME::Base64 3.05; # Perl 5.10.0 / 5.9.2
 use MIME::QuotedPrint 3.05; # ditto
@@ -334,9 +334,14 @@ sub body_set {
 
 sub body_str_set {
 	my ($self, $body_str) = @_;
-	my $charset = ct($self)->{attributes}->{charset} or
+	my $cs = ct($self)->{attributes}->{charset} //
 		croak('body_str was given, but no charset is defined');
-	body_set($self, \(encode($charset, $body_str, Encode::FB_CROAK)));
+	my $enc = find_encoding($cs) // croak "unknown encoding `$cs'";
+	$body_str = do {
+		local $SIG{__WARN__} = \&croak;
+		$enc->encode($body_str, Encode::FB_WARN);
+	};
+	body_set($self, \$body_str);
 }
 
 sub content_type { scalar header($_[0], 'Content-Type') }
@@ -452,15 +457,17 @@ sub body {
 sub body_str {
 	my ($self) = @_;
 	my $ct = ct($self);
-	my $charset = $ct->{attributes}->{charset};
-	if (!$charset) {
-		if ($STR_TYPE{$ct->{type}} && $STR_SUBTYPE{$ct->{subtype}}) {
+	my $cs = $ct->{attributes}->{charset} // do {
+		($STR_TYPE{$ct->{type}} && $STR_SUBTYPE{$ct->{subtype}}) and
 			return body($self);
-		}
 		croak("can't get body as a string for ",
 			join("\n\t", header_raw($self, 'Content-Type')));
-	}
-	decode($charset, body($self), Encode::FB_CROAK);
+	};
+	my $enc = find_encoding($cs) or croak "unknown encoding `$cs'";
+	my $tmp = body($self);
+	# workaround https://rt.cpan.org/Public/Bug/Display.html?id=139622
+	local $SIG{__WARN__} = \&croak;
+	$enc->decode($tmp, Encode::FB_WARN);
 }
 
 sub as_string {

^ permalink raw reply related	[relevance 7%]

* [PATCH 0/7] workaround Encode leak, several test fixes
  @ 2021-10-13 10:16  6% ` Eric Wong
  2021-10-13 10:16  7%   ` [PATCH 4/7] eml: avoid Encode 2.87..3.12 leak Eric Wong
  0 siblings, 1 reply; 4+ results
From: Eric Wong @ 2021-10-13 10:16 UTC (permalink / raw)
  To: meta

Eric Wong (7):
  xt/perf-msgview: drop unnecessary use_ok
  test_common: hoist out tail_f sub
  t/www_listing: require opt-in for grokmirror tests
  eml: avoid Encode 2.87..3.12 leak
  t/lei-mirror: avoid reading ~/.public-inbox/config in test
  t/git: avoid "once" warning for async_warn
  t/nntpd-tls: change diag() to like() assertion

 lib/PublicInbox/Eml.pm        | 25 +++++++++-----
 lib/PublicInbox/TestCommon.pm | 63 ++++++++++++++++++++---------------
 t/git.t                       |  3 +-
 t/lei-mirror.t                |  1 +
 t/nntpd-tls.t                 |  3 +-
 t/www_listing.t               | 20 +++++++----
 xt/perf-msgview.t             |  1 -
 7 files changed, 70 insertions(+), 46 deletions(-)

^ permalink raw reply	[relevance 6%]

Results 1-4 of 4 | reverse | options above
-- pct% links below jump to the message on this page, permalinks otherwise --
2021-10-12 10:59     Encode.pm leak in v2.87..v3.12 Eric Wong
2021-10-13 10:16  6% ` [PATCH 0/7] workaround Encode leak, several test fixes Eric Wong
2021-10-13 10:16  7%   ` [PATCH 4/7] eml: avoid Encode 2.87..3.12 leak Eric Wong
2021-10-16  5:39     [PATCH 0/2] doc: lei manpages for remaining commands Kyle Meyer
2021-10-16  5:39     ` [PATCH 2/2] doc: lei: add " Kyle Meyer
2021-10-16  7:07       ` Eric Wong
2021-10-16 15:13         ` Kyle Meyer
2021-10-16 17:03  6%       ` Eric Wong
2021-10-16 17:21  0%         ` Kyle Meyer

Code repositories for project(s) associated with this public inbox

	https://80x24.org/public-inbox.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).