# [REGRESSION] uninitialized value $address in git send-email

15 messages from 2023-09-18 to 2023-09-22. Participants: Bagas Sanjaya, Taylor Blau, Junio C Hamano, Michael Strawbridge, Jeff King.
Thread: https://gitlist.dev/t/60239

## Bagas Sanjaya, 2023-09-18 12:56

Subject: [REGRESSION] uninitialized value $address in git send-email
Message-ID: <ZQhI5fMhDE82awpE@debian.me>
URL: https://gitlist.dev/e/ZQhI5fMhDE82awpE%40debian.me

```
Hi,

Recently when I was submitting doc fixes to linux-doc mailing list [1]
using git-send-email(1), I got perl-related error:

ˋˋˋ
Use of uninitialized value $address in sprintf at /home/bagas/.app/git/dist/v2.42.0/libexec/git-core/git-send-email line 1172.
error: unable to extract a valid address from:
ˋˋˋ

My linux.git clone has sendemail-validate hook which uses patatt (from b4
package). The hook is:

ˋˋˋ
#!/bin/sh
# installed by patatt install-hook
patatt sign --hook "${1}"
ˋˋˋ

This issue occurs on Git v2.41.0 but not in v2.40.0. Bisecting, the culprit is
commit a8022c5f7b67 (send-email: expose header information to git-send-email's
sendemail-validate hook, 2023-04-19). Emily's earlier report [2] also points to
the same culprit, but with different bug.

I triggered this issue on patch series with cover letter. To reproduce:

1. Clone git.git repo, then branch off:

   ˋˋˋ
   $ git clone https://github.com/git/git.git && cd git
   $ git checkout -b test
   ˋˋˋ

2. Make two dummy signed-off commits:

   ˋˋˋ
   $ echo test > test && git add test && git commit -s -m "test"
   $ echo "test test" >> test && git commit -a -s -m "test test"
   ˋˋˋ

3. Generate patch series:

   ˋˋˋ
   $ mkdir /tmp/test
   $ git format-patch -o /tmp/test --cover-letter main
   ˋˋˋ

4. Send the series to dummy address:

   ˋˋˋ
   $ git send-email --to="pi <pi@pi>" /tmp/test/*.patch
   ˋˋˋ

git-send-email(1) trips on the cover letter since there is no recipient
addresses detected. It also errored out on patches without Signed-off-by
trailer. When the command should have been succeeded, I expected that it
asked me whether to send each patch or not.

My system runs Debian testing (trixie/sid) with perl 5.36.0.

Thanks.

[1]: https://lore.kernel.org/linux-doc/20230918093240.29824-1-bagasdotme@gmail.com/
[2]: https://lore.kernel.org/git/CAJoAoZ=GGgjGOeaeo6RFBO7=6msdRf-Ze6XcnL04K5ugupLUJA@mail.gmail.com/

-- 
An old man doll... just what I always wanted! - Clara

```

## Taylor Blau, 2023-09-18 16:35

Subject: [PATCH] git-send-email.perl: avoid printing undef when validating addresses
Message-ID: <545729b619308c6f3397b9aa1747f26ddc58f461.1695054945.git.me@ttaylorr.com>
URL: https://gitlist.dev/e/545729b619308c6f3397b9aa1747f26ddc58f461.1695054945.git.me%40ttaylorr.com
In-Reply-To: <ZQhI5fMhDE82awpE@debian.me>

```
When validating email addresses with `extract_valid_address_or_die()`,
we print out a helpful error message when the given input does not
contain a valid email address.

However, the pre-image of this patch looks something like:

    my $address = shift;
    $address = extract_valid_address($address):
    die sprintf(__("..."), $address) if !$address;

which fails when given a bogus email address by trying to use $address
(which is undef) in a sprintf() expansion, like so:

    $ git.compile send-email --to="pi <pi@pi>" /tmp/x/*.patch --force
    Use of uninitialized value $address in sprintf at /home/ttaylorr/src/git/git-send-email line 1175.
    error: unable to extract a valid address from:

This regression dates back to e431225569 (git-send-email: remove invalid
addresses earlier, 2012-11-22), but became more noticeable in a8022c5f7b
(send-email: expose header information to git-send-email's
sendemail-validate hook, 2023-04-19), which validates SMTP headers in
the sendemail-validate hook.

Avoid trying to format an undef by storing the given and cleaned address
separately. After applying this fix, the error contains the invalid
email address, and the warning disappears:

    $ git.compile send-email --to="pi <pi@pi>" /tmp/x/*.patch --force
    error: unable to extract a valid address from: pi <pi@pi>

Reported-by: Bagas Sanjaya <bagasdotme@gmail.com>
Signed-off-by: Taylor Blau <me@ttaylorr.com>
---
 git-send-email.perl | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/git-send-email.perl b/git-send-email.perl
index 897cea6564..288ea1ae80 100755
--- a/git-send-email.perl
+++ b/git-send-email.perl
@@ -1166,10 +1166,10 @@ sub extract_valid_address {
 
 sub extract_valid_address_or_die {
 	my $address = shift;
-	$address = extract_valid_address($address);
+	my $valid_address = extract_valid_address($address);
 	die sprintf(__("error: unable to extract a valid address from: %s\n"), $address)
-		if !$address;
-	return $address;
+		if !$valid_address;
+	return $valid_address;
 }
 
 sub validate_address {
-- 
2.42.0.217.g5402a90ddb

```

## Junio C Hamano, 2023-09-18 19:04

Subject: Re: [PATCH] git-send-email.perl: avoid printing undef when validating addresses
Message-ID: <xmqq5y47l2vg.fsf@gitster.g>
URL: https://gitlist.dev/e/xmqq5y47l2vg.fsf%40gitster.g
In-Reply-To: <545729b619308c6f3397b9aa1747f26ddc58f461.1695054945.git.me@ttaylorr.com>

```
Taylor Blau <me@ttaylorr.com> writes:

> diff --git a/git-send-email.perl b/git-send-email.perl
> index 897cea6564..288ea1ae80 100755
> --- a/git-send-email.perl
> +++ b/git-send-email.perl
> @@ -1166,10 +1166,10 @@ sub extract_valid_address {
>  
>  sub extract_valid_address_or_die {
>  	my $address = shift;
> +	my $valid_address = extract_valid_address($address);
>  	die sprintf(__("error: unable to extract a valid address from: %s\n"), $address)
> +		if !$valid_address;
> +	return $valid_address;

This will still use undef if the incoming $address is already undef,
but the caller deserves what it gets in such a case.  The message
reports that the %s is the source from which the code tried to
extract the address from, not the result of failed extraction, so
the rewrite is absolutely the right thing to do.

Will queue.  Thanks.


>  }
>  
>  sub validate_address {

```

## Michael Strawbridge, 2023-09-18 20:26

Subject: Re: [REGRESSION] uninitialized value $address in git send-email
Message-ID: <8fcd6d2a-2c16-adf9-da1f-6b9d6fdcc87a@amd.com>
URL: https://gitlist.dev/e/8fcd6d2a-2c16-adf9-da1f-6b9d6fdcc87a%40amd.com
In-Reply-To: <ZQhI5fMhDE82awpE@debian.me>

