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

Re: [PATCH] git-send-email.perl: avoid printing undef when validating addresses

From
Junio C Hamano <gitster@pobox.com>
Date
Sep 18, 2023, 19:04 UTC
Message-ID
<xmqq5y47l2vg.fsf@gitster.g>
In-Reply-To
<545729b619308c6f3397b9aa1747f26ddc58f461.1695054945.git.me@ttaylorr.com>
Taylor Blau <me@ttaylorr.com> writes:
Show 12 quoted lines
> 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 {
Previous: Taylor BlauNext: Jeff King
Message 3 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.