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-142379: configure.ac: detect unusable termio operations by tpetazzoni · Pull Request #142380 · python/cpython

Conversation

@tpetazzoni

@tpetazzoni tpetazzoni commented Dec 7, 2025 •
edited by bedevere-app Bot
Loading

Uh oh!

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

Copy link
Copy Markdown
Contributor

Some termio operations are not actually usable on some architectures. For example, the TCGETA, TCSETA, TCSETAF and TCSETAW are defined with a reference to "struct termio" on alpha, hppa and sparc64, but "struct termio" is no longer defined since glibc 2.42, causing a build failure.

Instead of using those operations as soon as they are defined, this commit checks more carefully that they are actually usable. This is done using a new m4 macro PY_CHECK_IOCTL.

  • Issue: TCGETA, TCSETA, TCSETAF, TCSETAW termios ioctl no longer usable on all architectures with glibc 2.42 #142379

Sorry, something went wrong.

Uh oh!

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

All reactions
@tpetazzoni
tpetazzoni requested review from AA-Turner, corona10, emmatyping and erlend-aasland as code owners December 7, 2025 13:59
@bedevere-app bedevere-app Bot added the awaiting review label Dec 7, 2025
@bedevere-app bedevere-app Bot mentioned this pull request Dec 7, 2025
TCGETA, TCSETA, TCSETAF, TCSETAW termios ioctl no longer usable on all architectures with glibc 2.42 #142379
Open
@tpetazzoni tpetazzoni mentioned this pull request Dec 7, 2025
Modules/termios.c: stop using TC operations that need termio.h #142326
Closed
@tpetazzoni
tpetazzoni force-pushed the check-tc-operations branch 2 times, most recently from fd47b13 to d766640 Compare December 7, 2025 14:11
picnixz
picnixz reviewed Dec 7, 2025
View reviewed changes
Comment thread Modules/termios.c Resolved

Uh oh!

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

