Control: tags -1 patch Hi!
On Tue, 2020-08-04 at 20:09:05 +0200, Sven Joachim wrote: > Package: aptitude > Version: 0.8.13-1+b1 > Severity: normal > X-Debbugs-Cc: Sven Joachim <svenj...@gmx.de>, Guillem Jover > <guil...@debian.org> > When viewing the Debian changelog of bash in aptitude's TUI, I saw the > screen flash and then error messages from aptitude-changelog-parser > appeared scattered across the screen, redrawing the screen with Ctrl-l > got rid of these and displayed the changelog properly. > > The bash changelog has at least two incorrectly formatted entries for > versions 2.01.1-3.1 and 2.01-0 which aptitude-changelog-parser > apparently complains about. Right these are the warnings from the Dpkg::Changelog parser: ,--- Redundant argument in sprintf at /usr/share/perl5/Dpkg/Changelog/Entry/Debian.pm line 228, <$filehandle> line 2373. aptitude-changelog-parser: warning: bash.changelog(l2373): uses full instead of abbreviated month name 'July' LINE: -- Joel Klecker <j...@espy.org> Tue, 14 July 1998 16:26:43 -0700 aptitude-changelog-parser: warning: bash.changelog(l2373): cannot parse non-conformant date '14 July 1998 16:26:43 -0700' LINE: -- Joel Klecker <j...@espy.org> Tue, 14 July 1998 16:26:43 -0700 aptitude-changelog-parser: warning: bash.changelog(l2484): ignoring invalid week day 'Thur' LINE: -- James Troup <jjtr...@comp.brad.ac.uk> Thur, 19 June 1997 19:13:34 +0100 aptitude-changelog-parser: warning: bash.changelog(l2484): invalid abbreviated month name 'June' LINE: -- James Troup <jjtr...@comp.brad.ac.uk> Thur, 19 June 1997 19:13:34 +0100 aptitude-changelog-parser: warning: bash.changelog(l2484): cannot parse non-conformant date '19 June 1997 19:13:34 +0100' LINE: -- James Troup <jjtr...@comp.brad.ac.uk> Thur, 19 June 1997 19:13:34 +0100 `--- So, there's an actual issue with the Dpkg::Changelog::Entry::Debian code, which I'll be fixing. Then the bash changelog, would be nice to get fixed too in bash. > Viewing the changelog from the commandline with "aptitude changelog > bash" does not show such a problem, though. I guess the TUI is not ignoring stderr, while the CLI invocation is? Although that means that if the libdpkg-perl package is not installed, there will be no warning helping the user along, so it would be nice to get the CLI to not ignore the warnings for consistency? In any case, Dpkg::Changelog defaults to printing these parsing problems as warnings, but there is no way to pass a «verbose => 0» via changelog_parse(). I'll add support for that too. For the aptitude-changelog-parser, it could be modified for now to quiesce late warnings like in the attached patch. Thanks, Guillem
From 947bc494c61d0b89f3ac62fe84464e6da3920625 Mon Sep 17 00:00:00 2001 From: Guillem Jover <guil...@debian.org> Date: Tue, 4 Aug 2020 20:51:44 +0200 Subject: [PATCH] aptitude-changelog-parser: Quiesce Dpkg::Changelog parse warnings The Dpkg::Changelog object gets initialized with verbose mode set to 1, so all parsing warnings get printed on stderr, which messes up the output when showing the changelogs from the TUI. But we cannot currently change that verbose default when using changelog_parse() from Dpkg::Changelog::Parse. While this is being implemented in libdpkg-perl, we can quiesce the warnings in aptitude-changelog-parser by disabling the warn handler. --- aptitude-changelog-parser | 2 ++ 1 file changed, 2 insertions(+) diff --git a/aptitude-changelog-parser b/aptitude-changelog-parser index aee1dfd1..9a71ca6a 100755 --- a/aptitude-changelog-parser +++ b/aptitude-changelog-parser @@ -24,4 +24,6 @@ if (scalar @ARGV == 1) { $opts{all} = undef; } +$SIG{__WARN__} = sub {}; + print join "\n", changelog_parse(format => 'rfc822', %opts); -- 2.28.0.163.g6104cc2f0b6