[packages/gnupg2] Check if /proc/pid/exe is symlink to /usr/bin/gpg-agent. That way we are 100% sure that this is gpg-

Elan Ruusamäe glen at pld-linux.org
Tue Aug 2 10:34:05 CEST 2016


On 01.08.2016 18:17, arekm wrote:
> commit 131032f063eb5da404ab75ac9f0e68d6fbdf60e0
> Author: Arkadiusz Miśkiewicz <arekm at maven.pl>
> Date:   Mon Aug 1 17:17:07 2016 +0200
>
>      Check if /proc/pid/exe is symlink to /usr/bin/gpg-agent. That way we are 100% sure that this is gpg-agent. Prevents script from failing if there is other process running with the same pid as stored in .gnupg/GPG_AGENT_INFO.
...
> +			[ "$(resolvesymlink "/proc/$pid/exe")" = "/usr/bin/gpg-agent" ]; then
>

be aware that if the binary is renamed (rpm upgrade) the "exe" will not 
be exactly "/usr/bin/gpg-agent"

# l /proc/505/exe
lrwxrwxrwx 1 glen glen 0 Jun  6 20:17 /proc/505/exe -> /usr/bin/gpg-agent*

# cp -a /usr/bin/gpg-agent /usr/bin/gpg-agent.save

# rm /usr/bin/gpg-agent
rm: remove regular file '/usr/bin/gpg-agent'? y

# l /proc/505/exe
lrwxrwxrwx 1 glen glen 0 Jun  6 20:17 /proc/505/exe -> 
/usr/bin/gpg-agent (deleted)

#


-- 
glen



More information about the pld-devel-en mailing list