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

bpo-31904: fix signalmodule issue in VxWorks #12670

Closed

Conversation

yuesun1
Copy link

@yuesun1 yuesun1 commented Apr 3, 2019

The type of sig_atomic_t is 'unsigned char' in VxWorks, so it can't be assigned to -1, so in the signalmodule.c. I set the data type of fd in struct 'wakeup' to 'int' for VxWorks.

More and full support on modules for VxWorks will continuously be added by the coming PRs.
VxWorks is a product developed and owned by Wind River. For VxWorks introduction or more details, go to https://www.windriver.com/products/vxworks/
Wind River will have a dedicated engineering team to contribute to the support as maintainers.
We already have a working buildbot worker internally, but has not bound to master. We will check the process for the buildbot, then add it.

https://bugs.python.org/issue31904

The type of sig_atomic_t is 'unsigned char' in VxWorks, so it can't be assigned to -1,
so I set the type of fd in struct 'wakeup' to 'int' for VxWorks.
Copy link
Contributor

@jdemeyer jdemeyer left a comment

Choose a reason for hiding this comment

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

The fd member is clearly meant to be a file descriptor, which is of type int (as specified by POSIX). So the old code is unconditionally wrong: you should use int on all systems, not just VxWorks. This happened to work because sig_atomic_t is int on almost all systems.

@@ -0,0 +1 @@
fix VxWorks signalmodule issue
Copy link
Contributor

Choose a reason for hiding this comment

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

I'd rather frame this as a general bug-fix and not a VxWorks-specific issue.

@jdemeyer
Copy link
Contributor

Now that you're correctly using int, reading/writing it may no longer be atomic. So you should use the atomic macros to access it (there are plenty of examples in signalmodule.c doing that).

@yuesun1
Copy link
Author

yuesun1 commented Apr 10, 2019

Thanks for your comment, now the fd is not atomic, do you mean I also still use _Py_atomic_load() or _Py_atomic_store() to read/write it ?

Thanks very much

@vstinner
Copy link
Member

Please open a separated issue for this change.

@jdemeyer
Copy link
Contributor

Thanks for your comment, now the fd is not atomic, do you mean I also still use _Py_atomic_load() or _Py_atomic_store() to read/write it ?

Yes, I think so. You'll find many uses of these functions in signalmodule.c.

@brettcannon brettcannon added the type-bug An unexpected behavior, bug, or error label Apr 17, 2019
@vstinner
Copy link
Member

The easiest way to fix VxWorks but not impact other operating systems if to modify your PR as, pseudo-code:

#ifdef <VxWorks>
int ...
#else
sig_atomic_t ...
#endif

@jdemeyer
Copy link
Contributor

The existing code is unconditionally wrong: it's a file descriptor, which is of type int.

@vstinner
Copy link
Member

The existing code is unconditionally wrong: it's a file descriptor, which is of type int.

I already asked "Please open a separated issue for this change." but nobody did that.

@jdemeyer
Copy link
Contributor

I already asked "Please open a separated issue for this change." but nobody did that.

I know but that doesn't imply that the existing code is correct. It only means that nobody cares enough to open an issue.

@vstinner
Copy link
Member

It only means that nobody cares enough to open an issue.

In case of doubt, I'm ok to leave the code unchanged: that's the safest option. That's the principle of https://en.wikipedia.org/wiki/Wikipedia:Chesterton%27s_fence To remove the fence, someone must first investigate why it's there.

This issue is about VxWorks. I disagre that adding VxWorks support would change the code on other platforms.

@vstinner
Copy link
Member

Let's continue the work on PR #23391.

@vstinner vstinner closed this Nov 30, 2020
@pxinwr pxinwr deleted the fix-issue-31904-signalmodule branch July 12, 2021 09:42
@kuhlenough kuhlenough mannequin mentioned this pull request Jan 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
awaiting core review type-bug An unexpected behavior, bug, or error
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants