#1042897 aptitude: viewing a package's changelog from the TUI outputs a warning that is immediately erased

Package:
aptitude
Source:
aptitude
Description:
terminal-based package manager
Submitter:
Vincent Lefevre
Date:
2023-08-07 15:42:03 UTC
Severity:
normal
#1042897#5
Date:
2023-08-02 13:51:28 UTC
From:
To:
When I use "C" (View a package's changelog) on clang-15 from the
aptitude TUI, I get a warning that is immediately erased, so that
it is impossible to read it.

I suppose that aptitude should redirect stderr from
aptitude-changelog-parser so that it can display its contents
(when non empty) in a clear way.

Enabling the terminal's logs allows me to get the text of this
warning:

aptitude-changelog-parser: warning: /tmp/aptitude-root.7707:EXkCUB/aptitude-download-4-bORTciGPJi,..uo2EeQnZD7WBcD+L6_aptitude-download-cbF3RCIRNjR7d%D7+V.DiRimX__YaCHL(l105): found start of entry where expected more change data or trailer

This text seems to come from /usr/share/perl5/Dpkg/Changelog/Debian.pm:

            unless ($expect eq FIRST_HEADING || $expect eq NEXT_OR_EOF) {
                $self->parse_error($file, $.,
                    sprintf(g_('found start of entry where expected %s'),
                    $expect), "$_");
            }

About this unexpected warning, there may be some other bug.
But note that "apt changelog clang-15" is fine.

#1042897#10
Date:
2023-08-03 14:52:07 UTC
From:
To:
It should prevent these errors from showing up in the first place.
See #967911, which has been tagged "pending" almost three years ago. :-(

Yes, the clang-15 changelog entry for version 1:15.0.7-2 is not properly
terminated.

Cheers,
       Sven

#1042897#15
Date:
2023-08-03 23:57:11 UTC
From:
To:
If aptitude knows what to do (or may ignore the issue), yes.

I forgot about this one.

OK, I've just reported a bug for this:

https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1042997

#1042897#20
Date:
2023-08-04 16:06:24 UTC
From:
To:
I was a bit imprecise, actually I meant that aptitude-changelog-parser
should not emit these warnings to stderr, which is what #967911 is about.

Since the screen flashes created by aptitude-changelog-parser's warnings
have been annoying me for so long, I have now created a merge request to
cherry-pick the fix for unstable:

https://salsa.debian.org/apt-team/aptitude/-/merge_requests/20

Cheers,
       Sven

#1042897#25
Date:
2023-08-05 09:46:38 UTC
From:
To:
[...]

First, I don't understand

  But we cannot currently change that verbose default when using
  changelog_parse() from Dpkg::Changelog::Parse.

in the patch. The following works as expected:
--- a/aptitude-changelog-parser 2022-08-06 05:45:53.000000000 +0200 +++ b/aptitude-changelog-parser 2023-08-05 10:55:39.291911672 +0200 @@ -15,6 +15,7 @@ # Usage: aptitude-changelog-parser [<filename> [<from-version>]] my %opts; +$opts{verbose} = 0; if (scalar @ARGV >= 1) { $opts{file} = shift @ARGV; } This silences warnings from sub parse_error { my ($self, $file, $line_nr, $error, $line) = @_; push @{$self->{parse_errors}}, [ $file, $line_nr, $error, $line ]; if ($self->{verbose}) { if ($line) { warning("%20s(l$line_nr): $error\nLINE: $line", $file); } else { warning("%20s(l$line_nr): $error", $file); } } } in /usr/share/perl5/Dpkg/Changelog.pm. Now, silenting such warnings for changelog_parse() will fix issues like this one, but it will not fix the general problem with warnings and errors. For instance, aptitude-changelog-parser has eval { require Dpkg::Changelog::Parse; Dpkg::Changelog::Parse->import(); 1; } or do { warn "warning: Dpkg::Changelog::Parse not present, install libdpkg-perl\n"; exit 0; }; at the beginning, and this warning, which is important and must still be output, will still quickly disappear. BTW, the "exit 0;" is also incorrect, but that's another issue (bug 1043050, which I've just reported). And concerning errors, /usr/share/perl5/Dpkg/Changelog/Parse.pm has error(g_('changelog format %s is unknown: %s'), $format, $@) if $@; error(g_('changelog format %s is not a Dpkg::Changelog class'), $format) unless $changes->isa('Dpkg::Changelog'); and error(g_('unknown output format %s'), $options{format}); In /usr/share/perl5/Dpkg/ErrorHandling.pm, this corresponds to sub error($;@) { die report(REPORT_ERROR, @_); } This will not be silenced by "$SIG{__WARN__} = sub {};" like in your patch. I don't think these fatal errors should be silenced at all, but currently, they will also quickly disappear.
#1042897#30
Date:
2023-08-05 11:04:56 UTC
From:
To:
Ah yes, Guillem implemented the "verbose" option three years ago in
reaction to #967911.  And it could not be used back then because the
dpkg version offering it was only uploaded several months later, but now
it certainly can be used. :-)

Would you like to submit a merge request on salsa for the master branch?

Cheers,
       Sven

#1042897#40
Date:
2023-08-07 15:39:46 UTC
From:
To:
Thanks, I have updated
https://salsa.debian.org/apt-team/aptitude/-/merge_requests/20
accordingly.

Cheers,
       Sven