git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] git-send-email: provide hook to send lines more than 998 symbols
@ 2008-11-21  9:59 Andy Shevchenko
  2008-11-21 10:34 ` Arafangion
  2008-11-21 11:58 ` Jeff King
  0 siblings, 2 replies; 12+ messages in thread
From: Andy Shevchenko @ 2008-11-21  9:59 UTC (permalink / raw)
  To: git; +Cc: Andy Shevchenko

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(-)

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

^ permalink raw reply related	[flat|nested] 12+ messages in thread

* Re: [PATCH] git-send-email: provide hook to send lines more than 998 symbols
  2008-11-21  9:59 [PATCH] git-send-email: provide hook to send lines more than 998 symbols Andy Shevchenko
@ 2008-11-21 10:34 ` Arafangion
  2008-11-21 10:37   ` Andy Shevchenko
  2008-11-21 11:58 ` Jeff King
  1 sibling, 1 reply; 12+ messages in thread
From: Arafangion @ 2008-11-21 10:34 UTC (permalink / raw)
  To: Andy Shevchenko; +Cc: git

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?

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH] git-send-email: provide hook to send lines more than 998 symbols
  2008-11-21 10:34 ` Arafangion
@ 2008-11-21 10:37   ` Andy Shevchenko
  2008-11-21 10:52     ` Teemu Likonen
                       ` (2 more replies)
  0 siblings, 3 replies; 12+ messages in thread
From: Andy Shevchenko @ 2008-11-21 10:37 UTC (permalink / raw)
  To: Arafangion; +Cc: git

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)

-- 
With Best Regards,
Andy Shevchenko

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH] git-send-email: provide hook to send lines more than 998 symbols
  2008-11-21 10:37   ` Andy Shevchenko
@ 2008-11-21 10:52     ` Teemu Likonen
  2008-11-21 10:55       ` Andy Shevchenko
  2008-11-21 11:09     ` Arafangion
  2008-11-21 12:04     ` Jeff King
  2 siblings, 1 reply; 12+ messages in thread
From: Teemu Likonen @ 2008-11-21 10:52 UTC (permalink / raw)
  To: Andy Shevchenko; +Cc: Arafangion, git

Andy Shevchenko (2008-11-21 12:37 +0200) 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 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.

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH] git-send-email: provide hook to send lines more than 998 symbols
  2008-11-21 10:52     ` Teemu Likonen
@ 2008-11-21 10:55       ` Andy Shevchenko
  0 siblings, 0 replies; 12+ messages in thread
From: Andy Shevchenko @ 2008-11-21 10:55 UTC (permalink / raw)
  To: Teemu Likonen; +Cc: Arafangion, git

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

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH] git-send-email: provide hook to send lines more than 998 symbols
  2008-11-21 10:37   ` Andy Shevchenko
  2008-11-21 10:52     ` Teemu Likonen
@ 2008-11-21 11:09     ` Arafangion
  2008-11-21 11:46       ` Andreas Ericsson
  2008-11-21 12:04     ` Jeff King
  2 siblings, 1 reply; 12+ messages in thread
From: Arafangion @ 2008-11-21 11:09 UTC (permalink / raw)
  To: Andy Shevchenko; +Cc: git

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!)

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH] git-send-email: provide hook to send lines more than 998 symbols
  2008-11-21 11:09     ` Arafangion
@ 2008-11-21 11:46       ` Andreas Ericsson
  0 siblings, 0 replies; 12+ messages in thread
From: Andreas Ericsson @ 2008-11-21 11:46 UTC (permalink / raw)
  To: Arafangion; +Cc: Andy Shevchenko, git

Arafangion wrote:
> 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).

> 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

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH] git-send-email: provide hook to send lines more than 998 symbols
  2008-11-21  9:59 [PATCH] git-send-email: provide hook to send lines more than 998 symbols Andy Shevchenko
  2008-11-21 10:34 ` Arafangion
@ 2008-11-21 11:58 ` Jeff King
  2008-11-21 12:49   ` Michael J Gruber
  1 sibling, 1 reply; 12+ messages in thread
From: Jeff King @ 2008-11-21 11:58 UTC (permalink / raw)
  To: Andy Shevchenko; +Cc: git

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

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH] git-send-email: provide hook to send lines more than 998 symbols
  2008-11-21 10:37   ` Andy Shevchenko
  2008-11-21 10:52     ` Teemu Likonen
  2008-11-21 11:09     ` Arafangion
@ 2008-11-21 12:04     ` Jeff King
  2 siblings, 0 replies; 12+ messages in thread
From: Jeff King @ 2008-11-21 12:04 UTC (permalink / raw)
  To: Andy Shevchenko; +Cc: Arafangion, git

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

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH] git-send-email: provide hook to send lines more than 998 symbols
  2008-11-21 11:58 ` Jeff King
@ 2008-11-21 12:49   ` Michael J Gruber
  2008-11-21 13:29     ` Andy Shevchenko
  2008-11-21 14:08     ` Jeff King
  0 siblings, 2 replies; 12+ messages in thread
From: Michael J Gruber @ 2008-11-21 12:49 UTC (permalink / raw)
  To: Jeff King; +Cc: Andy Shevchenko, git

Jeff King venit, vidit, dixit 21.11.2008 12:58:
> 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

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH] git-send-email: provide hook to send lines more than 998 symbols
  2008-11-21 12:49   ` Michael J Gruber
@ 2008-11-21 13:29     ` Andy Shevchenko
  2008-11-21 14:08     ` Jeff King
  1 sibling, 0 replies; 12+ messages in thread
From: Andy Shevchenko @ 2008-11-21 13:29 UTC (permalink / raw)
  To: Michael J Gruber; +Cc: Jeff King, git

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

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH] git-send-email: provide hook to send lines more than 998 symbols
  2008-11-21 12:49   ` Michael J Gruber
  2008-11-21 13:29     ` Andy Shevchenko
@ 2008-11-21 14:08     ` Jeff King
  1 sibling, 0 replies; 12+ messages in thread
From: Jeff King @ 2008-11-21 14:08 UTC (permalink / raw)
  To: Michael J Gruber; +Cc: Andy Shevchenko, git

On Fri, Nov 21, 2008 at 01:49:18PM +0100, Michael J Gruber wrote:

> 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

^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2008-11-21 14:09 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-11-21  9:59 [PATCH] git-send-email: provide hook to send lines more than 998 symbols Andy Shevchenko
2008-11-21 10:34 ` Arafangion
2008-11-21 10:37   ` Andy Shevchenko
2008-11-21 10:52     ` Teemu Likonen
2008-11-21 10:55       ` Andy Shevchenko
2008-11-21 11:09     ` Arafangion
2008-11-21 11:46       ` Andreas Ericsson
2008-11-21 12:04     ` Jeff King
2008-11-21 11:58 ` Jeff King
2008-11-21 12:49   ` Michael J Gruber
2008-11-21 13:29     ` Andy Shevchenko
2008-11-21 14:08     ` Jeff King

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).