Comment thread configure.ac Outdated
Comment on lines +98 to +116
dnl PY_CHECK_IOCTL(IOCTL_SYMBOL)
AC_DEFUN([PY_CHECK_IOCTL],
[
AC_MSG_CHECKING([for $1])
AC_COMPILE_IFELSE(
[AC_LANG_PROGRAM(
[[#include <sys/ioctl.h>]],
[[
/* Test whether $1 is declared */
long val = $1;
return 0;
]]
)],
[AC_MSG_RESULT([yes])
AC_DEFINE([HAVE_$1], [1],
[Define this if $1 termio operation is usable])],
[AC_MSG_RESULT([no])]
)
])

@picnixz picnixz Dec 7, 2025

Copy link
Copy Markdown
Member

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.

Can you make this a generic function instead? it's useful for checking the presence of a macro. Make the includes and the expected macro type parameters of that function, as well as the name of your HAVE_ macro as you did. This could be useful elsewhere.

Ina ddition, there is no need for the return 0; as it's implicit. Also remove `/* Test whether $1 is declared */ because it's trivial what it does.

Sorry, something went wrong.

Uh oh!

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

All reactions

@tpetazzoni tpetazzoni Dec 7, 2025

Copy link
Copy Markdown
Contributor Author

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 for the feedback @picnixz. Actually such a generic macro already "exists" to some degree, it's AC_CHECK_DECL. However, we can't use it in our specific case because what AC_CHECK_DECL does is:

#ifndef YOUR_DECLARATION
(void) YOUR_DECLARATION;
#endif 

The idea being: the #ifndef test if it is a macro => if it is, then fine, we're good. If it's not a macro, it checks if it's a valid r-value.

In our case, TCGETA is a macro, BUT we need to check that it is actually usable, not just "defined". And that's why AC_CHECK_DECL doesn't do the trick.

If you still think a generic macro would be good, what name should it have? Indeed, PY_CHECK_DECL would be very confusing if it has this subtle difference with AC_CHECK_DECL. Or maybe PY_CHECK_USABLE_DECL ?

And of course, our macro isn't as generic as AC_CHECK_DECL, because if the declaration exists but has no value (like #define FOO), then our test will fail.

Sorry, something went wrong.

Uh oh!

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

All reactions

@picnixz picnixz Dec 7, 2025 •
edited
Loading

Uh oh!

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

Copy link
Copy Markdown
Member

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.

My idea was actually different. What I wanted to test is:

TYPE holder = $1;

where you specify TYPE (in your case it's long). And for the name, it would be PY_CHECK_CONSTANT. I wanted you to actually remove the comment but not the test itself.

Sorry, something went wrong.

Uh oh!

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

All reactions

@tpetazzoni tpetazzoni Dec 8, 2025

Copy link
Copy Markdown
Contributor Author

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.

Makes a lot of sense, will do!

Sorry, something went wrong.

Uh oh!

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

All reactions
@bedevere-app bedevere-app Bot added awaiting core review and removed awaiting review labels Dec 7, 2025
@picnixz
picnixz dismissed a stale review December 7, 2025 23:07

spam review

@bedevere-app bedevere-app Bot added awaiting review and removed awaiting core review labels Dec 7, 2025
@tpetazzoni
tpetazzoni force-pushed the check-tc-operations branch from d766640 to 7ba29d0 Compare December 8, 2025 22:31
@tpetazzoni

tpetazzoni commented Dec 8, 2025

Copy link
Copy Markdown
Contributor Author

@picnixz I just pushed a new version of this branch, which normally takes into account your proposed changes. Let me know what you think.

All reactions

Sorry, something went wrong.

Uh oh!

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

picnixz
picnixz reviewed Dec 8, 2025
View reviewed changes
Comment thread configure.ac Resolved

Uh oh!

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

@tpetazzoni
tpetazzoni force-pushed the check-tc-operations branch 2 times, most recently from cdd35f0 to 5e7390b Compare December 9, 2025 10:22
@tpetazzoni

tpetazzoni commented Dec 9, 2025

Copy link
Copy Markdown
Contributor Author

The CI fails with "Error: The template is not valid. .github/workflows/build.yml (Line: 715, Col: 24): Error reading JToken from JsonReader. Path '', line 0, position 0." which doesn't make much sense to me.

All reactions

Sorry, something went wrong.

Uh oh!

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

@emmatyping

emmatyping commented Dec 9, 2025

Copy link
Copy Markdown
Member

The CI fails with "Error: The template is not valid. .github/workflows/build.yml (Line: 715, Col: 24): Error reading JToken from JsonReader. Path '', line 0, position 0." which doesn't make much sense to me.

This was due to a change in the pipeline definitions I believe. I've merged in main which should fix this issue.

All reactions

Sorry, something went wrong.

Uh oh!

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

picnixz
picnixz reviewed Dec 10, 2025
View reviewed changes
Comment thread Misc/NEWS.d/next/Build/2025-12-07-15-06-37.gh-issue-142379.7vvmGc.rst Resolved

Uh oh!

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

Comment thread configure.ac Resolved

Uh oh!

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

@tpetazzoni
tpetazzoni force-pushed the check-tc-operations branch from f9abc5f to 21e3150 Compare December 10, 2025 10:04
vstinner
vstinner reviewed Dec 11, 2025
View reviewed changes
Comment thread Misc/NEWS.d/next/Build/2025-12-07-15-06-37.gh-issue-142379.7vvmGc.rst Resolved

Uh oh!

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

Comment thread configure.ac Resolved

Uh oh!

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

@tpetazzoni
tpetazzoni force-pushed the check-tc-operations branch from 21e3150 to 9b68b03 Compare December 12, 2025 09:42
@tpetazzoni
configure.ac: detect unusable termio operations
7b99166
Some termio operations are not actually usable on some
architectures. For example, the TCGETA, TCSETA, TCSETAF and TCSETAW
are defined with a reference to "struct termio" on alpha, hppa and
sparc64, but "struct termio" is no longer defined since glibc 2.42,
causing a build failure.

Instead of using those operations as soon as they are defined, this
commit checks more carefully that they are actually usable. Such a
check cannot be done with the standard AC_CHECK_DECL() m4 macro, as
this macro only checks that the #define exists, not that it is
actually usable (i.e builds properly). Therefore, we introduce a
PY_CHECK_CONSTANT() m4 macro, that verifies that the constant is
actually usable.

Signed-off-by: Thomas Petazzoni <[email protected]>
@tpetazzoni
tpetazzoni force-pushed the check-tc-operations branch from 9b68b03 to 7b99166 Compare December 12, 2025 10:57
vstinner
vstinner approved these changes Dec 12, 2025
View reviewed changes

@vstinner vstinner left a comment

Copy link
Copy Markdown
Member

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.

LGTM

Sorry, something went wrong.

Uh oh!

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

All reactions
@bedevere-app bedevere-app Bot removed the awaiting review label Dec 12, 2025
@bedevere-app bedevere-app Bot added the awaiting merge label Dec 12, 2025
@picnixz
picnixz self-requested a review December 12, 2025 23:01
picnixz
picnixz reviewed Dec 12, 2025
View reviewed changes
Comment thread Misc/NEWS.d/next/Build/2025-12-07-15-06-37.gh-issue-142379.7vvmGc.rst
@@ -0,0 +1,9 @@
Some termio operations are not actually usable on some

@picnixz picnixz Dec 12, 2025

Copy link
Copy Markdown
Member

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.

Why is the NEWS entry still long? I think you overwrote your change.

Sorry, something went wrong.

Uh oh!

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

All reactions
picnixz
picnixz reviewed Dec 12, 2025
View reviewed changes
Comment thread configure.ac
Comment on lines +105 to +106
AC_DEFINE([HAVE_$2], [1],
[Defined if $2 is usable])],

@picnixz picnixz Dec 12, 2025

Copy link
Copy Markdown
Member

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.

Suggested change
AC_DEFINE([HAVE_$2], [1],
[Defined if $2 is usable])],
AC_DEFINE([HAVE_$2], [1], [Defined if $2 is usable])],

