Remove final white space from logwatch text output
Closes: 642398
Willi Mann
12 years ago
0 | From: Willi Mann <willi@wm1.at> | |
1 | Date: Sat, 5 Nov 2011 19:52:41 +0100 | |
2 | Subject: Remove final white space from logwatch text output | |
3 | ||
4 | Logwatch fails to send mail (using default output format text) with the | |
5 | mailer dma, which is packaged in Debian. This is because the last two | |
6 | characters in logwatch text output are "\n " instead of only "\n". | |
7 | This is also problematic on terminals as it may to slight garbage on | |
8 | screen. | |
9 | ||
10 | The root of this problem is that all logwatch output including the last | |
11 | line are printed using the output function which adds a final whitespace | |
12 | to all "line"-type output. | |
13 | ||
14 | The quick and dirty fix is to put the whitespace before instead of after the | |
15 | output. Testing reveals that the side-effects of this change are minimal: | |
16 | They only cause an additional unneccessary white-space at the beginning of | |
17 | the output, which seems acceptable to me. | |
18 | ||
19 | Closes: 642398 | |
20 | --- | |
21 | scripts/logwatch.pl | 2 +- | |
22 | 1 files changed, 1 insertions(+), 1 deletions(-) | |
23 | ||
24 | diff --git a/scripts/logwatch.pl b/scripts/logwatch.pl | |
25 | index 25e190c..d61a2d8 100755 | |
26 | --- a/scripts/logwatch.pl | |
27 | +++ b/scripts/logwatch.pl | |
28 | @@ -1529,7 +1529,7 @@ sub output { | |
29 | ||
30 | if ( $type eq "line" ) { | |
31 | if ( $Config{'format'} eq "text" ) { | |
32 | - $out_body{$index} .= "$text "; | |
33 | + $out_body{$index} .= " $text"; | |
34 | } elsif ( $Config{'format'} eq "html" ) { | |
35 | #Covert spaces | |
36 | $text =~ s/ / \ /go; | |
37 | -- |