threads / patch / 16422

patchgit-send-email: provide hook to send lines more than 998 symbols

Subject: [PATCH] git-send-email: provide hook to send lines more than 998 symbols

## tl;dr

12 messages between Nov 21, 2008 and Nov 21, 2008. Diffs are folded; open one to read it.

replies: 11people: 6as markdown or json

Andy Shevchenko· Nov 21, 2008, 09:59 UTC · lore

By default git-send-email does not accept patch which is contain lines longer than 998 symbols. Sometime it's inconvenient, i.e. you have a long list in one variable in shell script. So, define environment variable GIT_SEND_EMAIL_LONGLINE to something to avoid that restriction.

Signed-off-by: Andy Shevchenko <andy.shevchenko@gmail.com>
---
 git-send-email.perl |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
Show changes to git-send-email.perl +1 −1
diff --git a/git-send-email.perl b/git-send-email.perl
index 94ca5c8..29f700d 100755
--- a/git-send-email.perl
+++ b/git-send-email.perl
@@ -981,7 +981,7 @@ sub validate_patch {
 	open(my $fh, '<', $fn)
 		or die "unable to open $fn: $!\n";
 	while (my $line = <$fh>) {
-		if (length($line) > 998) {
+		if (length($line) > 998 and not $ENV{GIT_SEND_EMAIL_LONGLINE}) {
 			return "$.: patch contains a line longer than 998 characters";
 		}
 	}
-- 
1.6.0.2.GIT
Arafangion· Nov 21, 2008, 10:34 UTC · re: Andy Shevchenko · lore

Re: [PATCH] git-send-email: provide hook to send lines more than 998 symbols

On Fri, 2008-11-21 at 11:59 +0200, Andy Shevchenko wrote:
> By default git-send-email does not accept patch which is contain lines longer
> than 998 symbols. Sometime it's inconvenient, i.e. you have a long list in one
> variable in shell script. So, define environment variable
> GIT_SEND_EMAIL_LONGLINE to something to avoid that restriction.
As a curiosity, why is such a check even neccessary?
Andy Shevchenko· Nov 21, 2008, 10:37 UTC · re: Arafangion · lore

Re: [PATCH] git-send-email: provide hook to send lines more than 998 symbols

On Fri, Nov 21, 2008 at 12:34 PM, Arafangion <thestar@fussycoder.id.au> wrote:
Show 6 quoted lines
>> By default git-send-email does not accept patch which is contain lines longer
>> than 998 symbols. Sometime it's inconvenient, i.e. you have a long list in one
>> variable in shell script. So, define environment variable
>> GIT_SEND_EMAIL_LONGLINE to something to avoid that restriction.
>
> As a curiosity, why is such a check even neccessary?

I'm not an author of that strange check (possible it's somehow related to b8ebe08b9a643f432866eb7150c3b20d59b755f2)

-- 
With Best Regards,
Andy Shevchenko
Teemu Likonen· Nov 21, 2008, 10:52 UTC · re: Andy Shevchenko · lore

Re: [PATCH] git-send-email: provide hook to send lines more than 998 symbols

Andy Shevchenko (2008-11-21 12:37 +0200) wrote:
Show 8 quoted lines
> On Fri, Nov 21, 2008 at 12:34 PM, Arafangion <thestar@fussycoder.id.au> wrote:
>>> By default git-send-email does not accept patch which is contain
>>> lines longer than 998 symbols. Sometime it's inconvenient, i.e. you
>>> have a long list in one variable in shell script. So, define
>>> environment variable GIT_SEND_EMAIL_LONGLINE to something to avoid
>>> that restriction.
>>
>> As a curiosity, why is such a check even neccessary?
> I'm not an author of that strange check (possible it's somehow related
> to b8ebe08b9a643f432866eb7150c3b20d59b755f2)

The author (so to say) of that strange check is RFC 2822 - Internet Message Format.

    2.1.1. Line Length Limits
        There are two limits that this standard places on the number of
        characters in a line. Each line of characters MUST be no more
        than 998 characters, and SHOULD be no more than 78 characters,
        excluding the CRLF.
        The 998 character limit is due to limitations in many
        implementations which send, receive, or store Internet Message
        Format messages that simply cannot handle more than 998
        characters on a line. [...]
