email address handling

classic Classic list List threaded Threaded
41 messages Options
123
Reply | Threaded
Open this post in threaded view
|

email address handling

Andrew Morton-9

A minor thing.

Commit 76ecb4f2d7ea5c3aac8970b9529775316507c6d2 is displayed thusly:

  commit 76ecb4f2d7ea5c3aac8970b9529775316507c6d2
  Author: Zhang, Rui <[hidden email]>
  Date:   Thu Apr 10 16:20:23 2008 +0800

      ACPI: update thermal temperature

but that isn't a valid email address.  Because it contains a comma it
must be quoted:  "Zhang, Rui".

I assume that something in the git toolchain removed his quotes, and
that was arguably incorrect.

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to [hidden email]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Reply | Threaded
Open this post in threaded view
|

Re: email address handling

Linus Torvalds-3


On Thu, 31 Jul 2008, Andrew Morton wrote:

>
> A minor thing.
>
> Commit 76ecb4f2d7ea5c3aac8970b9529775316507c6d2 is displayed thusly:
>
>   commit 76ecb4f2d7ea5c3aac8970b9529775316507c6d2
>   Author: Zhang, Rui <[hidden email]>
>   Date:   Thu Apr 10 16:20:23 2008 +0800
>
>       ACPI: update thermal temperature
>
> but that isn't a valid email address.  Because it contains a comma it
> must be quoted:  "Zhang, Rui".

The email address is [hidden email].

The name is Zhang, Rui.

Git at no point ever mixes the two up. It's _not_ one field ("Zhang, Rui
<[hidden email]>"), it's literally two different parts that you set
separately, that just get shown (and encoded in the commit, for that
matter) in a way that resembles a single email address.

> I assume that something in the git toolchain removed his quotes, and
> that was arguably incorrect.

No, it would be incorrect to keep them, because the name doesn't contain
the quotes. The name is just that

        Zhang, Rui

part.

I've considered having the email->name detection change "A, B" into "B A",
but it's not always right, so it doesn't try to munge the names it finds
in other ways except to remove obvious crud from the ends.

And Andrew, this is true of Signed-off-by: lines too, btw. If you actually
want to send emails to them, _then_ you need to add quotes to follow the
email rules.

                Linus
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to [hidden email]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Reply | Threaded
Open this post in threaded view
|

Re: email address handling

Andrew Morton-9
On Fri, 1 Aug 2008 12:34:58 -0700 (PDT)
Linus Torvalds <[hidden email]> wrote:

> And Andrew, this is true of Signed-off-by: lines too, btw. If you actually
> want to send emails to them, _then_ you need to add quotes to follow the
> email rules.

That's how I noticed it - copied, pasted, MTA barfed.

Converting a usable name+email-address into an unusable one seems ... unuseful.
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to [hidden email]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Reply | Threaded
Open this post in threaded view
|

Re: email address handling

Linus Torvalds-3


On Fri, 1 Aug 2008, Andrew Morton wrote:
>
> That's how I noticed it - copied, pasted, MTA barfed.
>
> Converting a usable name+email-address into an unusable one seems ... unuseful.

Umm. Those signed-off ones weren't even _converted_ They were written by
people.

Also, you seemed to miss the point that it's not a name+email-address.

It's a name. Oh, and there's an email address too. But they aren't
connected. We often just print out the name *without* the email address.
Why should those things have to know about some totally irrelevant email
quoting rules? They weren't emails, didn't know about it, and didn't care.

                        Linus
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to [hidden email]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Reply | Threaded
Open this post in threaded view
|

Re: email address handling

Junio C Hamano
In reply to this post by Andrew Morton-9
Andrew Morton <[hidden email]> writes:

> On Fri, 1 Aug 2008 12:34:58 -0700 (PDT)
> Linus Torvalds <[hidden email]> wrote:
>
>> And Andrew, this is true of Signed-off-by: lines too, btw. If you actually
>> want to send emails to them, _then_ you need to add quotes to follow the
>> email rules.
>
> That's how I noticed it - copied, pasted, MTA barfed.
>
> Converting a usable name+email-address into an unusable one seems ... unuseful.

Name is used not just for pasting into your MUA.  For example, if your
shortlog output showed this, it would be "funny looking":

    "Zhang, Rui" (4):
            ...

    Andrew Morton (20):
            ...
            ...
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to [hidden email]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Reply | Threaded
Open this post in threaded view
|

