PMM versioner looks for binaries only in agent's $PATH

Description

PMM won't be able to detect version of MySQL (or any other software) if it's not located in the same $PATH as agent is started with.

Steps to reproduce:

 01) Set up MySQL outside of $PATH (sandbox, for instance).

 02) Check what binaries pmm-agent is looking for when executing:

https://github.com/percona/pmm/blob/main/agent/versioner/versioner.go#L87-L152

"strace output"

[pid 169396] newfstatat(AT_FDCWD, "/usr/local/sbin/mysqld",  <unfinished ...> [pid 169396] newfstatat(AT_FDCWD, "/usr/local/bin/mysqld", 0xc00012afa8, 0) = -1 ENOENT (Nie ma takiego pliku ani katalogu) [pid 169396] newfstatat(AT_FDCWD, "/usr/sbin/mysqld", 0xc00012b078, 0) = -1 ENOENT (Nie ma takiego pliku ani katalogu) [pid 169396] newfstatat(AT_FDCWD, "/usr/bin/mysqld",  <unfinished ...> [pid 169396] newfstatat(AT_FDCWD, "/sbin/mysqld",  <unfinished ...> [pid 169396] newfstatat(AT_FDCWD, "/bin/mysqld",  <unfinished ...> [pid 169396] newfstatat(AT_FDCWD, "/snap/bin/mysqld", 0xc00012b3b8, 0) = -1 ENOENT (Nie ma takiego pliku ani katalogu)

 

The main reason for that is that under the hood the below is used:

https://github.com/golang/go/blob/master/src/os/exec/lp_unix.go#L64-L81

How to test

None

How to document

None

AFFECTED CS IDs

CS0034692

Activity

Show:

Details

Assignee

Reporter

Priority

Components

Labels

Needs QA

Yes

Needs Doc

No

Affects versions

Smart Checklist

Created March 30, 2023 at 11:29 AM
Updated October 9, 2024 at 8:36 AM

Flag notifications