(Sorry, but I really want to avoid vertically expanding our configure.ac as much as possible; ideally we should have all "functions" in a separate file but we don't do that...)

Sorry, something went wrong.

Uh oh!

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

All reactions
@vstinner

vstinner commented Jan 6, 2026

Copy link
Copy Markdown
Member

Ping @tpetazzoni: Can you address @picnixz's review?

All reactions

Sorry, something went wrong.

Uh oh!

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

@mjt0k

mjt0k commented Jan 21, 2026

Copy link
Copy Markdown

I just come across the same issue in another piece of software. To me, it look like a distribution bug (the structures are used in kernel headers provided by the distribution, but come from glibc, - a distribution didn't update the two in one go). I'd say everyone should not jump through hoops on this but ask distribution(s) to fix the mess. This is definitely a build environment problem, not the software-being-built problem. FWIW.

All reactions

Sorry, something went wrong.

Uh oh!

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

@mjt0k

mjt0k commented Jan 21, 2026

Copy link
Copy Markdown

The fix hopefully should be in linux soon. E.g. https://lore.kernel.org/sparclinux/[email protected]/T/#t

All reactions

Sorry, something went wrong.

Uh oh!

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

@vfazio

vfazio commented Feb 2, 2026 •
edited
Loading

Uh oh!

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

Copy link
Copy Markdown
Contributor

The fix hopefully should be in linux soon. E.g. https://lore.kernel.org/sparclinux/[email protected]/T/#t

@mjt0k Were the patches accepted?

All reactions

Sorry, something went wrong.

Uh oh!

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

@encukou

encukou commented Feb 18, 2026

Copy link
Copy Markdown
Member

-1; I don't think we should add workarounds for new bugs unsupported architectures.
I get that this sucks, but IMO it should get a downstream hotfix.

But if y'all disagree: can we start using _Py_HAVE_TCGETA etc. for new macros?

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

@github-actions

github-actions Bot commented May 3, 2026

Copy link
Copy Markdown

This PR is stale because it has been open for 30 days with no activity.

All reactions

Sorry, something went wrong.

Uh oh!

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

@github-actions github-actions Bot added the stale Stale PR or inactive for long period of time. label May 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@picnixz picnixz picnixz left review comments
@vstinner vstinner vstinner approved these changes
@erlend-aasland erlend-aasland Awaiting requested review from erlend-aasland erlend-aasland is a code owner
@corona10 corona10 Awaiting requested review from corona10 corona10 is a code owner
@AA-Turner AA-Turner Awaiting requested review from AA-Turner AA-Turner is a code owner
@emmatyping emmatyping Awaiting requested review from emmatyping emmatyping is a code owner

Uh oh!

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

Assignees

No one assigned

Labels

awaiting merge stale Stale PR or inactive for long period of time.

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.

7 participants

@tpetazzoni @emmatyping @vstinner @mjt0k @vfazio @encukou @picnixz
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.