Re: email address handling

Junio C Hamano
In reply to this post by Linus Torvalds-3
Linus Torvalds <[hidden email]> writes:

> On Fri, 1 Aug 2008, Andrew Morton wrote:
>>
>> That's how I noticed it - copied, pasted, MTA barfed.
>>
>> Converting a usable name+email-address into an unusable one seems ... unuseful.
>
> Umm. Those signed-off ones weren't even _converted_ They were written by
> people.
>
> Also, you seemed to miss the point that it's not a name+email-address.
>
> It's a name. Oh, and there's an email address too. But they aren't
> connected. We often just print out the name *without* the email address.
> Why should those things have to know about some totally irrelevant email
> quoting rules? They weren't emails, didn't know about it, and didn't care.

One place that can matter is git-send-email.perl; IIRC, it reads from the
S-o-b:, Cc: and From: lines people write, and these follow "name next to
address, that does not care irrelevant email quoting rules" format.  I do
not think send-email currently does much about quoting them, but I think
it should be the right place to do so.

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to [hidden email]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Reply | Threaded
Open this post in threaded view
|

Re: email address handling

Andrew Morton-9
In reply to this post by Linus Torvalds-3
On Fri, 1 Aug 2008 12:56:44 -0700 (PDT)
Linus Torvalds <[hidden email]> wrote:

>
>
> On Fri, 1 Aug 2008, Andrew Morton wrote:
> >
> > That's how I noticed it - copied, pasted, MTA barfed.
> >
> > Converting a usable name+email-address into an unusable one seems ... unuseful.
>
> Umm. Those signed-off ones weren't even _converted_ They were written by
> people.

This was the Author: line.

Afaik that person doesn't send patches via git, and that this text by
some means was transferred into git from an emailed patch.

So unless he explicitly typed a "From:" line (without quoting his name)
into the top of his changelog, some piece of software somewhere has
stripped the quotes when it was converting his name from the email
headers into the git Author: line.

> Also, you seemed to miss the point that it's not a name+email-address.

I know exactly what it is.

> It's a name. Oh, and there's an email address too. But they aren't
> connected. We often just print out the name *without* the email address.
> Why should those things have to know about some totally irrelevant email
> quoting rules? They weren't emails, didn't know about it, and didn't care.

Well, as I said, it's a minor point.  It's just that converting
something which _can_ be copied and pasted into an MUA into something
which cannot seems...  odd.

Most sane MUA's will omit the quotes if the name part does not need
them, so simply retaining the quotes if they were originally there
would be an OK thing to do.


So how serious is this issue?

Well, if all MUAs either generate synchronous error messages or will
insert the quotes for you then not very serious at all.

If, however, there are MUA+MTA combinations which do _not_ inform about
or correct the error then this failure to quote the name could cause
people's emails to get lost altogether, which is a bit serious.


Also, _most_ git Author: lines _can_ be successfully copied-and-pasted
into an MUA.  The fact that a small minority of git Author: lines cannot
be used this way is a bit dangerous.

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to [hidden email]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Reply | Threaded
Open this post in threaded view
|

Re: email address handling

Andrew Morton-9
In reply to this post by Junio C Hamano
On Fri, 01 Aug 2008 13:00:16 -0700
Junio C Hamano <[hidden email]> wrote:

> Andrew Morton <[hidden email]> writes:
>
> > On Fri, 1 Aug 2008 12:34:58 -0700 (PDT)
> > Linus Torvalds <[hidden email]> wrote:
> >
> >> And Andrew, this is true of Signed-off-by: lines too, btw. If you actually
> >> want to send emails to them, _then_ you need to add quotes to follow the
> >> email rules.
> >
> > That's how I noticed it - copied, pasted, MTA barfed.
> >
> > Converting a usable name+email-address into an unusable one seems ... unuseful.
>
> Name is used not just for pasting into your MUA.  For example, if your
> shortlog output showed this, it would be "funny looking":
>
>     "Zhang, Rui" (4):
>             ...
>
>     Andrew Morton (20):
>             ...
>             ...

yep.  That'd be a git-shortlog bug :)

I really don't care about this much!
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to [hidden email]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Reply | Threaded
Open this post in threaded view
|

Re: email address handling

Linus Torvalds-3
In reply to this post by Andrew Morton-9


On Fri, 1 Aug 2008, Andrew Morton wrote:
>
> This was the Author: line.

So?

