git/list[1] front-page[2] threads[3] people[4] search[5] about
 

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

From
MSMichael Strawbridge <michael.strawbridge@amd.com>
Date
Sep 19, 2023, 14:37 UTC
Message-ID
<118975ef-c07f-c397-5288-7698e60516a7@amd.com>
In-Reply-To
<4eb0d21b-be43-529a-bfdd-3f1d2b4d3e84@amd.com>
On 2023-09-19 10:04, Michael Strawbridge wrote:
Show 126 quoted lines
> 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.

Previous: Michael StrawbridgeNext: Bagas Sanjaya
Message 8 of 15 in “[REGRESSION] uninitialized value $address in git send-email”
  1. Bagas SanjayaSep 18, 2023
  2. git-send-email.perl: avoid printing undef when validating addressesTaylor Blau, Sep 18, 2023
  3. Junio C HamanoSep 18, 2023
  4. Jeff KingSep 18, 2023
  5. Michael StrawbridgeSep 18, 2023
  6. Bagas SanjayaSep 19, 2023
  7. Michael StrawbridgeSep 19, 2023
  8. Michael StrawbridgeSep 19, 2023
  9. Bagas SanjayaSep 20, 2023
  10. Michael StrawbridgeSep 20, 2023
  11. Junio C HamanoSep 20, 2023
  12. Bagas SanjayaSep 21, 2023
  13. Junio C HamanoSep 21, 2023
  14. Bagas SanjayaSep 22, 2023
  15. Junio C HamanoSep 20, 2023

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.