GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — gh-63760: Don't declare gethostname() on Solaris by vstinner · Pull Request #108817 · python/cpython

Conversation

@vstinner

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

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Member

Since at least 2013, Oracle 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
  • Issue: request to reopen Issue837046 - pyport.h redeclares gethostname() if SOLARIS is defined #63760

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@vstinner vstinner added the needs backport to 3.12 only security fixes label Sep 2, 2023
@bedevere-bot bedevere-bot mentioned this pull request Sep 2, 2023
request to reopen Issue837046 - pyport.h redeclares gethostname() if SOLARIS is defined #63760
Closed
@bedevere-bot bedevere-bot added the awaiting core review label Sep 2, 2023
@vstinner vstinner removed the needs backport to 3.12 only security fixes label Sep 2, 2023
@vstinner

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.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@vstinner vstinner mentioned this pull request Sep 2, 2023
bpo-19561: Remove unnecessary gethostname() prototype for Solaris #23208
Closed
@kulikjak

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.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@vstinner

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>.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@vstinner @kulikjak
pythongh-63760: Don't declare gethostname() on Solaris
0c3aaad
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 <[email protected]>
@vstinner
vstinner force-pushed the socket_solaris_gethostname branch from b83c531 to 0c3aaad Compare September 2, 2023 17:16
@vstinner

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 reacted with thumbs up emoji
All reactions
  • 👍 1 reaction

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

kulikjak
kulikjak approved these changes Sep 2, 2023
View reviewed changes

@kulikjak kulikjak left a comment

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

Thanks!

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@vstinner
vstinner enabled auto-merge (squash) September 2, 2023 17:24
@kulikjak

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!

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@vstinner
vstinner merged commit 0e6d582 into python:main Sep 2, 2023
@vstinner
vstinner deleted the socket_solaris_gethostname branch September 2, 2023 17:55
@bedevere-bot bedevere-bot removed the awaiting core review label Sep 2, 2023
@bedevere-bot

bedevere-bot commented Sep 2, 2023

Copy link
Copy Markdown

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

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

vstinner added a commit to vstinner/cpython that referenced this pull request Sep 2, 2023
@vstinner @kulikjak
pythongh-63760: Don't declare gethostname() on Solaris (python#108817)
a61961c
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 <[email protected]>
(cherry picked from commit 0e6d582)
@vstinner

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 reacted with eyes emoji
All reactions
  • 👀 1 reaction

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@kulikjak

kulikjak commented Sep 2, 2023

Copy link
Copy Markdown
Contributor

I created #108825 to fix it.

vstinner reacted with heart emoji
All reactions
  • ❤️ 1 reaction

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

Yhg1s pushed a commit that referenced this pull request Sep 2, 2023
@vstinner @kulikjak
[3.12] gh-63760: Don't declare gethostname() on Solaris (#108817) (#1…
7269916
…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 <[email protected]>
(cherry picked from commit 0e6d582)
@miss-islington miss-islington mentioned this pull request Sep 2, 2023
[3.11] [3.12] gh-63760: Don't declare gethostname() on Solaris (GH-108817) (GH-108824) #108832
Merged
miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Sep 2, 2023
@vstinner @kulikjak @miss-islington
[3.12] pythongh-63760: Don't declare gethostname() on Solaris (python…
44fd787
…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 <[email protected]>
Co-authored-by: Jakub Kulík <[email protected]>
(cherry picked from commit 0e6d582)
vstinner added a commit that referenced this pull request Sep 3, 2023
@miss-islington @vstinner
[3.11] [3.12] gh-63760: Don't declare gethostname() on Solaris (GH-10…
b30c83e
…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 <[email protected]>
Co-authored-by: Jakub Kulík <[email protected]>
(cherry picked from commit 0e6d582)

Co-authored-by: Victor Stinner <[email protected]>
@vstinner vstinner mentioned this pull request Sep 7, 2023
Declare sethostname in socketmodule.c for SOLARIS #78469
Closed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

1 more reviewer
@kulikjak kulikjak kulikjak approved these changes
Reviewers whose approvals may not affect merge requirements

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

3 participants

@vstinner @kulikjak @bedevere-bot
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.