I mean, it's not sending email, is it? It says "Author:".

You could have just inserted the actual email address. Or something.

                Linus
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to [hidden email]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Reply | Threaded
Open this post in threaded view
|

Re: email address handling

Andrew Morton-9
On Fri, 1 Aug 2008 13:17:11 -0700 (PDT)
Linus Torvalds <[hidden email]> wrote:

>
>
> On Fri, 1 Aug 2008, Andrew Morton wrote:
> >
> > This was the Author: line.
>
> So?

So all the other things I said.

> I mean, it's not sending email, is it? It says "Author:".
>
> You could have just inserted the actual email address. Or something.
>

pls read earlier email.
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to [hidden email]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Reply | Threaded
Open this post in threaded view
|

Re: email address handling

Linus Torvalds-3


On Fri, 1 Aug 2008, Andrew Morton wrote:
>
> pls read earlier email.

I did. It seems that your complaint is:

> So unless he explicitly typed a "From:" line (without quoting his name)
> into the top of his changelog, some piece of software somewhere has
> stripped the quotes when it was converting his name from the email
> headers into the git Author: line.

And yes, git will strip out all the crap and try to make it into a real
name.

The part _you_ don't seem to understand is that my point is

 - git changed that "From:" line to an "Author:" line

 - "git log" isn't an email system. It's a human-readable (and
   machine-parseable, for that matter) log.

If you want to turn it into emails, you need to follow the email rules.
You're cutting-and-pasting anyway, it's not like this is fundamentally
hard.

                Linus
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to [hidden email]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Reply | Threaded
Open this post in threaded view
|

Re: email address handling

Linus Torvalds-3


On Fri, 1 Aug 2008, Linus Torvalds wrote:
>
> If you want to turn it into emails, you need to follow the email rules.
> You're cutting-and-pasting anyway, it's not like this is fundamentally
> hard.

Btw, if sending emails was the _only_ thing that Author line was used for,
or even the main thing, then it would make sense to keep it in some email
format. But it really isn't. Sending emails to people is the _least_
common thing you do with it. Most of the time you just want to see the
name in a nice readable format.

                Linus
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to [hidden email]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Reply | Threaded
Open this post in threaded view
|

Re: email address handling

Andrew Morton-9
In reply to this post by Linus Torvalds-3
On Fri, 1 Aug 2008 13:40:00 -0700 (PDT)
Linus Torvalds <[hidden email]> wrote:

>
>
> On Fri, 1 Aug 2008, Andrew Morton wrote:
> >
> > pls read earlier email.
>
> I did. It seems that your complaint is:
>
> > So unless he explicitly typed a "From:" line (without quoting his name)
> > into the top of his changelog, some piece of software somewhere has
> > stripped the quotes when it was converting his name from the email
> > headers into the git Author: line.
>
> And yes, git will strip out all the crap and try to make it into a real
> name.
>
> The part _you_ don't seem to understand is that my point is
>
>  - git changed that "From:" line to an "Author:" line
>
>  - "git log" isn't an email system. It's a human-readable (and
>    machine-parseable, for that matter) log.

What you're describing here is some explicit or implicit git design
decision and then telling me how it's implemented.

Well, what I'm saying is that it was an incorrect design decision.

> If you want to turn it into emails, you need to follow the email rules.
> You're cutting-and-pasting anyway, it's not like this is fundamentally
> hard.

Here is a real story from a real user of your software:

I very very frequently copy and paste name+email address out of git
output and into an MUA.  Have done it thousands and thousands of times,
and it has always worked.  I'm sure that many others do the same thing.

Yesterday, I copied and pasted what _looked_ like a usable
name+email-address from some git output and into an MUA.  Unlike the
thousands of preceding times, it did not work.

I think it was reasonable of me to assume that it would work.  Blaming
the surprised and misled user for not understanding some earlier
internal design decision didn't satisfy him!

True story!  From a user.
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to [hidden email]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Reply | Threaded
Open this post in threaded view
|

Re: email address handling

Linus Torvalds-3


On Fri, 1 Aug 2008, Andrew Morton wrote:
>
> Well, what I'm saying is that it was an incorrect design decision.

And I'm saying that I disagree.

> Yesterday, I copied and pasted what _looked_ like a usable
> name+email-address from some git output and into an MUA.  Unlike the
> thousands of preceding times, it did not work.
>
> I think it was reasonable of me to assume that it would work.  Blaming
> the surprised and misled user for not understanding some earlier
> internal design decision didn't satisfy him!
>
> True story!  From a user.

