FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

gh-63760: Don't declare gethostname() on Solaris by vstinner · Pull Request #108817 · python/cpython · GitHub

/ cpython Public

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

Merged
vstinner merged 1 commit into
python:mainfrom
vstinner:socket_solaris_gethostname
Sep 2, 2023
Merged

gh-63760: Don't declare gethostname() on Solaris#108817
vstinner merged 1 commit into
python:mainfrom
vstinner:socket_solaris_gethostname

Conversation

vstinner commented Sep 2, 2023
edited by bedevere-bot
Loading

Copy link
Copy Markdown
Member

vstinner commented Sep 2, 2023

Copy link
Copy Markdown
Member Author

@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 commented Sep 2, 2023

Copy link
Copy Markdown
Contributor

@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 commented Sep 2, 2023

Copy link
Copy Markdown
Member Author
/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 force-pushed the socket_solaris_gethostname branch from b83c531 to 0c3aaad Compare September 2, 2023 17:16

vstinner commented Sep 2, 2023

Copy link
Copy Markdown
Member Author

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?

kulikjak left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Thanks!

vstinner enabled auto-merge (squash) September 2, 2023 17:24

kulikjak commented Sep 2, 2023

Copy link
Copy Markdown
Contributor

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 merged commit 0e6d582 into python:main Sep 2, 2023
vstinner deleted the socket_solaris_gethostname branch September 2, 2023 17:55

Copy link
Copy Markdown

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 commented Sep 2, 2023

Copy link
Copy Markdown
Member Author

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 commented Sep 2, 2023

Copy link
Copy Markdown
Contributor

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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
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.

3 participants


Back | FazBrowse Home | New Git URL