Thread (6 messages) flat view 6 messages, 4 authors, 2016-06-15

Re: [PATCH] send-email: Don't leak To: headers between patches

From: Ævar Arnfjörð Bjarmason <hidden>
Date: 2016-06-15 22:49:41

On Mon, Oct 4, 2010 at 07:15, Ævar Arnfjörð Bjarmason [off-list ref] wrote:
On Mon, Oct 4, 2010 at 07:05, Stephen Boyd [off-list ref] wrote:
quoted
If the first patch in a series has a To: header in the file and the
second patch in the series doesn't the address from the first patch will
be part of the To: addresses in the second patch. Fix this by treating the
to list like the cc list. Have an initial to list come from the command
line, user input and config options. Then build up a to list from each
patch and concatenate the two together before sending the patch. Finally,
reset the list after sending each patch so the To: headers from a patch
don't get used for the next one.
Couldn't this whole thing be done by:
quoted
 # Variables we fill in automatically, or via prompting:
-my (@to,$no_to,@cc,$no_cc,@initial_cc,@bcclist,$no_bcc,@xh,
+my (@to,$no_to,@initial_to,@cc,$no_cc,@initial_cc,@bcclist,$no_bcc,@xh,
Changing this to an "our" variable instead of a "my".
quoted
       my $body_encoding;
+       @to = ();
Then doing:

   local @to = @to;
quoted
+       @to = (@initial_to, @to);
       @cc = (@initial_cc, @cc);
Small brainfart, you don't have to change it to an "our" and use
"local", you can just use "my" in that for-loop:

    $ perl -E 'my @a = qw(a b); { my @a = (@a, "c"); say "@a" } say "@a"'
    a b c
    a b

That's a much better solution IMO than the C-like usage of two
variables. Lexical shadowing is exactly for this sort of thing.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help