git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Michael Strawbridge <michael.strawbridge@amd.com>
To: "Bagas Sanjaya" <bagasdotme@gmail.com>,
	"Junio C Hamano" <gitster@pobox.com>,
	"Luben Tuikov" <luben.tuikov@amd.com>,
	"Ævar Arnfjörð Bjarmason" <avarab@gmail.com>,
	"Emily Shaffer" <nasamuffin@google.com>,
	"Doug Anderson" <dianders@chromium.org>
Cc: Git Mailing List <git@vger.kernel.org>
Subject: Re: [REGRESSION] uninitialized value $address in git send-email
Date: Tue, 19 Sep 2023 10:04:57 -0400	[thread overview]
Message-ID: <4eb0d21b-be43-529a-bfdd-3f1d2b4d3e84@amd.com> (raw)
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!


  reply	other threads:[~2023-09-19 14:06 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-09-18 12:56 [REGRESSION] uninitialized value $address in git send-email Bagas Sanjaya
2023-09-18 16:35 ` [PATCH] git-send-email.perl: avoid printing undef when validating addresses Taylor Blau
2023-09-18 19:04   ` Junio C Hamano
2023-09-18 21:20   ` Jeff King
2023-09-18 20:26 ` [REGRESSION] uninitialized value $address in git send-email Michael Strawbridge
2023-09-19  4:44   ` Bagas Sanjaya
2023-09-19 14:04     ` Michael Strawbridge [this message]
2023-09-19 14:37       ` Michael Strawbridge
2023-09-20 11:00         ` Bagas Sanjaya
2023-09-20 13:14           ` Michael Strawbridge
2023-09-20 15:43           ` Junio C Hamano
2023-09-21  7:51             ` Bagas Sanjaya
2023-09-21 20:42               ` Junio C Hamano
2023-09-22  7:39                 ` Bagas Sanjaya
2023-09-20 15:36         ` Junio C Hamano

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: http://vger.kernel.org/majordomo-info.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4eb0d21b-be43-529a-bfdd-3f1d2b4d3e84@amd.com \
    --to=michael.strawbridge@amd.com \
    --cc=avarab@gmail.com \
    --cc=bagasdotme@gmail.com \
    --cc=dianders@chromium.org \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=luben.tuikov@amd.com \
    --cc=nasamuffin@google.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

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