http://www.faqs.org/rfcs/rfc2822.html

Perhaps longer lines will work in many cases but atleast warning should be printed to user, or something.

Andy Shevchenko· Nov 21, 2008, 10:55 UTC · re: Teemu Likonen · lore

Re: [PATCH] git-send-email: provide hook to send lines more than 998 symbols

On Fri, Nov 21, 2008 at 12:52 PM, Teemu Likonen <tlikonen@iki.fi> wrote:
Actually, the --no-validate is the true option for that.
-- 
With Best Regards,
Andy Shevchenko
Arafangion· Nov 21, 2008, 11:09 UTC · re: Andy Shevchenko · lore

Re: [PATCH] git-send-email: provide hook to send lines more than 998 symbols

On Fri, 2008-11-21 at 12:37 +0200, Andy Shevchenko wrote:
> On Fri, Nov 21, 2008 at 12:34 PM, Arafangion <thestar@fussycoder.id.au> wrote:
> >> By default git-send-email does not accept patch which is contain lines longer
> >> than 998 symbols. Sometime it's inconvenient, i.e. you have a long list in one
<snip>
> > As a curiosity, why is such a check even neccessary?
> I'm not an author of that strange check (possible it's somehow related
> to b8ebe08b9a643f432866eb7150c3b20d59b755f2)

I can't seem to find that changeset, however the reason why I asked is because I thought I remembered that some mail clients could crash if they got lines longer than that, and we should cater for that even if those clients should handle mails better than that! Apparently it's specified in the relevant RFC2822, and this particular solution has already been contributed as: https://kerneltrap.org/mailarchive/git/2008/1/18/579779

I would be inclined to suggest that such patches should be sent as an attachment instead? (Though this may become bikeshed painting on my part, see http://www.freebsd.org/doc/en/articles/mailing-list-faq/bikeshed.html for what I mean by the term).

While patches should be sent inline to encourage discussion of the patch, if the patch has such insanely long lines, the probability that the bulk of your audience in having a good email client that doesn't mangle your patch may become rather low.

(I really should get some sleep, not good to be argumentative when people are contributing very useful patches, like yourself!)

Andreas Ericsson· Nov 21, 2008, 11:46 UTC · re: Arafangion · lore

Re: [PATCH] git-send-email: provide hook to send lines more than 998 symbols

Arafangion wrote:
Show 17 quoted lines
> On Fri, 2008-11-21 at 12:37 +0200, Andy Shevchenko wrote:
>> On Fri, Nov 21, 2008 at 12:34 PM, Arafangion <thestar@fussycoder.id.au> wrote:
>>>> By default git-send-email does not accept patch which is contain lines longer
>>>> than 998 symbols. Sometime it's inconvenient, i.e. you have a long list in one
> <snip>
>>> As a curiosity, why is such a check even neccessary?
>> I'm not an author of that strange check (possible it's somehow related
>> to b8ebe08b9a643f432866eb7150c3b20d59b755f2)
> 
> I can't seem to find that changeset, however the reason why I asked is
> because I thought I remembered that some mail clients could crash if
> they got lines longer than that, and we should cater for that even if
> those clients should handle mails better than that!  Apparently it's
> specified in the relevant RFC2822, and this particular solution has
> already been contributed as:
> https://kerneltrap.org/mailarchive/git/2008/1/18/579779
> 

Well, there's quite a lot of arguing following that mail, and it doesn't seem to end with a final decision.

> I would be inclined to suggest that such patches should be sent as an
> attachment instead?

No, that would be bad. Many communities (git included) discard patches that aren't sent inline unless that's for a very good reason (translation patches are almost always inline, as they tend to break stuff for people who lack the proper encoding).

Show 5 quoted lines
> While patches should be sent inline to encourage discussion of the
> patch, if the patch has such insanely long lines, the probability that
> the bulk of your audience in having a good email client that doesn't
> mangle your patch may become rather low.
> 

Reviewable source-code doesn't contain lines longer than 100 or so lines anyway, so we might as well break on some arbitrary (say, 200) width and ask the user to resubmit with the "--attach" option if they really want to send their patch.