```
Hi,

Author of a8022c5f7b67 (send-email: expose header information to
git-send-email's sendemail-validate hook, 2023-04-19) here.

On 2023-09-18 08:56, Bagas Sanjaya wrote:
> Hi,
>
> Recently when I was submitting doc fixes to linux-doc mailing list [1]
> using git-send-email(1), I got perl-related error:
>
> ˋˋˋ
> Use of uninitialized value $address in sprintf at /home/bagas/.app/git/dist/v2.42.0/libexec/git-core/git-send-email line 1172.
> error: unable to extract a valid address from:
> ˋˋˋ
>
> My linux.git clone has sendemail-validate hook which uses patatt (from b4
> package). The hook is:
>
> ˋˋˋ
> #!/bin/sh
> # installed by patatt install-hook
> patatt sign --hook "${1}"
> ˋˋˋ
>
> This issue occurs on Git v2.41.0 but not in v2.40.0. Bisecting, the culprit is
> commit a8022c5f7b67 (send-email: expose header information to git-send-email's
> sendemail-validate hook, 2023-04-19). Emily's earlier report [2] also points to
> the same culprit, but with different bug.
>
> I triggered this issue on patch series with cover letter. To reproduce:
>
> 1. Clone git.git repo, then branch off:
>
>    ˋˋˋ
>    $ git clone https://github.com/git/git.git && cd git
>    $ git checkout -b test
>    ˋˋˋ
>
> 2. Make two dummy signed-off commits:
>
>    ˋˋˋ
>    $ echo test > test && git add test && git commit -s -m "test"
>    $ echo "test test" >> test && git commit -a -s -m "test test"
>    ˋˋˋ
>
> 3. Generate patch series:
>
>    ˋˋˋ
>    $ mkdir /tmp/test
>    $ git format-patch -o /tmp/test --cover-letter main
>    ˋˋˋ
>
> 4. Send the series to dummy address:
>
>    ˋˋˋ
>    $ git send-email --to="pi <pi@pi>" /tmp/test/*.patch
>    ˋˋˋ

I tried to repro this today on my side.  I can repro the error when
using the address "pi <pi@pi>" but that's not a valid email address and
so one would expect it to fail in the extract_valid_address_or_die
function with the error that you mention.  As soon as I make the address
valid like "pi <pi@pi.com>", git send-email no longer complains.

In your original case, are you trying to send email to an invalid email
address?  Is it an alias by chance?

Thanks.

> git-send-email(1) trips on the cover letter since there is no recipient
> addresses detected. It also errored out on patches without Signed-off-by
> trailer. When the command should have been succeeded, I expected that it
> asked me whether to send each patch or not.
>
> My system runs Debian testing (trixie/sid) with perl 5.36.0.
>
> Thanks.
>
> [1]: https://lore.kernel.org/linux-doc/20230918093240.29824-1-bagasdotme@gmail.com/
> [2]: https://lore.kernel.org/git/CAJoAoZ=GGgjGOeaeo6RFBO7=6msdRf-Ze6XcnL04K5ugupLUJA@mail.gmail.com/
>

```

## Jeff King, 2023-09-18 21:20

Subject: Re: [PATCH] git-send-email.perl: avoid printing undef when validating addresses
Message-ID: <20230918212004.GC2163162@coredump.intra.peff.net>
URL: https://gitlist.dev/e/20230918212004.GC2163162%40coredump.intra.peff.net
In-Reply-To: <545729b619308c6f3397b9aa1747f26ddc58f461.1695054945.git.me@ttaylorr.com>

```
On Mon, Sep 18, 2023 at 12:35:53PM -0400, Taylor Blau wrote:

> When validating email addresses with `extract_valid_address_or_die()`,
> we print out a helpful error message when the given input does not
> contain a valid email address.
> 
> However, the pre-image of this patch looks something like:
> 
>     my $address = shift;
>     $address = extract_valid_address($address):
>     die sprintf(__("..."), $address) if !$address;
> 
> which fails when given a bogus email address by trying to use $address
> (which is undef) in a sprintf() expansion, like so:
> 
>     $ git.compile send-email --to="pi <pi@pi>" /tmp/x/*.patch --force
>     Use of uninitialized value $address in sprintf at /home/ttaylorr/src/git/git-send-email line 1175.
>     error: unable to extract a valid address from:

Yeah, we overwrite the variable we're reporting on, so I don't think the
original could possibly work. Your fix makes sense.

> This regression dates back to e431225569 (git-send-email: remove invalid
> addresses earlier, 2012-11-22), but became more noticeable in a8022c5f7b
> (send-email: expose header information to git-send-email's
> sendemail-validate hook, 2023-04-19), which validates SMTP headers in
> the sendemail-validate hook.

I didn't quite understand how a8022c5f7b made this worse, but I guess we
just call it the bad function in more instances. The bug is definitely
from e431225569, though.

-Peff

```

## Bagas Sanjaya, 2023-09-19 04:44

Subject: Re: [REGRESSION] uninitialized value $address in git send-email
Message-ID: <ZQknHjKdGZV3vJpV@debian.me>
URL: https://gitlist.dev/e/ZQknHjKdGZV3vJpV%40debian.me
In-Reply-To: <8fcd6d2a-2c16-adf9-da1f-6b9d6fdcc87a@amd.com>

```
On Mon, Sep 18, 2023 at 04:26:44PM -0400, Michael Strawbridge wrote:
> Hi,
> 
> Author of a8022c5f7b67 (send-email: expose header information to
> git-send-email's sendemail-validate hook, 2023-04-19) here.
> 
> On 2023-09-18 08:56, Bagas Sanjaya wrote:
> > I triggered this issue on patch series with cover letter. To reproduce:
> >
> > 1. Clone git.git repo, then branch off:
> >
> >    ˋˋˋ
> >    $ git clone https://github.com/git/git.git && cd git
> >    $ git checkout -b test
> >    ˋˋˋ
> >
> > 2. Make two dummy signed-off commits:
> >
> >    ˋˋˋ
> >    $ echo test > test && git add test && git commit -s -m "test"
> >    $ echo "test test" >> test && git commit -a -s -m "test test"
> >    ˋˋˋ
> >
> > 3. Generate patch series:
> >
> >    ˋˋˋ
> >    $ mkdir /tmp/test
> >    $ git format-patch -o /tmp/test --cover-letter main
> >    ˋˋˋ
> >
> > 4. Send the series to dummy address:
> >
> >    ˋˋˋ
> >    $ git send-email --to="pi <pi@pi>" /tmp/test/*.patch
> >    ˋˋˋ
> 
> I tried to repro this today on my side.  I can repro the error when
> using the address "pi <pi@pi>" but that's not a valid email address and
> so one would expect it to fail in the extract_valid_address_or_die
> function with the error that you mention.  As soon as I make the address
> valid like "pi <pi@pi.com>", git send-email no longer complains.
> 
> In your original case, are you trying to send email to an invalid email
> address?  Is it an alias by chance?

I triggered this regression when I passed multiple addresses separated by comma
(like `--to="foo <foo@acme.com>,bar <bar@acme.com>"`, but somehow I managed to
reduce the trigger to one address only (in this case, "pi <pi@pi.com>"). As for
multiple addresses part, let me know if I should post another regression
report.

-- 
An old man doll... just what I always wanted! - Clara

```

## Michael Strawbridge, 2023-09-19 14:04

Subject: Re: [REGRESSION] uninitialized value $address in git send-email
Message-ID: <4eb0d21b-be43-529a-bfdd-3f1d2b4d3e84@amd.com>
URL: https://gitlist.dev/e/4eb0d21b-be43-529a-bfdd-3f1d2b4d3e84%40amd.com
In-Reply-To: <ZQknHjKdGZV3vJpV@debian.me>

```

On 2023-09-19 00:44, Bagas Sanjaya wrote:
> On Mon, Sep 18, 2023 at 04:26:44PM -0400, Michael Strawbridge wrote:
>> Hi,
>>
>> Author of a8022c5f7b67 (send-email: expose header information to
>> git-send-email's sendemail-validate hook, 2023-04-19) here.
>>
>> On 2023-09-18 08:56, Bagas Sanjaya wrote:
>>> I triggered this issue on patch series with cover letter. To reproduce:
>>>
>>> 1. Clone git.git repo, then branch off:
>>>
>>>    ˋˋˋ
>>>    $ git clone https://github.com/git/git.git && cd git
>>>    $ git checkout -b test
>>>    ˋˋˋ
>>>
>>> 2. Make two dummy signed-off commits:
>>>
>>>    ˋˋˋ
>>>    $ echo test > test && git add test && git commit -s -m "test"
>>>    $ echo "test test" >> test && git commit -a -s -m "test test"
>>>    ˋˋˋ
>>>
>>> 3. Generate patch series:
>>>
>>>    ˋˋˋ
>>>    $ mkdir /tmp/test
>>>    $ git format-patch -o /tmp/test --cover-letter main
>>>    ˋˋˋ
>>>
>>> 4. Send the series to dummy address:
>>>
>>>    ˋˋˋ
>>>    $ git send-email --to="pi <pi@pi>" /tmp/test/*.patch
>>>    ˋˋˋ
>> I tried to repro this today on my side.  I can repro the error when
>> using the address "pi <pi@pi>" but that's not a valid email address and
>> so one would expect it to fail in the extract_valid_address_or_die
>> function with the error that you mention.  As soon as I make the address
>> valid like "pi <pi@pi.com>", git send-email no longer complains.
>>
>> In your original case, are you trying to send email to an invalid email
>> address?  Is it an alias by chance?
> I triggered this regression when I passed multiple addresses separated by comma
> (like `--to="foo <foo@acme.com>,bar <bar@acme.com>"`, but somehow I managed to
> reduce the trigger to one address only (in this case, "pi <pi@pi.com>"). As for
> multiple addresses part, let me know if I should post another regression
> report.
>
Hm.  I'm not sure what to say.  I have used the below docker container
as a test environment and don't seem to find issues with 'git send-email
--to="pi <pi@pi.com>" /email/test/*.patch' nor with 'git send-email
--to="foo <foo@acme.com>,bar <bar@acme.com>" /email/test/*.patch'.

Maybe if you could try the following test environment too and see if you
can reproduce it inside the docker container:

NOTE: I assume you install docker on your system

Step 1) Create folder with the below files inside

Dockerfile:

...

FROM debian:trixie

RUN apt-get update && \
    apt-get install -y git git-email vim

WORKDIR /

RUN git clone https://github.com/git/git.git && \
    cd git && \
    git checkout -b test

#COPY git-send-email /usr/lib/git-core/git-send-email

RUN git config --global user.email "you@example.com"
RUN git config --global user.name "Your Name"

#specific error case
RUN cd git && echo '#!/bin/sh \n\
patatt sign --hook "${1}"' > .git/hooks/sendemail-validate

RUN cd git && echo test > test && git add test && git commit -s -m "test"
RUN cd git && echo "test test" >> test && git commit -a -s -m "test test"
RUN mkdir -p /email/test
RUN cd git && git format-patch -o /email/test --cover-letter master
RUN sed -i 's/\*\*\* SUBJECT HERE \*\*\*/test/'
/email/test/0000-cover-letter.patch

...


run.sh:

...

#!/bin/sh

sudo docker stop git-send-email-debug
sudo docker rm git-send-email-debug

sudo docker build -t git-send-email-debug:latest .

sudo docker run -it --name git-send-email-debug git-send-email-debug:latest

...


Step 2) Make run.sh executable and start run.sh to create docker
container shell.  Inside the container's shell (will pop up
automatically) please try this:

git send-email --to="foo <foo@acme.com>,bar <bar@acme.com>"
/email/test/*.patch


Please let me know the results of the test case above and any other
things you try that have interesting results.


Thank you!


```

## Michael Strawbridge, 2023-09-19 14:37

Subject: Re: [REGRESSION] uninitialized value $address in git send-email
Message-ID: <118975ef-c07f-c397-5288-7698e60516a7@amd.com>
URL: https://gitlist.dev/e/118975ef-c07f-c397-5288-7698e60516a7%40amd.com
In-Reply-To: <4eb0d21b-be43-529a-bfdd-3f1d2b4d3e84@amd.com>

```

On 2023-09-19 10:04, Michael Strawbridge wrote:
> On 2023-09-19 00:44, Bagas Sanjaya wrote:
>> On Mon, Sep 18, 2023 at 04:26:44PM -0400, Michael Strawbridge wrote:
>>> Hi,
>>>
>>> Author of a8022c5f7b67 (send-email: expose header information to
>>> git-send-email's sendemail-validate hook, 2023-04-19) here.
>>>
>>> On 2023-09-18 08:56, Bagas Sanjaya wrote:
>>>> I triggered this issue on patch series with cover letter. To reproduce:
>>>>
>>>> 1. Clone git.git repo, then branch off:
>>>>
>>>>    ˋˋˋ
>>>>    $ git clone https://github.com/git/git.git && cd git
>>>>    $ git checkout -b test
>>>>    ˋˋˋ
>>>>
>>>> 2. Make two dummy signed-off commits:
>>>>
>>>>    ˋˋˋ
>>>>    $ echo test > test && git add test && git commit -s -m "test"
>>>>    $ echo "test test" >> test && git commit -a -s -m "test test"
>>>>    ˋˋˋ
>>>>
>>>> 3. Generate patch series:
>>>>
>>>>    ˋˋˋ
>>>>    $ mkdir /tmp/test
>>>>    $ git format-patch -o /tmp/test --cover-letter main
>>>>    ˋˋˋ
>>>>
>>>> 4. Send the series to dummy address:
>>>>
>>>>    ˋˋˋ
>>>>    $ git send-email --to="pi <pi@pi>" /tmp/test/*.patch
>>>>    ˋˋˋ
>>> I tried to repro this today on my side.  I can repro the error when
>>> using the address "pi <pi@pi>" but that's not a valid email address and
>>> so one would expect it to fail in the extract_valid_address_or_die
>>> function with the error that you mention.  As soon as I make the address
>>> valid like "pi <pi@pi.com>", git send-email no longer complains.
>>>
>>> In your original case, are you trying to send email to an invalid email
>>> address?  Is it an alias by chance?
>> I triggered this regression when I passed multiple addresses separated by comma
>> (like `--to="foo <foo@acme.com>,bar <bar@acme.com>"`, but somehow I managed to
>> reduce the trigger to one address only (in this case, "pi <pi@pi.com>"). As for
>> multiple addresses part, let me know if I should post another regression
>> report.
>>
> Hm.  I'm not sure what to say.  I have used the below docker container
> as a test environment and don't seem to find issues with 'git send-email
> --to="pi <pi@pi.com>" /email/test/*.patch' nor with 'git send-email
> --to="foo <foo@acme.com>,bar <bar@acme.com>" /email/test/*.patch'.
>
> Maybe if you could try the following test environment too and see if you
> can reproduce it inside the docker container:
>
> NOTE: I assume you install docker on your system
>
> Step 1) Create folder with the below files inside
>
> Dockerfile:
>
> ...
>
> FROM debian:trixie
>
> RUN apt-get update && \
>     apt-get install -y git git-email vim
>
> WORKDIR /
>
> RUN git clone https://github.com/git/git.git && \
>     cd git && \
>     git checkout -b test
>
> #COPY git-send-email /usr/lib/git-core/git-send-email
>
> RUN git config --global user.email "you@example.com"
> RUN git config --global user.name "Your Name"
>
> #specific error case
> RUN cd git && echo '#!/bin/sh \n\
> patatt sign --hook "${1}"' > .git/hooks/sendemail-validate
>
> RUN cd git && echo test > test && git add test && git commit -s -m "test"
> RUN cd git && echo "test test" >> test && git commit -a -s -m "test test"
> RUN mkdir -p /email/test
> RUN cd git && git format-patch -o /email/test --cover-letter master
> RUN sed -i 's/\*\*\* SUBJECT HERE \*\*\*/test/'
> /email/test/0000-cover-letter.patch
>
> ...
>
>
> run.sh:
>
> ...
>
> #!/bin/sh
>
> sudo docker stop git-send-email-debug
> sudo docker rm git-send-email-debug
>
> sudo docker build -t git-send-email-debug:latest .
>
> sudo docker run -it --name git-send-email-debug git-send-email-debug:latest
>
> ...
>
>
> Step 2) Make run.sh executable and start run.sh to create docker
> container shell.  Inside the container's shell (will pop up
> automatically) please try this:
>
> git send-email --to="foo <foo@acme.com>,bar <bar@acme.com>"
> /email/test/*.patch
>
>
> Please let me know the results of the test case above and any other
> things you try that have interesting results.
>
>
> Thank you!
>
Whoops, somehow I missed the other responses on this thread until I
looked on the web archive version of this mailing list.  I see that a
solution to "Use of uninitialized value $address" has already been proposed.

I suppose I may have mistook what issue was being reported.  I had
originally understood the problem to be that hook related logic was
failing with correct email addresses, but it seems rather that we are
trying to fix an error that occurs when an email address that fails
extract_valid_address_or_die() is given.  Feel free to ignore my last
email if that is all we are trying to solve.


```

## Bagas Sanjaya, 2023-09-20 11:00

Subject: Re: [REGRESSION] uninitialized value $address in git send-email
Message-ID: <ZQrQsa5GJEVhBttT@debian.me>
URL: https://gitlist.dev/e/ZQrQsa5GJEVhBttT%40debian.me
In-Reply-To: <118975ef-c07f-c397-5288-7698e60516a7@amd.com>

```
On Tue, Sep 19, 2023 at 10:37:36AM -0400, Michael Strawbridge wrote:
> I suppose I may have mistook what issue was being reported.  I had
> originally understood the problem to be that hook related logic was
> failing with correct email addresses, but it seems rather that we are
> trying to fix an error that occurs when an email address that fails
> extract_valid_address_or_die() is given.  Feel free to ignore my last
> email if that is all we are trying to solve.
> 

Originally, I was intended to report regression on handling multiple
addresses passed in a single --to/--cc/--bcc option. Previously on Git v2.40,
git-send-email(1) accepts `--to="foo <foo@foo.com>,bar <bar@bar.com>"
as two separate --to addresses (with comma as separator). However, on
v2.41 and up, instead I got perl error as I reported in this thread.
Interestingly, that perl error can be reduced into one invalid addresses.
The same thing also happens to --cc and --bcc. I used aforementioned
trick when I was sending patches to LKML to save frin typing the same
option multiple times, each with different address.

If I need to send separate regression report for above use case,
please let me know.

-- 
An old man doll... just what I always wanted! - Clara

```

## Michael Strawbridge, 2023-09-20 13:14

Subject: Re: [REGRESSION] uninitialized value $address in git send-email
Message-ID: <c15a6561-3105-df16-b74b-99e5dad63fa8@amd.com>
URL: https://gitlist.dev/e/c15a6561-3105-df16-b74b-99e5dad63fa8%40amd.com
In-Reply-To: <ZQrQsa5GJEVhBttT@debian.me>

```

On 2023-09-20 07:00, Bagas Sanjaya wrote:
> On Tue, Sep 19, 2023 at 10:37:36AM -0400, Michael Strawbridge wrote:
>> I suppose I may have mistook what issue was being reported.  I had
>> originally understood the problem to be that hook related logic was
>> failing with correct email addresses, but it seems rather that we are
>> trying to fix an error that occurs when an email address that fails
>> extract_valid_address_or_die() is given.  Feel free to ignore my last
>> email if that is all we are trying to solve.
>>
> Originally, I was intended to report regression on handling multiple
> addresses passed in a single --to/--cc/--bcc option. Previously on Git v2.40,
> git-send-email(1) accepts `--to="foo <foo@foo.com>,bar <bar@bar.com>"
> as two separate --to addresses (with comma as separator). However, on
> v2.41 and up, instead I got perl error as I reported in this thread.
> Interestingly, that perl error can be reduced into one invalid addresses.
> The same thing also happens to --cc and --bcc. I used aforementioned
> trick when I was sending patches to LKML to save frin typing the same
> option multiple times, each with different address.
>
> If I need to send separate regression report for above use case,
> please let me know.
>
I'm probably not the best person to answer whether you should file
another report.  Junio would know better the processes of this mailing list.

However, I believe that if you are just trying to have the
"uninitialized value $address" error disappear then the above patch by
Taylor Blau should work great.  Feel free to try it by editing your
local copy of git-send-email usually found here:
/usr/lib/git-core/git-send-email


```

## Junio C Hamano, 2023-09-20 15:36

Subject: Re: [REGRESSION] uninitialized value $address in git send-email
Message-ID: <xmqqcyycc0w9.fsf@gitster.g>
URL: https://gitlist.dev/e/xmqqcyycc0w9.fsf%40gitster.g
In-Reply-To: <118975ef-c07f-c397-5288-7698e60516a7@amd.com>

```
Michael Strawbridge <michael.strawbridge@amd.com> writes:

> Whoops, somehow I missed the other responses on this thread until I
> looked on the web archive version of this mailing list.  I see that a
> solution to "Use of uninitialized value $address" has already been proposed.
>
> I suppose I may have mistook what issue was being reported.  I had
> originally understood the problem to be that hook related logic was
> failing with correct email addresses, but it seems rather that we are
> trying to fix an error that occurs when an email address that fails
> extract_valid_address_or_die() is given.  Feel free to ignore my last
> email if that is all we are trying to solve.

I just had an impression that the original was complaining about the
command failing, and the patches addressed a side issue that the
error message that is given when the command fails uses an undefined
value.  The report was not quite clear what Bagas considerd a
regression (e.g. did the command allow an invalid address like <pi@pi>
but now it complains?), though.

```

## Junio C Hamano, 2023-09-20 15:43

Subject: Re: [REGRESSION] uninitialized value $address in git send-email
Message-ID: <xmqq7cokc0kj.fsf@gitster.g>
URL: https://gitlist.dev/e/xmqq7cokc0kj.fsf%40gitster.g
In-Reply-To: <ZQrQsa5GJEVhBttT@debian.me>

```
Bagas Sanjaya <bagasdotme@gmail.com> writes:

> Originally, I was intended to report regression on handling multiple
> addresses passed in a single --to/--cc/--bcc option.

You refer to v2.40 and v2.41 in the message I am responding to, but
do you have a bisection?  There seem to have been five topics around
send-email during that timeperiod.

 $ git log --oneline --first-parent v2.40.0..v2.41.0 git-send-email.perl
 b04671b638 Merge branch 'jc/send-email-pre-process-fix'
 64477d20d7 Merge branch 'mc/send-email-header-cmd'
 b6e9521956 Merge branch 'ms/send-email-feed-header-to-validate-hook'
 c4c9d5586f Merge branch 'rj/send-email-validate-hook-count-messages'
 647a2bb3ff Merge branch 'jc/spell-id-in-both-caps-in-message-id'

```

