[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Dead code or bug in gpg_agent.c

From: Hyrum K Wright <hyrum_at_hyrumwright.org>
Date: Mon, 8 Oct 2012 21:51:02 -0400

Poking around subversion/libsvn_subr/gpg_agent.c I found this snippet
(at around line 325):

[[[
  /* Send DISPLAY to the gpg-agent daemon. */
  display = getenv("DISPLAY");
  if (display != NULL)
    {
      request = apr_psprintf(pool, "OPTION display=%s\n", display);
      if (!send_option(sd, buffer, BUFFER_SIZE, "display", display, pool))
        {
          close(sd);
          return SVN_NO_ERROR;
        }
    }
]]]

Among other things, it looks to be setting the request variable.
However, that variable is never read before it is reset a few lines
later:

[[[
  request = apr_psprintf(pool,
                         "GET_PASSPHRASE --data %s--repeat=1 "
                         "%s X %s %s\n",
                         non_interactive ? "--no-ask " : "",
                         cache_id,
                         escape_blanks(password_prompt),
                         escape_blanks(realm_prompt));
]]]

I don't know enough about what's going on here. Is the first time the
variable is set supposed to be combined with the second, or is it just
a superfluous assignment which we can safely remove?

-Hyrum
Received on 2012-10-09 03:51:37 CEST

This is an archived mail posted to the Subversion Dev mailing list.