Hey, there are tons of surprises in life. Users make mistakes and
assumptions that turn out to not be true. If you think you can avoid all
such issues, I think you aren't living in the real world.

You'll be shocked to hear that even the so-called _email_ address isn't
necessarily valid at all at times. Look closer, and you'll find email
addresses that don't work at all. It turns out that if you don't set it
explicitly, git will guess, and sometimes the end result won't actually
work as an email address.

Beign surprised and then saying "I was surprised, so the whole design is
broken" - that's a very silly standpoint to make. I suggest you
reconsider. How many times have you had people "surprised" by correct
kernel behaviour? Happens all the time.

Do you think they are all indicative of bad design, or maybe just "welcome
to the real world - your preconceived notions didn't turn out to be
accurate after all"?

It's a design decision to show the name as readably as possible. One that
I think was correct.

                        Linus
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to [hidden email]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Reply | Threaded
Open this post in threaded view
|

Re: email address handling

Johannes Schindelin
In reply to this post by Andrew Morton-9
Hi,

On Fri, 1 Aug 2008, Andrew Morton wrote:

> I very very frequently copy and paste name+email address out of git
> output and into an MUA.  Have done it thousands and thousands of times,
> and it has always worked.  I'm sure that many others do the same thing.

$ git log --pretty=email

after this patch:

-- snipsnap --

 pretty.c |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)

