git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Eli Schwartz <eschwartz@archlinux.org>
To: "Ævar Arnfjörð Bjarmason" <avarab@gmail.com>
Cc: git@vger.kernel.org
Subject: Re: Regression in git send-email parsing sendemail.* config values
Date: Sun, 5 Sep 2021 21:44:31 -0400	[thread overview]
Message-ID: <96814e5e-54be-1eca-0d75-68be53b1be3d@archlinux.org> (raw)
In-Reply-To: <87k0jupnxi.fsf@evledraar.gmail.com>


[-- Attachment #1.1: Type: text/plain, Size: 2364 bytes --]

On 9/5/21 8:04 PM, Ævar Arnfjörð Bjarmason wrote:
> 
> On Sun, Sep 05 2021, Eli Schwartz wrote:
> 
>> I recently noticed that git send-email was attempting to send emails
>> using the wrong email address. I have a global email configuration in
>> XDG_CONFIG_HOME, and a specific one set in the {repo}/.git/config of
>> some repos... this was trying to use the global configuration.
>>
>> `git config -l | grep ^sendemail.smtpserver=` reports two emails
> 
> Don't you mean s/emails/servers/, ditto "wrong email address" should be
> "the wrong server", right?


Considering the time of technically-it-is-day-now I wrote this email, I
suppose I should have proofread it before sending it the next day.

I'll claim some sort of self-defense in that the email username
(smtpuser) was different, in addition to the smtpserver. Yeah, that was it!

(also I am used to thinking of email servers as a subcomponent of email
addresses even though this is technically not true, shhh)


>> `git config --get sendemail.smtpserver` reports only the second,
>> repo-specific one
>>
>>
>> I bisected the issue to commit c95e3a3f0b8107b5dc7eac9dfdb9e5238280c9fb
>>
>>     send-email: move trivial config handling to Perl
>>
>>
>> Using this commit, git-send-email disagrees with git config --get on
>> which email to use.
>>
>> Using commit f4dc9432fd287bde9100488943baf3c6a04d90d1 immediately
>> preceding this commit, git send-email agrees with git config --get.
> 
> That's a pretty bad bug, sorry about that. I believe that the following
> patch should fix it (needs tests obviously). I.e. when we had N config
> keys we'd previously pick the normal "last key wins", which my
> c95e3a3f0b8107b5dc7eac9dfdb9e5238280c9fb changed to "first wins":
> 
> diff --git a/git-send-email.perl b/git-send-email.perl
> index e65d969d0bb..6c7ab3d2e91 100755
> --- a/git-send-email.perl
> +++ b/git-send-email.perl
> @@ -376,7 +376,7 @@ sub read_config {
>  			@$target = @values;
>  		}
>  		else {
> -			my $v = $known_keys->{$key}->[0];
> +			my $v = $known_keys->{$key}->[-1];
>  			next unless defined $v;
>  			next if $configured->{$setting}++;
>  			$$target = $v;
> 



Thanks, this worked for me and fixed my problem! Feel free to add my
tested-by.


-- 
Eli Schwartz
Arch Linux Bug Wrangler and Trusted User


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

  reply	other threads:[~2021-09-06  1:52 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-05 23:01 Regression in git send-email parsing sendemail.* config values Eli Schwartz
2021-09-06  0:04 ` Ævar Arnfjörð Bjarmason
2021-09-06  1:44   ` Eli Schwartz [this message]
2021-09-06  7:33     ` [PATCH] send-email: fix a "first config key wins" regression in v2.33.0 Ævar Arnfjörð Bjarmason
2021-09-06  8:32       ` Carlo Arenas
2021-09-06 11:05       ` Bagas Sanjaya
2021-09-07  9:15         ` Ævar Arnfjörð Bjarmason

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: http://vger.kernel.org/majordomo-info.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=96814e5e-54be-1eca-0d75-68be53b1be3d@archlinux.org \
    --to=eschwartz@archlinux.org \
    --cc=avarab@gmail.com \
    --cc=git@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).