Subject: Re: [PATCH] git-send-email.perl: check for lines longer than 998 characters

From: Johannes Sixt <[email-masked]>
Date: Fri, 18 Jan 2008 09:12:32 +0100

Adam Piątyszek schrieb:
> According to RFC2822 (Internet Message Format), each line of a message
> must be no more than 998 characters. This patch adds a check for the
> length of each body line of a message and dies if the length exceeds
> the limit.
> 
> Signed-off-by: Adam Piątyszek <[email-masked]>
> ---
>  git-send-email.perl |    3 +++
>  1 files changed, 3 insertions(+), 0 deletions(-)
> 
> diff --git a/git-send-email.perl b/git-send-email.perl
> index e47994a..6d623ea 100755
> --- a/git-send-email.perl
> +++ b/git-send-email.perl
> @@ -748,6 +748,9 @@ foreach my $t (@files) {
>  				$header_done = 1;
>  			}
>  		} else {
> +			if (length($_) > 998) {
> +				die "(msg) This message contains lines longer than 998 characters,\nwhich can not be correctly send as plain text using SMTP.\n";
> +			}
>  			$message .=  $_;
>  			if (/^(Signed-off-by|Cc): (.*)$/i && $signed_off_cc) {
>  				my $c = $2;

Is it good to die() in this situation? If you are sending a patch series
and one patch in the middle triggers this condition, then only half of the
series is sent. Maybe it would be better to warn here only, collect file
names of the suspects, send the patch nevertheless, and write a summary at
the end?

-- Hannes