-
-
Notifications
You must be signed in to change notification settings - Fork 31.9k
test_run_fileexflags() crash on PPC64LE RHEL7 LTO + PGO 3.x #118422
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
Comments
The bug can be reproduced just with these 2 tests:
Sometimes, I get the glibc error message:
|
The crash is more likely if PYC files are removed:
|
I cannot reproduce the issue with This buildbot uses an old GCC version: |
If it is only reproducible with a release build, would the following patch help? diff --git a/Modules/_testcapi/run.c b/Modules/_testcapi/run.c
index 4fd98b82d76..b35a12e9424 100644
--- a/Modules/_testcapi/run.c
+++ b/Modules/_testcapi/run.c
@@ -74,6 +74,7 @@ run_fileexflags(PyObject *mod, PyObject *pos_args)
result = PyRun_FileExFlags(fp, filename, start, globals, locals, closeit, pflags);
+#ifndef NDEBUG
#if defined(__linux__) || defined(MS_WINDOWS) || defined(__APPLE__)
/* The behavior of fileno() after fclose() is undefined, but it is
* the only practical way to check whether the file was closed.
@@ -85,6 +86,7 @@ run_fileexflags(PyObject *mod, PyObject *pos_args)
return NULL;
}
#endif
+#endif // NDEBUG
if (!closeit && fileno(fp) < 0) {
PyErr_SetString(PyExc_AssertionError, "Bad file descriptor after excution");
Py_XDECREF(result); Or maybe just remove this dangerous implementation depending code? |
Don't test undefined fclose() behavior, but use fstat() as a reliable test if the file was closed or not.
Don't test undefined fileno() behavior, but use fstat() as a reliable test if the file was closed or not.
Don't test undefined fileno() behavior on a closed file, but use fstat() as a reliable test if the file was closed or not.
I wrote PR gh-118429 to use fstat() instead of relying on an undefined behavior of fileno() on a closed file. |
Don't test the undefined behavior of fileno() on a closed file, but use fstat() as a reliable test if the file was closed or not.
Don't test the undefined behavior of fileno() on a closed file, but use fstat() as a reliable test if the file was closed or not.
Bug report
build: https://buildbot.python.org/all/#/builders/43/builds/5305/steps/5/logs/stdio
Logs:
Linked PRs
The text was updated successfully, but these errors were encountered: