Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

gh-63760: Don't declare gethostname() on Solaris #108817

Merged
merged 1 commit into from Sep 2, 2023

Conversation

vstinner
Copy link
Member

@vstinner vstinner commented Sep 2, 2023

@vstinner
Copy link
Member Author

vstinner commented Sep 2, 2023

@kulikjak: Would you mind to review my PR? (And test it if possible?)

I saw your PR #23208, but I tried to add more documentation about the change from the issue and your latest comments.

I plan to backport the change manually to Python 3.12 (the function was defined in pyport.h), and then to 3.11.

@kulikjak
Copy link
Contributor

kulikjak commented Sep 2, 2023

@vstinner, I tried running tests but sadly the build failed due to what seems like unrelated issue:

/builds/cpython-main/Modules/termios.c: In function 'termios_tcgetwinsize_impl':
/builds/cpython-main/Modules/termios.c:389:9: error: implicit declaration of function 'ioctl' [-Werror=implicit-function-declaration]
389 |     r = ioctl(fd, TIOCGWINSZ, &w);
    |         ^~~~~
/builds/cpython-main/Modules/_multiprocessing/multiprocessing.c: In function 'multiprocessing_exec':
/builds/cpython-main/Modules/_multiprocessing/multiprocessing.h:44:32: error: implicit declaration of function 'sysconf'; did you mean '_sysconf'? [-Werror=implicit-function-declaration]
44 |         # define SEM_VALUE_MAX sysconf(_SC_SEM_VALUE_MAX)
   |                                ^~~~~

but I don't see how this change can break anything as it's how we compile Python for many years now.

Just two minor nits for the NEWS fragment - it's at least since 2005 (when Solaris was opened) and it's not just Oracle Solaris but Solaris in general.

@vstinner
Copy link
Member Author

vstinner commented Sep 2, 2023

/builds/cpython-main/Modules/_multiprocessing/multiprocessing.c: In function 'multiprocessing_exec':
/builds/cpython-main/Modules/_multiprocessing/multiprocessing.h:44:32: error: implicit declaration of function 'sysconf'; did you mean '_sysconf'? [-Werror=implicit-function-declaration]
44 |         # define SEM_VALUE_MAX sysconf(_SC_SEM_VALUE_MAX)
   |                                ^~~~~

I wrote PR #108823 to fix warning.

For Modules/termios.c, I don't know which include is missing on Solaris to get ioctl(). Is it also unistd.h? On Linux, man ioctl asks to #include <sys/ioctl.h>.

Since 2005, Solaris defines gethostname(). socketmodule.c no longer
has to define gethostname() for Solaris.

Oracle Solaris and OpenSolaris have patches to remove the
gethostname() definition in Python:

* https://github.com/oracle/solaris-userland/blob/master/components/python/python37/patches/15-gethostname.patch
* https://github.com/OpenIndiana/oi-userland/blob/oi/hipster/components/python/python37/patches/15-gethostname.patch
* https://github.com/omniosorg/omnios-build/blob/master/build/python27/patches/24-gethostname.patch

Co-Authored-by: Jakub Kulík <Kulikjak@gmail.com>
@vstinner
Copy link
Member Author

vstinner commented Sep 2, 2023

Just two minor nits for the NEWS fragment - it's at least since 2005 (when Solaris was opened) and it's not just Oracle Solaris but Solaris in general.

Ok, I updated the PR. Would you mind to review it again?

Copy link
Contributor

@kulikjak kulikjak left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@vstinner vstinner enabled auto-merge (squash) September 2, 2023 17:24
@kulikjak
Copy link
Contributor

kulikjak commented Sep 2, 2023

For Modules/termios.c, I don't know which include is missing on Solaris to get ioctl(). Is it also unistd.h? On Linux, man ioctl asks to #include <sys/ioctl.h>.

Yes, I needed to add unistd.h there for build to pass. With #108823 there seems to be no issues anymore. Thanks!

@vstinner vstinner merged commit 0e6d582 into python:main Sep 2, 2023
22 checks passed
@vstinner vstinner deleted the socket_solaris_gethostname branch September 2, 2023 17:55
@bedevere-bot
Copy link

GH-108824 is a backport of this pull request to the 3.12 branch.

vstinner added a commit to vstinner/cpython that referenced this pull request Sep 2, 2023
Since 2005, Solaris defines gethostname(). socketmodule.c no longer
has to define gethostname() for Solaris.

Oracle Solaris and OpenSolaris have patches to remove the
gethostname() definition in Python:

* https://github.com/oracle/solaris-userland/blob/master/components/python/python37/patches/15-gethostname.patch
* https://github.com/OpenIndiana/oi-userland/blob/oi/hipster/components/python/python37/patches/15-gethostname.patch
* https://github.com/omniosorg/omnios-build/blob/master/build/python27/patches/24-gethostname.patch

Co-authored-by: Jakub Kulík <Kulikjak@gmail.com>
(cherry picked from commit 0e6d582)
@vstinner
Copy link
Member Author

vstinner commented Sep 2, 2023

Yes, I needed to add unistd.h there for build to pass. With #108823 there seems to be no issues anymore. Thanks!

Please create a PR for Modules/termios.c.

@kulikjak
Copy link
Contributor

kulikjak commented Sep 2, 2023

I created #108825 to fix it.

Yhg1s pushed a commit that referenced this pull request Sep 2, 2023
…08824)

gh-63760: Don't declare gethostname() on Solaris (#108817)

Since 2005, Solaris defines gethostname(). socketmodule.c no longer
has to define gethostname() for Solaris.

Oracle Solaris and OpenSolaris have patches to remove the
gethostname() definition in Python:

* https://github.com/oracle/solaris-userland/blob/master/components/python/python37/patches/15-gethostname.patch
* https://github.com/OpenIndiana/oi-userland/blob/oi/hipster/components/python/python37/patches/15-gethostname.patch
* https://github.com/omniosorg/omnios-build/blob/master/build/python27/patches/24-gethostname.patch

Co-authored-by: Jakub Kulík <Kulikjak@gmail.com>
(cherry picked from commit 0e6d582)
miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Sep 2, 2023
…GH-108817) (pythonGH-108824)

pythongh-63760: Don't declare gethostname() on Solaris (pythonGH-108817)

Since 2005, Solaris defines gethostname(). socketmodule.c no longer
has to define gethostname() for Solaris.

Oracle Solaris and OpenSolaris have patches to remove the
gethostname() definition in Python:

* https://github.com/oracle/solaris-userland/blob/master/components/python/python37/patches/15-gethostname.patch
* https://github.com/OpenIndiana/oi-userland/blob/oi/hipster/components/python/python37/patches/15-gethostname.patch
* https://github.com/omniosorg/omnios-build/blob/master/build/python27/patches/24-gethostname.patch

(cherry picked from commit 7269916)

Co-authored-by: Victor Stinner <vstinner@python.org>
Co-authored-by: Jakub Kulík <Kulikjak@gmail.com>
(cherry picked from commit 0e6d582)
vstinner added a commit that referenced this pull request Sep 3, 2023
…8817) (GH-108824) (#108832)

[3.12] gh-63760: Don't declare gethostname() on Solaris (GH-108817) (GH-108824)

gh-63760: Don't declare gethostname() on Solaris (GH-108817)

Since 2005, Solaris defines gethostname(). socketmodule.c no longer
has to define gethostname() for Solaris.

Oracle Solaris and OpenSolaris have patches to remove the
gethostname() definition in Python:

* https://github.com/oracle/solaris-userland/blob/master/components/python/python37/patches/15-gethostname.patch
* https://github.com/OpenIndiana/oi-userland/blob/oi/hipster/components/python/python37/patches/15-gethostname.patch
* https://github.com/omniosorg/omnios-build/blob/master/build/python27/patches/24-gethostname.patch

(cherry picked from commit 7269916)

Co-authored-by: Victor Stinner <vstinner@python.org>
Co-authored-by: Jakub Kulík <Kulikjak@gmail.com>
(cherry picked from commit 0e6d582)

Co-authored-by: Victor Stinner <vstinner@python.org>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants