{"thread":{"id":"60239","subject":"[REGRESSION] uninitialized value $address in git send-email","startedAt":"2023-09-18T12:57:27Z","lastAt":"2023-09-22T07:39:51Z","messageCount":15,"participants":["Bagas Sanjaya","Taylor Blau","Junio C Hamano","Michael Strawbridge","Jeff King"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"481951","messageId":"ZQhI5fMhDE82awpE@debian.me","threadId":"60239","inReplyTo":null,"subject":"[REGRESSION] uninitialized value $address in git send-email","fromName":"Bagas Sanjaya","fromEmail":"bagasdotme@gmail.com","sentAt":"2023-09-18T12:56:05Z","receivedAt":"2023-09-18T12:57:27Z","isPatch":false,"sender":{"key":"bagasdotme@gmail.com","avatar":"https://avatars.githubusercontent.com/u/40219486?v=4"},"body":"Hi,\n\nRecently when I was submitting doc fixes to linux-doc mailing list [1]\nusing git-send-email(1), I got perl-related error:\n\n```\nUse of uninitialized value $address in sprintf at /home/bagas/.app/git/dist/v2.42.0/libexec/git-core/git-send-email line 1172.\nerror: unable to extract a valid address from:\n```\n\nMy linux.git clone has sendemail-validate hook which uses patatt (from b4\npackage). The hook is:\n\n```\n#!/bin/sh\n# installed by patatt install-hook\npatatt sign --hook \"${1}\"\n```\n\nThis issue occurs on Git v2.41.0 but not in v2.40.0. Bisecting, the culprit is\ncommit a8022c5f7b67 (send-email: expose header information to git-send-email's\nsendemail-validate hook, 2023-04-19). Emily's earlier report [2] also points to\nthe same culprit, but with different bug.\n\nI triggered this issue on patch series with cover letter. To reproduce:\n\n1. Clone git.git repo, then branch off:\n\n   ```\n   $ git clone https://github.com/git/git.git && cd git\n   $ git checkout -b test\n   ```\n\n2. Make two dummy signed-off commits:\n\n   ```\n   $ echo test > test && git add test && git commit -s -m \"test\"\n   $ echo \"test test\" >> test && git commit -a -s -m \"test test\"\n   ```\n\n3. Generate patch series:\n\n   ```\n   $ mkdir /tmp/test\n   $ git format-patch -o /tmp/test --cover-letter main\n   ```\n\n4. Send the series to dummy address:\n\n   ```\n   $ git send-email --to=\"pi <pi@pi>\" /tmp/test/*.patch\n   ```\n\ngit-send-email(1) trips on the cover letter since there is no recipient\naddresses detected. It also errored out on patches without Signed-off-by\ntrailer. When the command should have been succeeded, I expected that it\nasked me whether to send each patch or not.\n\nMy system runs Debian testing (trixie/sid) with perl 5.36.0.\n\nThanks.\n\n[1]: https://lore.kernel.org/linux-doc/20230918093240.29824-1-bagasdotme@gmail.com/\n[2]: https://lore.kernel.org/git/CAJoAoZ=GGgjGOeaeo6RFBO7=6msdRf-Ze6XcnL04K5ugupLUJA@mail.gmail.com/\n\n-- \nAn old man doll... just what I always wanted! - Clara\n"},{"id":"481962","messageId":"545729b619308c6f3397b9aa1747f26ddc58f461.1695054945.git.me@ttaylorr.com","threadId":"60239","inReplyTo":"ZQhI5fMhDE82awpE@debian.me","subject":"[PATCH] git-send-email.perl: avoid printing undef when validating addresses","fromName":"Taylor Blau","fromEmail":"me@ttaylorr.com","sentAt":"2023-09-18T16:35:53Z","receivedAt":"2023-09-18T16:40:12Z","isPatch":true,"sender":{"key":"me@ttaylorr.com","avatar":"https://avatars.githubusercontent.com/u/301000140?v=4"},"body":"When validating email addresses with `extract_valid_address_or_die()`,\nwe print out a helpful error message when the given input does not\ncontain a valid email address.\n\nHowever, the pre-image of this patch looks something like:\n\n    my $address = shift;\n    $address = extract_valid_address($address):\n    die sprintf(__(\"...\"), $address) if !$address;\n\nwhich fails when given a bogus email address by trying to use $address\n(which is undef) in a sprintf() expansion, like so:\n\n    $ git.compile send-email --to=\"pi <pi@pi>\" /tmp/x/*.patch --force\n    Use of uninitialized value $address in sprintf at /home/ttaylorr/src/git/git-send-email line 1175.\n    error: unable to extract a valid address from:\n\nThis regression dates back to e431225569 (git-send-email: remove invalid\naddresses earlier, 2012-11-22), but became more noticeable in a8022c5f7b\n(send-email: expose header information to git-send-email's\nsendemail-validate hook, 2023-04-19), which validates SMTP headers in\nthe sendemail-validate hook.\n\nAvoid trying to format an undef by storing the given and cleaned address\nseparately. After applying this fix, the error contains the invalid\nemail address, and the warning disappears:\n\n    $ git.compile send-email --to=\"pi <pi@pi>\" /tmp/x/*.patch --force\n    error: unable to extract a valid address from: pi <pi@pi>\n\nReported-by: Bagas Sanjaya <bagasdotme@gmail.com>\nSigned-off-by: Taylor Blau <me@ttaylorr.com>\n---\n git-send-email.perl | 6 +++---\n 1 file changed, 3 insertions(+), 3 deletions(-)\n\ndiff --git a/git-send-email.perl b/git-send-email.perl\nindex 897cea6564..288ea1ae80 100755\n--- a/git-send-email.perl\n+++ b/git-send-email.perl\n@@ -1166,10 +1166,10 @@ sub extract_valid_address {\n \n sub extract_valid_address_or_die {\n \tmy $address = shift;\n-\t$address = extract_valid_address($address);\n+\tmy $valid_address = extract_valid_address($address);\n \tdie sprintf(__(\"error: unable to extract a valid address from: %s\\n\"), $address)\n-\t\tif !$address;\n-\treturn $address;\n+\t\tif !$valid_address;\n+\treturn $valid_address;\n }\n \n sub validate_address {\n-- \n2.42.0.217.g5402a90ddb\n"},{"id":"481971","messageId":"xmqq5y47l2vg.fsf@gitster.g","threadId":"60239","inReplyTo":"545729b619308c6f3397b9aa1747f26ddc58f461.1695054945.git.me@ttaylorr.com","subject":"Re: [PATCH] git-send-email.perl: avoid printing undef when validating addresses","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2023-09-18T19:04:19Z","receivedAt":"2023-09-18T19:05:21Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Taylor Blau <me@ttaylorr.com> writes:\n\n> diff --git a/git-send-email.perl b/git-send-email.perl\n> index 897cea6564..288ea1ae80 100755\n> --- a/git-send-email.perl\n> +++ b/git-send-email.perl\n> @@ -1166,10 +1166,10 @@ sub extract_valid_address {\n>  \n>  sub extract_valid_address_or_die {\n>  \tmy $address = shift;\n> +\tmy $valid_address = extract_valid_address($address);\n>  \tdie sprintf(__(\"error: unable to extract a valid address from: %s\\n\"), $address)\n> +\t\tif !$valid_address;\n> +\treturn $valid_address;\n\nThis will still use undef if the incoming $address is already undef,\nbut the caller deserves what it gets in such a case.  The message\nreports that the %s is the source from which the code tried to\nextract the address from, not the result of failed extraction, so\nthe rewrite is absolutely the right thing to do.\n\nWill queue.  Thanks.\n\n\n>  }\n>  \n>  sub validate_address {\n"},{"id":"481974","messageId":"8fcd6d2a-2c16-adf9-da1f-6b9d6fdcc87a@amd.com","threadId":"60239","inReplyTo":"ZQhI5fMhDE82awpE@debian.me","subject":"Re: [REGRESSION] uninitialized value $address in git send-email","fromName":"Michael Strawbridge","fromEmail":"michael.strawbridge@amd.com","sentAt":"2023-09-18T20:26:44Z","receivedAt":"2023-09-18T20:26:54Z","isPatch":false,"sender":{"key":"michael.strawbridge@amd.com","avatar":null},"body":"Hi,\n\nAuthor of a8022c5f7b67 (send-email: expose header information to\ngit-send-email's sendemail-validate hook, 2023-04-19) here.\n\nOn 2023-09-18 08:56, Bagas Sanjaya wrote:\n> Hi,\n>\n> Recently when I was submitting doc fixes to linux-doc mailing list [1]\n> using git-send-email(1), I got perl-related error:\n>\n> ```\n> Use of uninitialized value $address in sprintf at /home/bagas/.app/git/dist/v2.42.0/libexec/git-core/git-send-email line 1172.\n> error: unable to extract a valid address from:\n> ```\n>\n> My linux.git clone has sendemail-validate hook which uses patatt (from b4\n> package). The hook is:\n>\n> ```\n> #!/bin/sh\n> # installed by patatt install-hook\n> patatt sign --hook \"${1}\"\n> ```\n>\n> This issue occurs on Git v2.41.0 but not in v2.40.0. Bisecting, the culprit is\n> commit a8022c5f7b67 (send-email: expose header information to git-send-email's\n> sendemail-validate hook, 2023-04-19). Emily's earlier report [2] also points to\n> the same culprit, but with different bug.\n>\n> I triggered this issue on patch series with cover letter. To reproduce:\n>\n> 1. Clone git.git repo, then branch off:\n>\n>    ```\n>    $ git clone https://github.com/git/git.git && cd git\n>    $ git checkout -b test\n>    ```\n>\n> 2. Make two dummy signed-off commits:\n>\n>    ```\n>    $ echo test > test && git add test && git commit -s -m \"test\"\n>    $ echo \"test test\" >> test && git commit -a -s -m \"test test\"\n>    ```\n>\n> 3. Generate patch series:\n>\n>    ```\n>    $ mkdir /tmp/test\n>    $ git format-patch -o /tmp/test --cover-letter main\n>    ```\n>\n> 4. Send the series to dummy address:\n>\n>    ```\n>    $ git send-email --to=\"pi <pi@pi>\" /tmp/test/*.patch\n>    ```\n\nI tried to repro this today on my side.  I can repro the error when\nusing the address \"pi <pi@pi>\" but that's not a valid email address and\nso one would expect it to fail in the extract_valid_address_or_die\nfunction with the error that you mention.  As soon as I make the address\nvalid like \"pi <pi@pi.com>\", git send-email no longer complains.\n\nIn your original case, are you trying to send email to an invalid email\naddress?  Is it an alias by chance?\n\nThanks.\n\n> git-send-email(1) trips on the cover letter since there is no recipient\n> addresses detected. It also errored out on patches without Signed-off-by\n> trailer. When the command should have been succeeded, I expected that it\n> asked me whether to send each patch or not.\n>\n> My system runs Debian testing (trixie/sid) with perl 5.36.0.\n>\n> Thanks.\n>\n> [1]: https://lore.kernel.org/linux-doc/20230918093240.29824-1-bagasdotme@gmail.com/\n> [2]: https://lore.kernel.org/git/CAJoAoZ=GGgjGOeaeo6RFBO7=6msdRf-Ze6XcnL04K5ugupLUJA@mail.gmail.com/\n>\n"},{"id":"481985","messageId":"20230918212004.GC2163162@coredump.intra.peff.net","threadId":"60239","inReplyTo":"545729b619308c6f3397b9aa1747f26ddc58f461.1695054945.git.me@ttaylorr.com","subject":"Re: [PATCH] git-send-email.perl: avoid printing undef when validating addresses","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2023-09-18T21:20:04Z","receivedAt":"2023-09-18T21:20:11Z","isPatch":true,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Mon, Sep 18, 2023 at 12:35:53PM -0400, Taylor Blau wrote:\n\n> When validating email addresses with `extract_valid_address_or_die()`,\n> we print out a helpful error message when the given input does not\n> contain a valid email address.\n> \n> However, the pre-image of this patch looks something like:\n> \n>     my $address = shift;\n>     $address = extract_valid_address($address):\n>     die sprintf(__(\"...\"), $address) if !$address;\n> \n> which fails when given a bogus email address by trying to use $address\n> (which is undef) in a sprintf() expansion, like so:\n> \n>     $ git.compile send-email --to=\"pi <pi@pi>\" /tmp/x/*.patch --force\n>     Use of uninitialized value $address in sprintf at /home/ttaylorr/src/git/git-send-email line 1175.\n>     error: unable to extract a valid address from:\n\nYeah, we overwrite the variable we're reporting on, so I don't think the\noriginal could possibly work. Your fix makes sense.\n\n> This regression dates back to e431225569 (git-send-email: remove invalid\n> addresses earlier, 2012-11-22), but became more noticeable in a8022c5f7b\n> (send-email: expose header information to git-send-email's\n> sendemail-validate hook, 2023-04-19), which validates SMTP headers in\n> the sendemail-validate hook.\n\nI didn't quite understand how a8022c5f7b made this worse, but I guess we\njust call it the bad function in more instances. The bug is definitely\nfrom e431225569, though.\n\n-Peff\n"},{"id":"482001","messageId":"ZQknHjKdGZV3vJpV@debian.me","threadId":"60239","inReplyTo":"8fcd6d2a-2c16-adf9-da1f-6b9d6fdcc87a@amd.com","subject":"Re: [REGRESSION] uninitialized value $address in git send-email","fromName":"Bagas Sanjaya","fromEmail":"bagasdotme@gmail.com","sentAt":"2023-09-19T04:44:14Z","receivedAt":"2023-09-19T04:44:21Z","isPatch":false,"sender":{"key":"bagasdotme@gmail.com","avatar":"https://avatars.githubusercontent.com/u/40219486?v=4"},"body":"On Mon, Sep 18, 2023 at 04:26:44PM -0400, Michael Strawbridge wrote:\n> Hi,\n> \n> Author of a8022c5f7b67 (send-email: expose header information to\n> git-send-email's sendemail-validate hook, 2023-04-19) here.\n> \n> On 2023-09-18 08:56, Bagas Sanjaya wrote:\n> > I triggered this issue on patch series with cover letter. To reproduce:\n> >\n> > 1. Clone git.git repo, then branch off:\n> >\n> >    ```\n> >    $ git clone https://github.com/git/git.git && cd git\n> >    $ git checkout -b test\n> >    ```\n> >\n> > 2. Make two dummy signed-off commits:\n> >\n> >    ```\n> >    $ echo test > test && git add test && git commit -s -m \"test\"\n> >    $ echo \"test test\" >> test && git commit -a -s -m \"test test\"\n> >    ```\n> >\n> > 3. Generate patch series:\n> >\n> >    ```\n> >    $ mkdir /tmp/test\n> >    $ git format-patch -o /tmp/test --cover-letter main\n> >    ```\n> >\n> > 4. Send the series to dummy address:\n> >\n> >    ```\n> >    $ git send-email --to=\"pi <pi@pi>\" /tmp/test/*.patch\n> >    ```\n> \n> I tried to repro this today on my side.  I can repro the error when\n> using the address \"pi <pi@pi>\" but that's not a valid email address and\n> so one would expect it to fail in the extract_valid_address_or_die\n> function with the error that you mention.  As soon as I make the address\n> valid like \"pi <pi@pi.com>\", git send-email no longer complains.\n> \n> In your original case, are you trying to send email to an invalid email\n> address?  Is it an alias by chance?\n\nI triggered this regression when I passed multiple addresses separated by comma\n(like `--to=\"foo <foo@acme.com>,bar <bar@acme.com>\"`, but somehow I managed to\nreduce the trigger to one address only (in this case, \"pi <pi@pi.com>\"). As for\nmultiple addresses part, let me know if I should post another regression\nreport.\n\n-- \nAn old man doll... just what I always wanted! - Clara\n"},{"id":"482013","messageId":"4eb0d21b-be43-529a-bfdd-3f1d2b4d3e84@amd.com","threadId":"60239","inReplyTo":"ZQknHjKdGZV3vJpV@debian.me","subject":"Re: [REGRESSION] uninitialized value $address in git send-email","fromName":"Michael Strawbridge","fromEmail":"michael.strawbridge@amd.com","sentAt":"2023-09-19T14:04:57Z","receivedAt":"2023-09-19T14:05:09Z","isPatch":false,"sender":{"key":"michael.strawbridge@amd.com","avatar":null},"body":"\nOn 2023-09-19 00:44, Bagas Sanjaya wrote:\n> On Mon, Sep 18, 2023 at 04:26:44PM -0400, Michael Strawbridge wrote:\n>> Hi,\n>>\n>> Author of a8022c5f7b67 (send-email: expose header information to\n>> git-send-email's sendemail-validate hook, 2023-04-19) here.\n>>\n>> On 2023-09-18 08:56, Bagas Sanjaya wrote:\n>>> I triggered this issue on patch series with cover letter. To reproduce:\n>>>\n>>> 1. Clone git.git repo, then branch off:\n>>>\n>>>    ```\n>>>    $ git clone https://github.com/git/git.git && cd git\n>>>    $ git checkout -b test\n>>>    ```\n>>>\n>>> 2. Make two dummy signed-off commits:\n>>>\n>>>    ```\n>>>    $ echo test > test && git add test && git commit -s -m \"test\"\n>>>    $ echo \"test test\" >> test && git commit -a -s -m \"test test\"\n>>>    ```\n>>>\n>>> 3. Generate patch series:\n>>>\n>>>    ```\n>>>    $ mkdir /tmp/test\n>>>    $ git format-patch -o /tmp/test --cover-letter main\n>>>    ```\n>>>\n>>> 4. Send the series to dummy address:\n>>>\n>>>    ```\n>>>    $ git send-email --to=\"pi <pi@pi>\" /tmp/test/*.patch\n>>>    ```\n>> I tried to repro this today on my side.  I can repro the error when\n>> using the address \"pi <pi@pi>\" but that's not a valid email address and\n>> so one would expect it to fail in the extract_valid_address_or_die\n>> function with the error that you mention.  As soon as I make the address\n>> valid like \"pi <pi@pi.com>\", git send-email no longer complains.\n>>\n>> In your original case, are you trying to send email to an invalid email\n>> address?  Is it an alias by chance?\n> I triggered this regression when I passed multiple addresses separated by comma\n> (like `--to=\"foo <foo@acme.com>,bar <bar@acme.com>\"`, but somehow I managed to\n> reduce the trigger to one address only (in this case, \"pi <pi@pi.com>\"). As for\n> multiple addresses part, let me know if I should post another regression\n> report.\n>\nHm.  I'm not sure what to say.  I have used the below docker container\nas a test environment and don't seem to find issues with 'git send-email\n--to=\"pi <pi@pi.com>\" /email/test/*.patch' nor with 'git send-email\n--to=\"foo <foo@acme.com>,bar <bar@acme.com>\" /email/test/*.patch'.\n\nMaybe if you could try the following test environment too and see if you\ncan reproduce it inside the docker container:\n\nNOTE: I assume you install docker on your system\n\nStep 1) Create folder with the below files inside\n\nDockerfile:\n\n...\n\nFROM debian:trixie\n\nRUN apt-get update && \\\n    apt-get install -y git git-email vim\n\nWORKDIR /\n\nRUN git clone https://github.com/git/git.git && \\\n    cd git && \\\n    git checkout -b test\n\n#COPY git-send-email /usr/lib/git-core/git-send-email\n\nRUN git config --global user.email \"you@example.com\"\nRUN git config --global user.name \"Your Name\"\n\n#specific error case\nRUN cd git && echo '#!/bin/sh \\n\\\npatatt sign --hook \"${1}\"' > .git/hooks/sendemail-validate\n\nRUN cd git && echo test > test && git add test && git commit -s -m \"test\"\nRUN cd git && echo \"test test\" >> test && git commit -a -s -m \"test test\"\nRUN mkdir -p /email/test\nRUN cd git && git format-patch -o /email/test --cover-letter master\nRUN sed -i 's/\\*\\*\\* SUBJECT HERE \\*\\*\\*/test/'\n/email/test/0000-cover-letter.patch\n\n...\n\n\nrun.sh:\n\n...\n\n#!/bin/sh\n\nsudo docker stop git-send-email-debug\nsudo docker rm git-send-email-debug\n\nsudo docker build -t git-send-email-debug:latest .\n\nsudo docker run -it --name git-send-email-debug git-send-email-debug:latest\n\n...\n\n\nStep 2) Make run.sh executable and start run.sh to create docker\ncontainer shell.  Inside the container's shell (will pop up\nautomatically) please try this:\n\ngit send-email --to=\"foo <foo@acme.com>,bar <bar@acme.com>\"\n/email/test/*.patch\n\n\nPlease let me know the results of the test case above and any other\nthings you try that have interesting results.\n\n\nThank you!\n\n"},{"id":"482014","messageId":"118975ef-c07f-c397-5288-7698e60516a7@amd.com","threadId":"60239","inReplyTo":"4eb0d21b-be43-529a-bfdd-3f1d2b4d3e84@amd.com","subject":"Re: [REGRESSION] uninitialized value $address in git send-email","fromName":"Michael Strawbridge","fromEmail":"michael.strawbridge@amd.com","sentAt":"2023-09-19T14:37:36Z","receivedAt":"2023-09-19T14:37:50Z","isPatch":false,"sender":{"key":"michael.strawbridge@amd.com","avatar":null},"body":"\nOn 2023-09-19 10:04, Michael Strawbridge wrote:\n> On 2023-09-19 00:44, Bagas Sanjaya wrote:\n>> On Mon, Sep 18, 2023 at 04:26:44PM -0400, Michael Strawbridge wrote:\n>>> Hi,\n>>>\n>>> Author of a8022c5f7b67 (send-email: expose header information to\n>>> git-send-email's sendemail-validate hook, 2023-04-19) here.\n>>>\n>>> On 2023-09-18 08:56, Bagas Sanjaya wrote:\n>>>> I triggered this issue on patch series with cover letter. To reproduce:\n>>>>\n>>>> 1. Clone git.git repo, then branch off:\n>>>>\n>>>>    ```\n>>>>    $ git clone https://github.com/git/git.git && cd git\n>>>>    $ git checkout -b test\n>>>>    ```\n>>>>\n>>>> 2. Make two dummy signed-off commits:\n>>>>\n>>>>    ```\n>>>>    $ echo test > test && git add test && git commit -s -m \"test\"\n>>>>    $ echo \"test test\" >> test && git commit -a -s -m \"test test\"\n>>>>    ```\n>>>>\n>>>> 3. Generate patch series:\n>>>>\n>>>>    ```\n>>>>    $ mkdir /tmp/test\n>>>>    $ git format-patch -o /tmp/test --cover-letter main\n>>>>    ```\n>>>>\n>>>> 4. Send the series to dummy address:\n>>>>\n>>>>    ```\n>>>>    $ git send-email --to=\"pi <pi@pi>\" /tmp/test/*.patch\n>>>>    ```\n>>> I tried to repro this today on my side.  I can repro the error when\n>>> using the address \"pi <pi@pi>\" but that's not a valid email address and\n>>> so one would expect it to fail in the extract_valid_address_or_die\n>>> function with the error that you mention.  As soon as I make the address\n>>> valid like \"pi <pi@pi.com>\", git send-email no longer complains.\n>>>\n>>> In your original case, are you trying to send email to an invalid email\n>>> address?  Is it an alias by chance?\n>> I triggered this regression when I passed multiple addresses separated by comma\n>> (like `--to=\"foo <foo@acme.com>,bar <bar@acme.com>\"`, but somehow I managed to\n>> reduce the trigger to one address only (in this case, \"pi <pi@pi.com>\"). As for\n>> multiple addresses part, let me know if I should post another regression\n>> report.\n>>\n> Hm.  I'm not sure what to say.  I have used the below docker container\n> as a test environment and don't seem to find issues with 'git send-email\n> --to=\"pi <pi@pi.com>\" /email/test/*.patch' nor with 'git send-email\n> --to=\"foo <foo@acme.com>,bar <bar@acme.com>\" /email/test/*.patch'.\n>\n> Maybe if you could try the following test environment too and see if you\n> can reproduce it inside the docker container:\n>\n> NOTE: I assume you install docker on your system\n>\n> Step 1) Create folder with the below files inside\n>\n> Dockerfile:\n>\n> ...\n>\n> FROM debian:trixie\n>\n> RUN apt-get update && \\\n>     apt-get install -y git git-email vim\n>\n> WORKDIR /\n>\n> RUN git clone https://github.com/git/git.git && \\\n>     cd git && \\\n>     git checkout -b test\n>\n> #COPY git-send-email /usr/lib/git-core/git-send-email\n>\n> RUN git config --global user.email \"you@example.com\"\n> RUN git config --global user.name \"Your Name\"\n>\n> #specific error case\n> RUN cd git && echo '#!/bin/sh \\n\\\n> patatt sign --hook \"${1}\"' > .git/hooks/sendemail-validate\n>\n> RUN cd git && echo test > test && git add test && git commit -s -m \"test\"\n> RUN cd git && echo \"test test\" >> test && git commit -a -s -m \"test test\"\n> RUN mkdir -p /email/test\n> RUN cd git && git format-patch -o /email/test --cover-letter master\n> RUN sed -i 's/\\*\\*\\* SUBJECT HERE \\*\\*\\*/test/'\n> /email/test/0000-cover-letter.patch\n>\n> ...\n>\n>\n> run.sh:\n>\n> ...\n>\n> #!/bin/sh\n>\n> sudo docker stop git-send-email-debug\n> sudo docker rm git-send-email-debug\n>\n> sudo docker build -t git-send-email-debug:latest .\n>\n> sudo docker run -it --name git-send-email-debug git-send-email-debug:latest\n>\n> ...\n>\n>\n> Step 2) Make run.sh executable and start run.sh to create docker\n> container shell.  Inside the container's shell (will pop up\n> automatically) please try this:\n>\n> git send-email --to=\"foo <foo@acme.com>,bar <bar@acme.com>\"\n> /email/test/*.patch\n>\n>\n> Please let me know the results of the test case above and any other\n> things you try that have interesting results.\n>\n>\n> Thank you!\n>\nWhoops, somehow I missed the other responses on this thread until I\nlooked on the web archive version of this mailing list.  I see that a\nsolution to \"Use of uninitialized value $address\" has already been proposed.\n\nI suppose I may have mistook what issue was being reported.  I had\noriginally understood the problem to be that hook related logic was\nfailing with correct email addresses, but it seems rather that we are\ntrying to fix an error that occurs when an email address that fails\nextract_valid_address_or_die() is given.  Feel free to ignore my last\nemail if that is all we are trying to solve.\n\n"},{"id":"482052","messageId":"ZQrQsa5GJEVhBttT@debian.me","threadId":"60239","inReplyTo":"118975ef-c07f-c397-5288-7698e60516a7@amd.com","subject":"Re: [REGRESSION] uninitialized value $address in git send-email","fromName":"Bagas Sanjaya","fromEmail":"bagasdotme@gmail.com","sentAt":"2023-09-20T11:00:01Z","receivedAt":"2023-09-20T11:00:10Z","isPatch":false,"sender":{"key":"bagasdotme@gmail.com","avatar":"https://avatars.githubusercontent.com/u/40219486?v=4"},"body":"On Tue, Sep 19, 2023 at 10:37:36AM -0400, Michael Strawbridge wrote:\n> I suppose I may have mistook what issue was being reported.  I had\n> originally understood the problem to be that hook related logic was\n> failing with correct email addresses, but it seems rather that we are\n> trying to fix an error that occurs when an email address that fails\n> extract_valid_address_or_die() is given.  Feel free to ignore my last\n> email if that is all we are trying to solve.\n> \n\nOriginally, I was intended to report regression on handling multiple\naddresses passed in a single --to/--cc/--bcc option. Previously on Git v2.40,\ngit-send-email(1) accepts `--to=\"foo <foo@foo.com>,bar <bar@bar.com>\"\nas two separate --to addresses (with comma as separator). However, on\nv2.41 and up, instead I got perl error as I reported in this thread.\nInterestingly, that perl error can be reduced into one invalid addresses.\nThe same thing also happens to --cc and --bcc. I used aforementioned\ntrick when I was sending patches to LKML to save frin typing the same\noption multiple times, each with different address.\n\nIf I need to send separate regression report for above use case,\nplease let me know.\n\n-- \nAn old man doll... just what I always wanted! - Clara\n"},{"id":"482063","messageId":"c15a6561-3105-df16-b74b-99e5dad63fa8@amd.com","threadId":"60239","inReplyTo":"ZQrQsa5GJEVhBttT@debian.me","subject":"Re: [REGRESSION] uninitialized value $address in git send-email","fromName":"Michael Strawbridge","fromEmail":"michael.strawbridge@amd.com","sentAt":"2023-09-20T13:14:02Z","receivedAt":"2023-09-20T13:14:13Z","isPatch":false,"sender":{"key":"michael.strawbridge@amd.com","avatar":null},"body":"\nOn 2023-09-20 07:00, Bagas Sanjaya wrote:\n> On Tue, Sep 19, 2023 at 10:37:36AM -0400, Michael Strawbridge wrote:\n>> I suppose I may have mistook what issue was being reported.  I had\n>> originally understood the problem to be that hook related logic was\n>> failing with correct email addresses, but it seems rather that we are\n>> trying to fix an error that occurs when an email address that fails\n>> extract_valid_address_or_die() is given.  Feel free to ignore my last\n>> email if that is all we are trying to solve.\n>>\n> Originally, I was intended to report regression on handling multiple\n> addresses passed in a single --to/--cc/--bcc option. Previously on Git v2.40,\n> git-send-email(1) accepts `--to=\"foo <foo@foo.com>,bar <bar@bar.com>\"\n> as two separate --to addresses (with comma as separator). However, on\n> v2.41 and up, instead I got perl error as I reported in this thread.\n> Interestingly, that perl error can be reduced into one invalid addresses.\n> The same thing also happens to --cc and --bcc. I used aforementioned\n> trick when I was sending patches to LKML to save frin typing the same\n> option multiple times, each with different address.\n>\n> If I need to send separate regression report for above use case,\n> please let me know.\n>\nI'm probably not the best person to answer whether you should file\nanother report.  Junio would know better the processes of this mailing list.\n\nHowever, I believe that if you are just trying to have the\n\"uninitialized value $address\" error disappear then the above patch by\nTaylor Blau should work great.  Feel free to try it by editing your\nlocal copy of git-send-email usually found here:\n/usr/lib/git-core/git-send-email\n\n"},{"id":"482074","messageId":"xmqqcyycc0w9.fsf@gitster.g","threadId":"60239","inReplyTo":"118975ef-c07f-c397-5288-7698e60516a7@amd.com","subject":"Re: [REGRESSION] uninitialized value $address in git send-email","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2023-09-20T15:36:22Z","receivedAt":"2023-09-20T15:36:28Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Michael Strawbridge <michael.strawbridge@amd.com> writes:\n\n> Whoops, somehow I missed the other responses on this thread until I\n> looked on the web archive version of this mailing list.  I see that a\n> solution to \"Use of uninitialized value $address\" has already been proposed.\n>\n> I suppose I may have mistook what issue was being reported.  I had\n> originally understood the problem to be that hook related logic was\n> failing with correct email addresses, but it seems rather that we are\n> trying to fix an error that occurs when an email address that fails\n> extract_valid_address_or_die() is given.  Feel free to ignore my last\n> email if that is all we are trying to solve.\n\nI just had an impression that the original was complaining about the\ncommand failing, and the patches addressed a side issue that the\nerror message that is given when the command fails uses an undefined\nvalue.  The report was not quite clear what Bagas considerd a\nregression (e.g. did the command allow an invalid address like <pi@pi>\nbut now it complains?), though.\n"},{"id":"482075","messageId":"xmqq7cokc0kj.fsf@gitster.g","threadId":"60239","inReplyTo":"ZQrQsa5GJEVhBttT@debian.me","subject":"Re: [REGRESSION] uninitialized value $address in git send-email","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2023-09-20T15:43:24Z","receivedAt":"2023-09-20T15:43:30Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Bagas Sanjaya <bagasdotme@gmail.com> writes:\n\n> Originally, I was intended to report regression on handling multiple\n> addresses passed in a single --to/--cc/--bcc option.\n\nYou refer to v2.40 and v2.41 in the message I am responding to, but\ndo you have a bisection?  There seem to have been five topics around\nsend-email during that timeperiod.\n\n $ git log --oneline --first-parent v2.40.0..v2.41.0 git-send-email.perl\n b04671b638 Merge branch 'jc/send-email-pre-process-fix'\n 64477d20d7 Merge branch 'mc/send-email-header-cmd'\n b6e9521956 Merge branch 'ms/send-email-feed-header-to-validate-hook'\n c4c9d5586f Merge branch 'rj/send-email-validate-hook-count-messages'\n 647a2bb3ff Merge branch 'jc/spell-id-in-both-caps-in-message-id'\n"},{"id":"482105","messageId":"d6527c54-7dbc-46ee-b73d-49653edda0d9@gmail.com","threadId":"60239","inReplyTo":"xmqq7cokc0kj.fsf@gitster.g","subject":"Re: [REGRESSION] uninitialized value $address in git send-email","fromName":"Bagas Sanjaya","fromEmail":"bagasdotme@gmail.com","sentAt":"2023-09-21T07:51:38Z","receivedAt":"2023-09-21T20:17:34Z","isPatch":false,"sender":{"key":"bagasdotme@gmail.com","avatar":"https://avatars.githubusercontent.com/u/40219486?v=4"},"body":"On 20/09/2023 22:43, Junio C Hamano wrote:\n> Bagas Sanjaya <bagasdotme@gmail.com> writes:\n> \n>> Originally, I was intended to report regression on handling multiple\n>> addresses passed in a single --to/--cc/--bcc option.\n> \n> You refer to v2.40 and v2.41 in the message I am responding to, but\n> do you have a bisection?  There seem to have been five topics around\n> send-email during that timeperiod.\n> \n>  $ git log --oneline --first-parent v2.40.0..v2.41.0 git-send-email.perl\n>  b04671b638 Merge branch 'jc/send-email-pre-process-fix'\n>  64477d20d7 Merge branch 'mc/send-email-header-cmd'\n>  b6e9521956 Merge branch 'ms/send-email-feed-header-to-validate-hook'\n>  c4c9d5586f Merge branch 'rj/send-email-validate-hook-count-messages'\n>  647a2bb3ff Merge branch 'jc/spell-id-in-both-caps-in-message-id'\n\nI'll make one on the separate report.\n\n-- \nAn old man doll... just what I always wanted! - Clara\n\n"},{"id":"482117","messageId":"xmqq1qer5kc0.fsf@gitster.g","threadId":"60239","inReplyTo":"d6527c54-7dbc-46ee-b73d-49653edda0d9@gmail.com","subject":"Re: [REGRESSION] uninitialized value $address in git send-email","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2023-09-21T20:42:55Z","receivedAt":"2023-09-21T21:58:59Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Bagas Sanjaya <bagasdotme@gmail.com> writes:\n\n> On 20/09/2023 22:43, Junio C Hamano wrote:\n>> Bagas Sanjaya <bagasdotme@gmail.com> writes:\n>> \n>>> Originally, I was intended to report regression on handling multiple\n>>> addresses passed in a single --to/--cc/--bcc option.\n>> \n>> You refer to v2.40 and v2.41 in the message I am responding to, but\n>> do you have a bisection?  There seem to have been five topics around\n>> send-email during that timeperiod.\n>> \n>>  $ git log --oneline --first-parent v2.40.0..v2.41.0 git-send-email.perl\n>>  b04671b638 Merge branch 'jc/send-email-pre-process-fix'\n>>  64477d20d7 Merge branch 'mc/send-email-header-cmd'\n>>  b6e9521956 Merge branch 'ms/send-email-feed-header-to-validate-hook'\n>>  c4c9d5586f Merge branch 'rj/send-email-validate-hook-count-messages'\n>>  647a2bb3ff Merge branch 'jc/spell-id-in-both-caps-in-message-id'\n>\n> I'll make one on the separate report.\n\nAlright.  The next task from your end may be to see if you can\nbisect to find which topic broke your expectation.\n\nThanks.\n"},{"id":"482125","messageId":"ZQ1EsX5ZwkAHgT4Z@debian.me","threadId":"60239","inReplyTo":"xmqq1qer5kc0.fsf@gitster.g","subject":"Re: [REGRESSION] uninitialized value $address in git send-email","fromName":"Bagas Sanjaya","fromEmail":"bagasdotme@gmail.com","sentAt":"2023-09-22T07:39:29Z","receivedAt":"2023-09-22T07:39:51Z","isPatch":false,"sender":{"key":"bagasdotme@gmail.com","avatar":"https://avatars.githubusercontent.com/u/40219486?v=4"},"body":"On Thu, Sep 21, 2023 at 01:42:55PM -0700, Junio C Hamano wrote:\n> Bagas Sanjaya <bagasdotme@gmail.com> writes:\n> > I'll make one on the separate report.\n> \n> Alright.  The next task from your end may be to see if you can\n> bisect to find which topic broke your expectation.\n> \n\nOK, thanks!\n\n-- \nAn old man doll... just what I always wanted! - Clara\n"}]}