{"thread":{"id":"19918","subject":"names using git config","startedAt":"2009-06-24T16:58:40Z","lastAt":"2009-06-25T18:46:17Z","messageCount":6,"participants":["Ryan","Matthieu Moy","Junio C Hamano"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"116870","messageId":"376636be0906240958l70c81b68g83340556f2bf4eca@mail.gmail.com","threadId":"19918","inReplyTo":null,"subject":"names using git config","fromName":"Ryan","fromEmail":"ryanphilips19@googlemail.com","sentAt":"2009-06-24T16:58:40Z","receivedAt":"2009-06-24T16:58:40Z","isPatch":false,"sender":{"key":"ryanphilips19@googlemail.com","avatar":null},"body":"How do i select a Name which ends in a dot something like Ryan W.\nPhilips in Git using  git config user.name\n\nBecause when i do that \"Ryan W. Philips\" It just comes and Ryan W\nPhilips in git log when i add a commit.\n\n\nThanks,\nRyan\n"},{"id":"116871","messageId":"vpqljnhv9w0.fsf@bauges.imag.fr","threadId":"19918","inReplyTo":"376636be0906240958l70c81b68g83340556f2bf4eca@mail.gmail.com","subject":"Re: names using git config","fromName":"Matthieu Moy","fromEmail":"matthieu.moy@imag.fr","sentAt":"2009-06-24T17:06:55Z","receivedAt":"2009-06-24T17:06:55Z","isPatch":false,"sender":{"key":"git@matthieu-moy.fr","avatar":"https://avatars.githubusercontent.com/u/14709?v=4"},"body":"Ryan <ryanphilips19@googlemail.com> writes:\n\n> How do i select a Name which ends in a dot something like Ryan W.\n> Philips in Git using  git config user.name\n>\n> Because when i do that \"Ryan W. Philips\" It just comes and Ryan W\n> Philips in git log when i add a commit.\n\nCan't reproduce here:\n\n$ mkdir git\n$ cd git/\n$ git init\nInitialized empty Git repository in /tmp/git/.git/\n$ git config user.name 'Matthieu M. Moy'\n$ cat .git/config \n[core]\n        repositoryformatversion = 0\n        filemode = true\n        bare = false\n        logallrefupdates = true\n[user]\n        name = Matthieu M. Moy\n$ touch foo; git add foo\n$ git commit -m \"foo\"\n[master (root-commit) 6814174] foo\n 0 files changed, 0 insertions(+), 0 deletions(-)\n create mode 100644 foo\n$ git log\ncommit 681417491423260ad13c3fb59c28fc96a68bf4f9\nAuthor: Matthieu M. Moy <Matthieu.Moy@imag.fr>\nDate:   Wed Jun 24 19:05:43 2009 +0200\n\n    foo\n$ git version\ngit version 1.6.3.rc1.35.gabb3a\n$ \n\n-- \nMatthieu\n"},{"id":"116901","messageId":"376636be0906242146h1d4c3b1q8c2e9af26f124af4@mail.gmail.com","threadId":"19918","inReplyTo":"vpqljnhv9w0.fsf@bauges.imag.fr","subject":"Re: names using git config","fromName":"Ryan","fromEmail":"ryanphilips19@googlemail.com","sentAt":"2009-06-25T04:46:56Z","receivedAt":"2009-06-25T04:46:56Z","isPatch":false,"sender":{"key":"ryanphilips19@googlemail.com","avatar":null},"body":"Hi,\n  Thank you for your response.\n\n1) git config user.name 'Matthieu M. Moy' Works\n2) git config user.name 'Matthieu M.'  does not\n\n\nProbably, Name cannot end in a '.' <dot>. in git config user.name\n\n\nRegards,\nRyan W.\n\n\nOn Wed, Jun 24, 2009 at 10:36 PM, Matthieu Moy<Matthieu.Moy@imag.fr> wrote:\n> Ryan <ryanphilips19@googlemail.com> writes:\n>\n>> How do i select a Name which ends in a dot something like Ryan W.\n>> Philips in Git using  git config user.name\n>>\n>> Because when i do that \"Ryan W. Philips\" It just comes and Ryan W\n>> Philips in git log when i add a commit.\n>\n> Can't reproduce here:\n>\n> $ mkdir git\n> $ cd git/\n> $ git init\n> Initialized empty Git repository in /tmp/git/.git/\n> $ git config user.name 'Matthieu M. Moy'\n> $ cat .git/config\n> [core]\n>        repositoryformatversion = 0\n>        filemode = true\n>        bare = false\n>        logallrefupdates = true\n> [user]\n>        name = Matthieu M. Moy\n> $ touch foo; git add foo\n> $ git commit -m \"foo\"\n> [master (root-commit) 6814174] foo\n>  0 files changed, 0 insertions(+), 0 deletions(-)\n>  create mode 100644 foo\n> $ git log\n> commit 681417491423260ad13c3fb59c28fc96a68bf4f9\n> Author: Matthieu M. Moy <Matthieu.Moy@imag.fr>\n> Date:   Wed Jun 24 19:05:43 2009 +0200\n>\n>    foo\n> $ git version\n> git version 1.6.3.rc1.35.gabb3a\n> $\n>\n> --\n> Matthieu\n>\n"},{"id":"116903","messageId":"7veit8kidz.fsf@alter.siamese.dyndns.org","threadId":"19918","inReplyTo":"376636be0906242146h1d4c3b1q8c2e9af26f124af4@mail.gmail.com","subject":"Re: names using git config","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2009-06-25T05:11:04Z","receivedAt":"2009-06-25T05:11:04Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Ryan <ryanphilips19@googlemail.com> writes:\n\n> Hi,\n>   Thank you for your response.\n>\n> 1) git config user.name 'Matthieu M. Moy' Works\n> 2) git config user.name 'Matthieu M.'  does not\n>\n> Name cannot end in a '.' <dot>. in git config user.name\n\nThat is correct, but I think we are a bit too strict in sanitizing names.\nThe code is ident.c::copy() whose intent was to sanitize useless runs of\ncommas we slurp from GECOS field, but the sanitization is done also for\nanything specified by the end user.\n\nThis patch loosens it, but I think it goes too far, in that it does not\nstop you from feeding total nonsense with GIT_AUTHOR_NAME environment and\nuser.name configuration.\n\n ident.c                |    5 ++---\n t/t1300-repo-config.sh |   12 ++++++++++++\n 2 files changed, 14 insertions(+), 3 deletions(-)\n\ndiff --git a/ident.c b/ident.c\nindex 99f1c85..07ec81d 100644\n--- a/ident.c\n+++ b/ident.c\n@@ -212,8 +212,7 @@ const char *fmt_ident(const char *name, const char *email,\n \t\tpw = getpwuid(getuid());\n \t\tif (!pw)\n \t\t\tdie(\"You don't exist. Go away!\");\n-\t\tstrlcpy(git_default_name, pw->pw_name,\n-\t\t\tsizeof(git_default_name));\n+\t\tcopy(git_default_name, sizeof(git_default_name), 0, pw->pw_name);\n \t\tname = git_default_name;\n \t}\n \n@@ -221,7 +220,7 @@ const char *fmt_ident(const char *name, const char *email,\n \tif (!name_addr_only && date_str)\n \t\tparse_date(date_str, date, sizeof(date));\n \n-\ti = copy(buffer, sizeof(buffer), 0, name);\n+\ti = add_raw(buffer, sizeof(buffer), 0, name);\n \ti = add_raw(buffer, sizeof(buffer), i, \" <\");\n \ti = copy(buffer, sizeof(buffer), i, email);\n \tif (!name_addr_only) {\ndiff --git a/t/t1300-repo-config.sh b/t/t1300-repo-config.sh\nindex 43ea283..c1a913e 100755\n--- a/t/t1300-repo-config.sh\n+++ b/t/t1300-repo-config.sh\n@@ -758,4 +758,16 @@ test_expect_success 'check split_cmdline return' \"\n \ttest_must_fail git merge master\n \t\"\n \n+test_expect_success 'name ending in dot' '\n+\tfoobar=\"Foo Bar.\"\n+\tgit config user.name \"$foobar\" &&\n+\tgit config user.email \"foo.bar@example.com\" &&\n+\ttest \"$(git config user.name)\" = \"$foobar\" &&\n+\t(\n+\t\tunset GIT_AUTHOR_NAME\n+\t\tident=$(git var GIT_AUTHOR_IDENT | sed -e \"s/ *<.*//\") &&\n+\t\ttest \"$ident\" = \"$foobar\"\n+\t)\n+'\n+\n test_done\n"},{"id":"116916","messageId":"376636be0906250309h6eb99296r4b81cf22985b690a@mail.gmail.com","threadId":"19918","inReplyTo":"7veit8kidz.fsf@alter.siamese.dyndns.org","subject":"Re: names using git config","fromName":"Ryan","fromEmail":"ryanphilips19@googlemail.com","sentAt":"2009-06-25T10:09:11Z","receivedAt":"2009-06-25T10:09:11Z","isPatch":false,"sender":{"key":"ryanphilips19@googlemail.com","avatar":null},"body":"On Thu, Jun 25, 2009 at 10:41 AM, Junio C Hamano<gitster@pobox.com> wrote:\n> Ryan <ryanphilips19@googlemail.com> writes:\n>\n>> Hi,\n>>   Thank you for your response.\n>>\n>> 1) git config user.name 'Matthieu M. Moy' Works\n>> 2) git config user.name 'Matthieu M.'  does not\n>>\n>> Name cannot end in a '.' <dot>. in git config user.name\n>\n> That is correct, but I think we are a bit too strict in sanitizing names.\n> The code is ident.c::copy() whose intent was to sanitize useless runs of\n> commas we slurp from GECOS field, but the sanitization is done also for\n> anything specified by the end user.\n>\n\n\nWhat are you suggesting me to do? Apply the below patch.\nI may want to submit patches to the linux kernel. Is this okay? Or\nwill this (below patch)\non machine will later at some point of time cause trouble to people\napplying the patches.\n\nDoes git am or git apply check if name ends in a \".\" and do something?\n\n\nThank you,\n\nRyan W.\n\n\n\n\n\n> This patch loosens it, but I think it goes too far, in that it does not\n> stop you from feeding total nonsense with GIT_AUTHOR_NAME environment and\n> user.name configuration.\n>\n>  ident.c                |    5 ++---\n>  t/t1300-repo-config.sh |   12 ++++++++++++\n>  2 files changed, 14 insertions(+), 3 deletions(-)\n>\n> diff --git a/ident.c b/ident.c\n> index 99f1c85..07ec81d 100644\n> --- a/ident.c\n> +++ b/ident.c\n> @@ -212,8 +212,7 @@ const char *fmt_ident(const char *name, const char *email,\n>                pw = getpwuid(getuid());\n>                if (!pw)\n>                        die(\"You don't exist. Go away!\");\n> -               strlcpy(git_default_name, pw->pw_name,\n> -                       sizeof(git_default_name));\n> +               copy(git_default_name, sizeof(git_default_name), 0, pw->pw_name);\n>                name = git_default_name;\n>        }\n>\n> @@ -221,7 +220,7 @@ const char *fmt_ident(const char *name, const char *email,\n>        if (!name_addr_only && date_str)\n>                parse_date(date_str, date, sizeof(date));\n>\n> -       i = copy(buffer, sizeof(buffer), 0, name);\n> +       i = add_raw(buffer, sizeof(buffer), 0, name);\n>        i = add_raw(buffer, sizeof(buffer), i, \" <\");\n>        i = copy(buffer, sizeof(buffer), i, email);\n>        if (!name_addr_only) {\n> diff --git a/t/t1300-repo-config.sh b/t/t1300-repo-config.sh\n> index 43ea283..c1a913e 100755\n> --- a/t/t1300-repo-config.sh\n> +++ b/t/t1300-repo-config.sh\n> @@ -758,4 +758,16 @@ test_expect_success 'check split_cmdline return' \"\n>        test_must_fail git merge master\n>        \"\n>\n> +test_expect_success 'name ending in dot' '\n> +       foobar=\"Foo Bar.\"\n> +       git config user.name \"$foobar\" &&\n> +       git config user.email \"foo.bar@example.com\" &&\n> +       test \"$(git config user.name)\" = \"$foobar\" &&\n> +       (\n> +               unset GIT_AUTHOR_NAME\n> +               ident=$(git var GIT_AUTHOR_IDENT | sed -e \"s/ *<.*//\") &&\n> +               test \"$ident\" = \"$foobar\"\n> +       )\n> +'\n> +\n>  test_done\n>\n"},{"id":"116956","messageId":"7vy6rgb18m.fsf@alter.siamese.dyndns.org","threadId":"19918","inReplyTo":"376636be0906250309h6eb99296r4b81cf22985b690a@mail.gmail.com","subject":"Re: names using git config","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2009-06-25T18:46:17Z","receivedAt":"2009-06-25T18:46:17Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Ryan <ryanphilips19@googlemail.com> writes:\n\n> On Thu, Jun 25, 2009 at 10:41 AM, Junio C Hamano<gitster@pobox.com> wrote:\n>> Ryan <ryanphilips19@googlemail.com> writes:\n>>\n>>> Hi,\n>>>   Thank you for your response.\n>>>\n>>> 1) git config user.name 'Matthieu M. Moy' Works\n>>> 2) git config user.name 'Matthieu M.'  does not\n>>>\n>>> Name cannot end in a '.' <dot>. in git config user.name\n>>\n>> That is correct, but I think we are a bit too strict in sanitizing names.\n>> The code is ident.c::copy() whose intent was to sanitize useless runs of\n>> commas we slurp from GECOS field, but the sanitization is done also for\n>> anything specified by the end user.\n>\n> What are you suggesting me to do? Apply the below patch.\n> I may want to submit patches to the linux kernel. Is this okay?\n\nSorry if I was unclear.  I wasn't suggesting anything in particular to\nyou.  The only concrete thing addressed to you in my message was the\nanswer \"That is correct\" and all the remainder of my message, including\nthe patch, was primarily meant as illustration for other git developers to\nthink about.\n\nI do not think this matters that much in practice, as long as you are\nsubmitting patches via e-mail, the usual method for leaf-level developers.\nThe maintainers apply your patches under the name your e-mail's From:\nheader carries, not your user.name.\n\nIf you apply the patch to your copy of git, your \"git log\" output will\nstart showing otherwise forbidden names that have leading or trailing dots\n(and other letters like semicolons) because your modified copy of \"git\ncommit\" will allow them, and I think \"git commit -s\" also will pass the\ntrailing dots intact, but that is about the extent of the damage.  Without\napplying the patch, you will perhaps see your \"Signed-off-by: Foo M\n<foo.m@example.com>\" line without the trailing dots after the name, but\nthat is something you can easily modify in your MUA when you are sending\nthe e-mail out.\n"}]}