[MDEV-23589] portability: use `uname -n` instead of `hostname` Created: 2020-08-26 Updated: 2020-12-08 Resolved: 2020-09-10 |
|
| Status: | Closed |
| Project: | MariaDB Server |
| Component/s: | Scripts & Clients |
| Affects Version/s: | 10.5.5 |
| Fix Version/s: | 10.4.16, 10.5.7 |
| Type: | Bug | Priority: | Trivial |
| Reporter: | Geert Hendrickx | Assignee: | Anel Husakovic |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | portability | ||
| Attachments: |
|
| Description |
|
Scripts included with mariadb use `hostname` to query the hostname, used to create logfiles, pidfiles, etc. However this command is not defined by POSIX and thus not guaranteed to work. Better use portable `uname -n` instead. See attached patch. |
| Comments |
| Comment by Anel Husakovic [ 2020-08-27 ] | ||||||||||||||||
|
Hi ghen thanks for the patch. | ||||||||||||||||
| Comment by Sergei Golubchik [ 2020-08-27 ] | ||||||||||||||||
|
Where does hostname not exist? We'd need at least one platform where your patch makes a difference, for testing. | ||||||||||||||||
| Comment by Geert Hendrickx [ 2020-08-27 ] | ||||||||||||||||
|
Arch Linux default install (without inetutils pkg, no longer part of base OS. uname is part of coreutils) | ||||||||||||||||
| Comment by Faustin Lammler [ 2020-08-27 ] | ||||||||||||||||
|
Indeed and not only on arch, see bellow:
So `uname -n` seems to be a good alternative for very basic and clean OS installations (and docker). | ||||||||||||||||
| Comment by Geert Hendrickx [ 2020-08-27 ] | ||||||||||||||||
|
anel PR is here: https://github.com/MariaDB/server/pull/1663 | ||||||||||||||||
| Comment by Anel Husakovic [ 2020-08-27 ] | ||||||||||||||||
|
ghen great thanks for raising the patch. We will take a look. | ||||||||||||||||
| Comment by Daniel Black [ 2020-08-28 ] | ||||||||||||||||
|
Thanks faust that clearly shows what's in the minimal install and the two gaps. https://www.archlinux.org/packages/extra/x86_64/mariadb/ (10.5) has the inetutils dependency I assume solely for this. eworm I assuming this is safe and drops a dependency for archlinux so is a gain? Fedora, https://src.fedoraproject.org/rpms/mariadb, no dependency listed (in any branch aka release) on hostname package (that contains hostname). Fedora 31 (has 10.3) will EOL about the same time as MariaDB's release so no-one will care. So target 10.4 unless serg has a different option. | ||||||||||||||||
| Comment by Christian Hesse [ 2020-08-28 ] | ||||||||||||||||
|
I will happily drop the dependency, especially as it's old inetutils. | ||||||||||||||||
| Comment by Daniel Black [ 2020-08-28 ] | ||||||||||||||||
|
Is the donor name passed though wsrep. https://galeracluster.com/library/documentation/scriptable-sst.html its specified as an IP. | ||||||||||||||||
| Comment by Geert Hendrickx [ 2020-08-28 ] | ||||||||||||||||
|
I didn't verify that particular functionality, just added another item to that list of "anything that could match the local host". It's equivalent to the hostname -f that was already there, regardless of whether an FQDN would be valid input or not. | ||||||||||||||||
| Comment by Anel Husakovic [ 2020-09-04 ] | ||||||||||||||||
|
jplindst can you please take a look in wsrep change? | ||||||||||||||||
| Comment by Anel Husakovic [ 2020-09-10 ] | ||||||||||||||||
|
Pushed with 1bb3ad6dfc885112d to 10.4. |