## Bagas Sanjaya, 2023-09-21 07:51

Subject: Re: [REGRESSION] uninitialized value $address in git send-email
Message-ID: <d6527c54-7dbc-46ee-b73d-49653edda0d9@gmail.com>
URL: https://gitlist.dev/e/d6527c54-7dbc-46ee-b73d-49653edda0d9%40gmail.com
In-Reply-To: <xmqq7cokc0kj.fsf@gitster.g>

```
On 20/09/2023 22:43, Junio C Hamano wrote:
> Bagas Sanjaya <bagasdotme@gmail.com> writes:
> 
>> Originally, I was intended to report regression on handling multiple
>> addresses passed in a single --to/--cc/--bcc option.
> 
> You refer to v2.40 and v2.41 in the message I am responding to, but
> do you have a bisection?  There seem to have been five topics around
> send-email during that timeperiod.
> 
>  $ git log --oneline --first-parent v2.40.0..v2.41.0 git-send-email.perl
>  b04671b638 Merge branch 'jc/send-email-pre-process-fix'
>  64477d20d7 Merge branch 'mc/send-email-header-cmd'
>  b6e9521956 Merge branch 'ms/send-email-feed-header-to-validate-hook'
>  c4c9d5586f Merge branch 'rj/send-email-validate-hook-count-messages'
>  647a2bb3ff Merge branch 'jc/spell-id-in-both-caps-in-message-id'

I'll make one on the separate report.

-- 
An old man doll... just what I always wanted! - Clara


```

## Junio C Hamano, 2023-09-21 20:42

Subject: Re: [REGRESSION] uninitialized value $address in git send-email
Message-ID: <xmqq1qer5kc0.fsf@gitster.g>
URL: https://gitlist.dev/e/xmqq1qer5kc0.fsf%40gitster.g
In-Reply-To: <d6527c54-7dbc-46ee-b73d-49653edda0d9@gmail.com>

```
Bagas Sanjaya <bagasdotme@gmail.com> writes:

> On 20/09/2023 22:43, Junio C Hamano wrote:
>> Bagas Sanjaya <bagasdotme@gmail.com> writes:
>> 
>>> Originally, I was intended to report regression on handling multiple
>>> addresses passed in a single --to/--cc/--bcc option.
>> 
>> You refer to v2.40 and v2.41 in the message I am responding to, but
>> do you have a bisection?  There seem to have been five topics around
>> send-email during that timeperiod.
>> 
>>  $ git log --oneline --first-parent v2.40.0..v2.41.0 git-send-email.perl
>>  b04671b638 Merge branch 'jc/send-email-pre-process-fix'
>>  64477d20d7 Merge branch 'mc/send-email-header-cmd'
>>  b6e9521956 Merge branch 'ms/send-email-feed-header-to-validate-hook'
>>  c4c9d5586f Merge branch 'rj/send-email-validate-hook-count-messages'
>>  647a2bb3ff Merge branch 'jc/spell-id-in-both-caps-in-message-id'
>
> I'll make one on the separate report.

Alright.  The next task from your end may be to see if you can
bisect to find which topic broke your expectation.

Thanks.

```

## Bagas Sanjaya, 2023-09-22 07:39

Subject: Re: [REGRESSION] uninitialized value $address in git send-email
Message-ID: <ZQ1EsX5ZwkAHgT4Z@debian.me>
URL: https://gitlist.dev/e/ZQ1EsX5ZwkAHgT4Z%40debian.me
In-Reply-To: <xmqq1qer5kc0.fsf@gitster.g>

```
On Thu, Sep 21, 2023 at 01:42:55PM -0700, Junio C Hamano wrote:
> Bagas Sanjaya <bagasdotme@gmail.com> writes:
> > I'll make one on the separate report.
> 
> Alright.  The next task from your end may be to see if you can
> bisect to find which topic broke your expectation.
> 

OK, thanks!

-- 
An old man doll... just what I always wanted! - Clara

```
