This seems to be a bug, at least it's potentially confusing -
If you start the agent like this:
gpg-agent --daemon --use-standard-socket
then the agent uses ~/.gnupg/S.gpg-agent as designed but it also spits out the
env var setup for GPG_AGENT_INFO using a temp socket name including the process
ID. This is a little confusing since if you are doing the common:
eval gpg-agent --daemon --use-standard-socket
invocation, then you are setting GPG_AGENT_INFO which now points to an unused
socket (which doesn't exist). Since gpg looks in the environment first and falls
back on the standard socket if it can't find the env var, this can lead to agent
connection failures even though everything looks like it's set up ok. Perhaps if
the "--use-standard-socket" option is used, the agent shouldn't spit anything to
STDOUT on startup or should at least split out a socketname which corresponds to
the standard socket name?