[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#1004660: [PATCH] lintian-annotate-hints: line-wrapping broken when stdin is not a terminal



Package: lintian
Version: 2.114.0
Severity: normal
Tags: patch

When lintian-annotate-hints reads input from a file, or has lintian
ouput piped to it (as is suggested in the manual), the terminal width is
unset, which produces warnings to stderr and wrapping at 19 colums:

  % lintian *.dsc *.changes | lintian-annotate-hints
  N:
  W: luit-dbgsym: elf-error In program headers: Unable to find program interpreter name [usr/lib/debug/.build-id/70/10dc50cc05821fbf5aa86813b0dc6b341982d8.debug]
  Use of uninitialized value $columns in subtraction (-) at /usr/share/lintian/bin/../lib/Lintian/Output/EWI.pm line 398, <STDIN> line 1.
  Use of uninitialized value $columns in subtraction (-) at /usr/share/lintian/bin/../lib/Lintian/Output/EWI.pm line 413, <STDIN> line 1.
  Increasing $Text::Wrap::columns from  to 19 to accommodate length of subsequent tab at /usr/share/lintian/bin/../lib/Lintian/Output/EWI.pm line 423.
  N:
  N:   The
  N:   file
  N:   appears
  N:   to
  N:   be
  N:   in
  N:   ELF
  N:   format
  N:   but

Attached is a patch which provides sensible defaults for the case that
stdin is not a tty.

--bod
--- lintian-annotate-hints.orig	2021-11-28 04:20:56.000000000 +1100
+++ lintian-annotate-hints	2022-01-31 21:36:19.026248518 +1100
@@ -55,7 +55,7 @@
 
 const my $NEW_PROGRAM_NAME => q{lintian-annotate-hints};
 
-my $TERMINAL_WIDTH;
+my $TERMINAL_WIDTH = $ENV{COLUMNS} || 80;
 ($TERMINAL_WIDTH, undef, undef, undef) = GetTerminalSize()
   if is_interactive;
 

Reply to: