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

Re: [PATCH] mailinfo: better parse email adresses containg parentheses

From
Lukas Sandström <lukass@etek.chalmers.se>
Date
Jul 21, 2008, 14:36 UTC
Message-ID
<48849EEF.6070403@etek.chalmers.se>
In-Reply-To
<1216647269-12287-1-git-send-email-book@cpan.org>
Philippe Bruhat (BooK) wrote:
Show 11 quoted lines
>     When using git-rebase, author fields containing a ')' at the last
>     position had the close-parens character incorrectly removed
>     because the From: parser incorrectly matched it as
> 
>         user@host (User Name)
> 
>     (removing parentheses), instead of
> 
>         User Name (me) <user@host>
> 
> Signed-off-by: Philippe Bruhat (BooK) <book@cpan.org>
ACK.
Show 15 quoted lines
> ---
>  builtin-mailinfo.c |    4 ++--
>  1 files changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/builtin-mailinfo.c b/builtin-mailinfo.c
> index b99a5b6..5581c9f 100644
> --- a/builtin-mailinfo.c
> +++ b/builtin-mailinfo.c
> @@ -115,10 +115,10 @@ static void handle_from(const struct strbuf *from)
>  	 * the () pair at the end.
>  	 */
>  	strbuf_trim(&f);
> -	if (f.buf[0] == '(')
> +	if (f.buf[0] == '(' && f.len && f.buf[f.len - 1] == ')') {
>  		strbuf_remove(&name, 0, 1);
Note: The line above should obviously be "strbuf_remove(&f, 0, 1);",
another error from the strbuf conversion I made. Sigh.
Show 6 quoted lines
> -	if (f.len && f.buf[f.len - 1] == ')')
>  		strbuf_setlen(&f, f.len - 1);
> +	}
>  
>  	get_sane_name(&name, &f, &email);
>  	strbuf_release(&f);
/Lukas
Previous: Philippe Bruhat (BooK)Next: Junio C Hamano
Message 2 of 4 in “mailinfo: better parse email adresses containg parentheses”
  1. mailinfo: better parse email adresses containg parenthesesPhilippe Bruhat (BooK), Jul 21, 2008
  2. Lukas SandströmJul 21, 2008
  3. Junio C HamanoJul 22, 2008
  4. Philippe Bruhat (BooK)Jul 22, 2008

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.