diff --git a/pretty.c b/pretty.c
index 33ef34a..ba50b54 100644
--- a/pretty.c
+++ b/pretty.c
@@ -140,14 +140,20 @@ void pp_user_info(const char *what, enum cmit_fmt fmt, struct strbuf *sb,
  if (fmt == CMIT_FMT_EMAIL) {
  char *name_tail = strchr(line, '<');
  int display_name_length;
+ int need_quotes;
  if (!name_tail)
  return;
  while (line < name_tail && isspace(name_tail[-1]))
  name_tail--;
  display_name_length = name_tail - line;
+ need_quotes = !!memchr(line, ',', display_name_length);
  filler = "";
  strbuf_addstr(sb, "From: ");
+ if (need_quotes)
+ strbuf_addch(sb, '"');
  add_rfc2047(sb, line, display_name_length, encoding);
+ if (need_quotes)
+ strbuf_addch(sb, '"');
  strbuf_add(sb, name_tail, namelen - display_name_length);
  strbuf_addch(sb, '\n');
  } else {
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to [hidden email]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Reply | Threaded
Open this post in threaded view
|

Re: email address handling

Junio C Hamano
Johannes Schindelin <[hidden email]> writes:

> On Fri, 1 Aug 2008, Andrew Morton wrote:
>
>> I very very frequently copy and paste name+email address out of git
>> output and into an MUA.  Have done it thousands and thousands of times,
>> and it has always worked.  I'm sure that many others do the same thing.

>
> $ git log --pretty=email
>
> after this patch:

You are quoting only Author: and not Signed-off-by: and Cc: that are used
for e-mail purposes.  I already said send-email is the right place to do
this kind of thing, didn't I?  Your patch makes things worse by making
some <name, mail> pair already quoted and some others don't.

Please don't do this.

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to [hidden email]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Reply | Threaded
Open this post in threaded view
|

Re: email address handling

Junio C Hamano
In reply to this post by Andrew Morton-9
Andrew Morton <[hidden email]> writes:

>> The part _you_ don't seem to understand is that my point is
>>
>>  - git changed that "From:" line to an "Author:" line
>>
>>  - "git log" isn't an email system. It's a human-readable (and
>>    machine-parseable, for that matter) log.
>
> What you're describing here is some explicit or implicit git design
> decision and then telling me how it's implemented.
>
> Well, what I'm saying is that it was an incorrect design decision.

What is the objective of your statement in this discussion?  Further add
fuel to flame, or to seek avenues that lead to some improvement in a
constructive way?

The thing is, I do not think reverting that design decision is an option
at this point.  People's repositories record <Name, Email> pair already in
"human readable" form, and people's scripts are assuming that.

I misspoke about git-send-email earlier; it already has sanitize_address()
that massages the addresses on From: To: and Cc: lines.  In fact, it even
seems to have logic to avoid double-quoting, so it would be Ok if you
changed the design decision this late in the game for that particular
script, but that does not mean it is a good change --- other scripts
people may have built around git would need to change.

So the earlier patch from Dscho (Johannes) may be a step in the right
direction, but if we are going to rewrite the author information, (1) it
has to be an option, and (2) when rewriting, it should not be just From:;
but Signed-off-by:, Cc: and other <Name, Email> pairs at the end of the
log message would need similar treatment, so that you can cut and paste
any of them to your MUA.

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to [hidden email]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Reply | Threaded
Open this post in threaded view
|

Re: email address handling

Andrew Morton-9
On Fri, 01 Aug 2008 14:50:05 -0700
Junio C Hamano <[hidden email]> wrote:

> Andrew Morton <[hidden email]> writes:
>
> >> The part _you_ don't seem to understand is that my point is
> >>
> >>  - git changed that "From:" line to an "Author:" line
> >>
> >>  - "git log" isn't an email system. It's a human-readable (and
> >>    machine-parseable, for that matter) log.
> >
> > What you're describing here is some explicit or implicit git design
> > decision and then telling me how it's implemented.
> >
> > Well, what I'm saying is that it was an incorrect design decision.
>
> What is the objective of your statement in this discussion?  Further add
> fuel to flame, or to seek avenues that lead to some improvement in a
> constructive way?

Well initially it was to work out why the heck my git-log output had
stripped the quotes from that person's name, making it unusable for
email purposes.  I'd actually assumed that it was a bug.

> The thing is, I do not think reverting that design decision is an option
> at this point.  People's repositories record <Name, Email> pair already in
> "human readable" form, and people's scripts are assuming that.
>
> I misspoke about git-send-email earlier; it already has sanitize_address()
> that massages the addresses on From: To: and Cc: lines.  In fact, it even
> seems to have logic to avoid double-quoting, so it would be Ok if you
> changed the design decision this late in the game for that particular
> script, but that does not mean it is a good change --- other scripts
> people may have built around git would need to change.
>
> So the earlier patch from Dscho (Johannes) may be a step in the right
> direction, but if we are going to rewrite the author information, (1) it
> has to be an option, and (2) when rewriting, it should not be just From:;
> but Signed-off-by:, Cc: and other <Name, Email> pairs at the end of the
> log message would need similar treatment, so that you can cut and paste
> any of them to your MUA.

I preserve the quotes (when present) in signoffs for this exact reason.

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to [hidden email]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Reply | Threaded
Open this post in threaded view
|

Re: email address handling

Ted Ts'o
On Fri, Aug 01, 2008 at 02:58:04PM -0700, Andrew Morton wrote:
>
> I preserve the quotes (when present) in signoffs for this exact reason.
>

Heh.  I include quotes in my Signed-off-by:

Signed-off-by: "Theodore Ts'o" <[hidden email]>

Because I assumed the format of the DCO was an RFC-822 compliant
header format.  It otherwise *looks* like an RFC-822 format, so I
assumed it should follow all of the rules, including the ones about
quoting.

How about this as a compromise?  Git continues to store the names in
its internal format as it always does, but there is a configuration
option which controls whether the various Author: and Committer:
fields when displayd by git-log are in RFC-822 format or not.  

                            - Ted
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to [hidden email]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Reply | Threaded
Open this post in threaded view
|

Re: email address handling

Linus Torvalds-3
In reply to this post by Andrew Morton-9


On Fri, 1 Aug 2008, Andrew Morton wrote:
>
> I preserve the quotes (when present) in signoffs for this exact reason.

You must be one of the few ones. According to the RFC's, you should quote
pretty much any punctuation mark, including "." itself. Which means that
things like

        Signed-off-by: David S. Miller <[hidden email]>

should be quoted if they were email addresses.

That would be very irritating.

It's even _more_ irritating for things like D'Souza (or Giuseppe D'Eliseo
to take a real example from the kernel).  For David, we could just not use
the "S." - for others, the special characters are very much part of the
name. It would also be very irritating for important messages like

        Signed-off-by: Linus "I'm a moron" Torvalds <[hidden email]>

etc, where it sure as heck isn't a rfc2822-compliant email address.

So the thing is, "strict email format" is just very annoying. Git does
know how to do (well, it _should_) it for "git send-email", but making the
human-readable output ugly just because somebody might want to
cut-and-paste it sounds really sad.

You could cut-and-paste just the stuff inside the angle branckets, though.
That should work.

                Linus
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to [hidden email]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
123