Skip to content

gh-85277: Fix building without stropts.h or empty stropts.h#143521

Merged
vstinner merged 7 commits intopython:mainfrom
shadchin:stropts
Mar 10, 2026
Merged

gh-85277: Fix building without stropts.h or empty stropts.h#143521
vstinner merged 7 commits intopython:mainfrom
shadchin:stropts

Conversation

@shadchin
Copy link
Copy Markdown
Contributor

@shadchin shadchin commented Jan 7, 2026

Added a check that not only do we have stropts.h, but I_PUSH is also defined.

I used I_PUSH because it is used in two places (Modules/posixmodule.c, Modules/fcntlmodule.c), the rest of the definitions are only in Modules/fcntlmodule.c.

Also fix for gh-81541 if building without OpenPTY and without stropts.h.

Other related issues:

Comment thread configure.ac Outdated
Comment on lines +3031 to +3033
#if !defined(I_PUSH)
#error I_PUSH
#endif
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Use AC_CHECK_DECL instead of a program.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Done

Comment thread configure.ac Outdated
AC_COMPILE_IFELSE([
AC_LANG_PROGRAM([[
AC_CHECK_DECL([I_PUSH], [
AC_DEFINE([HAVE_STROPTS_H], [1], [Define to 1 if you have the <stropts.h> header file.])
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Please properly wrap the calls. E.g., use the 2-space indents for inner blocks. Have a look at https://github.com/python/cpython/pull/142380/files#r2615800453 and the code I commented.

Copy link
Copy Markdown
Member

@picnixz picnixz left a comment

Choose a reason for hiding this comment

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

Please add a NEWS entry as well.

@picnixz
Copy link
Copy Markdown
Member

picnixz commented Jan 9, 2026

There is still some style issue. I will write a suggestion when I am on a laptop.

Comment thread configure.ac Outdated
Comment on lines +3025 to +3030
AC_CHECK_DECL([I_PUSH], [AC_DEFINE([HAVE_STROPTS_H], [1], [Define to 1 if you have the <stropts.h> header file.])], [], [
#ifdef HAVE_SYS_TYPES_H
#include <sys/types.h>
#endif
#include <stropts.h>
])
Copy link
Copy Markdown
Member

@picnixz picnixz Jan 9, 2026

Choose a reason for hiding this comment

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

Suggested change
AC_CHECK_DECL([I_PUSH], [AC_DEFINE([HAVE_STROPTS_H], [1], [Define to 1 if you have the <stropts.h> header file.])], [], [
#ifdef HAVE_SYS_TYPES_H
#include <sys/types.h>
#endif
#include <stropts.h>
])
AC_CHECK_DECL([I_PUSH], [
AC_DEFINE(
[HAVE_STROPTS_H], [1],
[Define to 1 if you have the <stropts.h> header file.]
)], [], [
#ifdef HAVE_SYS_TYPES_H
# include <sys/types.h>
#endif
#include <stropts.h>
])

Hopefully, I got my brackets right. Otherwise, put them when they are needed. m4 has some weird syntax and the way I put my blank lines may also be not supported.

@shadchin
Copy link
Copy Markdown
Contributor Author

@picnixz I've fixed everything. Is there anything else I need to do?

Copy link
Copy Markdown
Member

@picnixz picnixz left a comment

Choose a reason for hiding this comment

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

Sorry I forgot about it. I will run the build bots. That is, do NOT commit as otherwise we lose the CI status.

@picnixz picnixz added awaiting review 🔨 test-with-buildbots Test PR w/ buildbots; report in status section and removed awaiting merge labels Jan 20, 2026
@bedevere-bot
Copy link
Copy Markdown

🤖 New build scheduled with the buildbot fleet by @picnixz for commit ba8f793 🤖

Results will be shown at:

https://buildbot.python.org/all/#/grid?branch=refs%2Fpull%2F143521%2Fmerge

If you want to schedule another build, you need to add the 🔨 test-with-buildbots label again.

@bedevere-bot bedevere-bot removed the 🔨 test-with-buildbots Test PR w/ buildbots; report in status section label Jan 20, 2026
@shadchin
Copy link
Copy Markdown
Contributor Author

There's nothing going on here. Can I help?

@emmatyping emmatyping added the 🔨 test-with-buildbots Test PR w/ buildbots; report in status section label Feb 22, 2026
@bedevere-bot
Copy link
Copy Markdown

🤖 New build scheduled with the buildbot fleet by @emmatyping for commit ba8f793 🤖

Results will be shown at:

https://buildbot.python.org/all/#/grid?branch=refs%2Fpull%2F143521%2Fmerge

If you want to schedule another build, you need to add the 🔨 test-with-buildbots label again.

@bedevere-bot bedevere-bot removed the 🔨 test-with-buildbots Test PR w/ buildbots; report in status section label Feb 22, 2026
Copy link
Copy Markdown
Member

@emmatyping emmatyping left a comment

Choose a reason for hiding this comment

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

I wanted to take a look at another buildbot run since Android failed in the last one but barring any other concerns by @picnixz I think this looks OK to merge

@vstinner vstinner merged commit 2756d56 into python:main Mar 10, 2026
135 checks passed
@vstinner
Copy link
Copy Markdown
Member

The change LGTM. I merged it. Thanks for the fix.

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.

5 participants