paracel
paracel copied to clipboard
Incorrect hostname using `socket.gethostname()` under macOS Sierra.
The socket library in Python source code return the wrong hostname under macOS Sierra.
For example, print socket.gethostname() returns a, but the actual hostname is a.local.
It seems that the old system call from python source code will get an incorrect name and the actual name ends with .local suffix.
In upstream CPython source code, the implementation of socket.gethostname() is here, it uses the gethostname(char *, size_t) syscall in unistd.h and will get an incorrect hostname. So the problem would be because of the Standard C Library implementation under MacOS Sierra, not CPython.