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

Re: [RFC] git-send-email: do not double-escape quotes from mutt

From
Matthieu Moy <matthieu.moy@grenoble-inp.fr>
Date
Jan 4, 2016, 18:11 UTC
Message-ID
<vpqsi2dxlht.fsf@anie.imag.fr>
In-Reply-To
<20151227020810.1450-1-normalperson@yhbt.net>
Eric Wong <normalperson@yhbt.net> writes:
Show 14 quoted lines
> --- a/git-send-email.perl
> +++ b/git-send-email.perl
> @@ -524,8 +524,14 @@ my %parse_alias = (
>  		if (/^\s*alias\s+(?:-group\s+\S+\s+)*(\S+)\s+(.*)$/) {
>  			my ($alias, $addr) = ($1, $2);
>  			$addr =~ s/#.*$//; # mutt allows # comments
> -			 # commas delimit multiple addresses
> -			$aliases{$alias} = [ split_addrs($addr) ];
> +			# commas delimit multiple addresses
> +			my @addr = split_addrs($addr);
> +
> +			# quotes may be escaped in the file,
> +			# remove them if paired so we do not
> +			# double-escape them later.

I think you meant "remove the escaping" or simply "unescape", not "remove them", which I'd understand as "remove the quotes".

Other than that, the patch looks good to me, including your proposed fixup:

--- a/git-send-email.perl
+++ b/git-send-email.perl
@@ -530,7 +530,7 @@ my %parse_alias = (
 			# quotes may be escaped in the file,
 			# remove them if paired so we do not
 			# double-escape them later.
-			s/^\\"(.*?)\\"/"$1"/g foreach @addr;
+			s/\\"/"/g foreach @addr;
 			$aliases{$alias} = \@addr

Eric Wong <normalperson@yhbt.net> writes:

> alias qn \"Q. N\\\"ame\" <qn@example.org>   # becomes "Q. N\"ame"
> alias dq \"Dub O.\" \"Q\" <dq@example.org>  # becomes "Dub O. Q"
[...]
> But I'm not sure how to handle the "dq" case or if that even
> happens in practice, as attempting to save an alias with "Dub O." "Q"
> in the From: header, mutt shortens it to the expected \"Dub O. Q\"
> without extra quotes.

I wouldn't worry too much about corner-cases, but perhaps some people do
use escaped quotes inside escaped quotes. I'd say they get what they
deserve ;-).
-- 
Matthieu Moy
http://www-verimag.imag.fr/~moy/
Previous: Eric WongNext: Eric Wong
Message 4 of 7 in “[RFC] git-send-email: do not double-escape quotes from mutt”
  1. Eric WongDec 27, 2015
  2. Junio C HamanoDec 28, 2015
  3. Eric WongDec 29, 2015
  4. Matthieu MoyJan 4, 2016
  5. git-send-email: do not double-escape quotes from muttEric Wong, Jan 4, 2016
  6. Junio C HamanoJan 4, 2016
  7. Eric WongJan 4, 2016

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.