paracel icon indicating copy to clipboard operation
paracel copied to clipboard

Incorrect hostname using `socket.gethostname()` under macOS Sierra.

Open xunzhang opened this issue 9 years ago • 1 comments

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.

xunzhang avatar Dec 03 '16 13:12 xunzhang

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.

xunzhang avatar Dec 03 '16 14:12 xunzhang