The solution of sending the "KILLAGENT" message to gpgagent to make it
clean up its sockets in gpg home dir is causing a race condition with
the gpgme_release() function.
Instead of trying to make the agent clean up its sockets (which doesn't
seem to be reliably possible), take advantage of its feature to create
the sockets under '/run/user/$UID' if this directory is present. The
sockets shouldn't be causing any trouble in this directory.
The commit creates the '/run/user/$UID' directory if it's not present on
the system. The sockets are then created there.
The solution of sending the "KILLAGENT" message to gpgagent to make it clean up its sockets in gpg home dir is causing a race condition with the gpgme_release() function.
Instead of trying to make the agent clean up its sockets (which doesn't seem to be reliably possible), take advantage of its feature to create the sockets under '/run/user/$UID' if this directory is present. The sockets shouldn't be causing any trouble in this directory.
The commit creates the '/run/user/$UID' directory if it's not present on the system. The sockets are then created there.
https://bugzilla.redhat.com/show_bug.cgi?id=1769831 https://bugzilla.redhat.com/show_bug.cgi?id=1771012
Fixes https://github.com/rpm-software-management/microdnf/issues/50