From: Jeff King Date: Fri, 18 Jan 2008 19:09:10 GMT Subject: Re: [PATCH 2/3] send-email: validate patches before sending anything Message-ID: <20080118190910.GA21044@coredump.intra.peff.net> In-Reply-To: <4790C11F.8010809@viscovery.net> On Fri, Jan 18, 2008 at 04:09:19PM +0100, Johannes Sixt wrote: > Jeff King schrieb: > > +sub validate_patch { > > + my $fn = shift; > > + open(my $fh, '<', $fn) > > + or die "unable to open $fn: $!\n"; > > + while (my $line = <$fh>) { > > + if (length($line) > 998) { > > + return "patch contains line longer than 998 characters"; > > "... contains line_s_ longer than..." I actually had that and changed it, since we know of only one such line (since we bail at that point). I think Jay's suggestion of outputting the line number is even better. -Peff