-- 
Andreas Ericsson                   andreas.ericsson@op5.se
OP5 AB                             www.op5.se
Tel: +46 8-230225                  Fax: +46 8-230231
Jeff King· Nov 21, 2008, 12:04 UTC · re: Andy Shevchenko · lore

Re: [PATCH] git-send-email: provide hook to send lines more than 998 symbols

On Fri, Nov 21, 2008 at 12:37:08PM +0200, Andy Shevchenko wrote:
> > As a curiosity, why is such a check even neccessary?
> I'm not an author of that strange check (possible it's somehow related
> to b8ebe08b9a643f432866eb7150c3b20d59b755f2)

I am the author, and it was a direct response to a user who had something in his mail path munging overly long lines (which are, in fact, disallowed by rfc 2822).

Read this thread:
  http://thread.gmane.org/gmane.comp.version-control.git/70847

which contains the problem report and the patches. We could take this one step further (but didn't at the time) by QP-encoding the body part with long lines, which is what a normal MUA would do. Since the receiving tools for git handle this situation, it should work fine. I think such a patch would be welcome.

-Peff
Jeff King· Nov 21, 2008, 11:58 UTC · re: Andy Shevchenko · lore

Re: [PATCH] git-send-email: provide hook to send lines more than 998 symbols

On Fri, Nov 21, 2008 at 11:59:24AM +0200, Andy Shevchenko wrote:
> By default git-send-email does not accept patch which is contain lines longer
> than 998 symbols. Sometime it's inconvenient, i.e. you have a long list in one
> variable in shell script. So, define environment variable
> GIT_SEND_EMAIL_LONGLINE to something to avoid that restriction.

This already exists as "git send-email --no-validate", which unfortunately doesn't seem to be documented. Care to send in a documentation patch instead?

-Peff
Michael J Gruber· Nov 21, 2008, 12:49 UTC · re: Jeff King · lore

Re: [PATCH] git-send-email: provide hook to send lines more than 998 symbols

Jeff King venit, vidit, dixit 21.11.2008 12:58:
Show 10 quoted lines
> On Fri, Nov 21, 2008 at 11:59:24AM +0200, Andy Shevchenko wrote:
> 
>> By default git-send-email does not accept patch which is contain lines longer
>> than 998 symbols. Sometime it's inconvenient, i.e. you have a long list in one
>> variable in shell script. So, define environment variable
>> GIT_SEND_EMAIL_LONGLINE to something to avoid that restriction.
> 
> This already exists as "git send-email --no-validate", which
> unfortunately doesn't seem to be documented. Care to send in a
> documentation patch instead?
In fact it is documented in git-send-email.txt:
--[no-]validate::
        Perform sanity checks on patches.
        Currently, validation means the following:
+
--
                *       Warn of patches that contain lines longer than
998 characters; this
                        is due to SMTP limits as described by
http://www.ietf.org/rfc/rfc2821.txt.
--
+
Default is the value of 'sendemail.validate'; if this is not set,
default to '--validate'.

Cheers, Michael

Andy Shevchenko· Nov 21, 2008, 13:29 UTC · re: Michael J Gruber · lore

Re: [PATCH] git-send-email: provide hook to send lines more than 998 symbols

On Fri, Nov 21, 2008 at 2:49 PM, Michael J Gruber <git@drmicha.warpmail.net> wrote:

> In fact it is documented in git-send-email.txt:
> --[no-]validate::
That is I found just after I have sent the first email.
P.S. Thanks for all, patch is wrong.
-- 
With Best Regards,
Andy Shevchenko
Jeff King· Nov 21, 2008, 14:08 UTC · re: Michael J Gruber · lore

Re: [PATCH] git-send-email: provide hook to send lines more than 998 symbols

On Fri, Nov 21, 2008 at 01:49:18PM +0100, Michael J Gruber wrote:
Show 5 quoted lines
> In fact it is documented in git-send-email.txt:
> 
> --[no-]validate::
>         Perform sanity checks on patches.
>         Currently, validation means the following:

Oh, right. Sorry, I stupidly looked at an older installed manpage instead of going right to the source. So yes, it is documented.

-Peff

← back to recent threads