Thread (198 messages) 198 messages, 6 authors, 2025-06-20

Re: [PATCH 1/2] imap-send: fix bug causing cfg->folder being set to NULL

From: Jeff King <hidden>
Date: 2025-05-22 18:29:26

On Thu, May 22, 2025 at 05:27:15PM +0000, Aditya Garg wrote:
Upon setting up imap-send config file, I encountered the very first bug.
An error showing "no imap store specified" was being displayed on the
terminal. Upon investigating further, in static int git_imap_config,
cfg->folder was being incorrectly set to NULL in case imap.user, imap.pass,
imap.tunnel and imap.authmethod were defined, and the values that these configs
intended to set were not being set at all.
I read "these configs[...]were not being set at all" as imap.user, etc.
But I think the only thing affected was imap.folder, which was
incorrectly being reset when we saw the other fields (and of course the
leak-fix for those fields was not kicking in correctly).

So:

  [imap]
  host = example.com
  user = foo
  folder = INBOX

was fine, but:

  [imap]
  host = example.com
  folder = INBOX
  user = foo

was not (we end up with a NULL folder variable).
Because of this, git imap-send was basically not usable at all. The
bug seems to be there for quite a while, and has not yet been
detected, likely due to better options like git send-email being
available.
I think that probably explains why it was not detected (by users or the
tests). It was dependent on the usage and ordering of particular config
options.

(The patch is still doing the right thing, of course; I'm just trying to
add more context to the commit message).

-Peff
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help