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
tempfile.py rewrite #36966
Comments
This rewrite closes a number of security-relevant races |
Logged In: YES This needs some serious review! Volunteers??? |
Logged In: YES I've revised the patch; ignore the old one. This version Also, I went through the entire CVS repository and replaced The sole functional change to tempfile.py itself, from the |
Logged In: YES I like the idea of fixing security holes. This patch is *humungous*. Even just the doc changes and the Zack, can you try to interest someone with more time than me What's the point of renaming all imports with a leading |
Logged In: YES I'm afraid my idea of patch size comes from GCC land, where I tried, and failed, to break up the changes to tempfile.py Unfortunately, I am about to go on vacation for five days, |
Logged In: YES OK, I'll do something along those lines myself. |
Logged In: YES I've checked this all in now. The changes to I hope the community will give it some review. It will |
Logged In: YES Guido, there are still 3 uses of mktemp after the checkin. Lib/toaiff.py:102 |
Logged In: YES Oops, looks like typos in the patch. Fixed (I hope). Question for Zack: I noticed that a few times you changed this: temp = tempfile.mktemp() into this:
If the latter is secure, why can't mktemp() be defined as |
Logged In: YES I'm reopening this just as a precaution. The snake farm reported two messages on HP-UX 11 when the Exception exceptions.AttributeError: "mkstemped instance has The mkstemped class is defined in test_maketemp.py. That |
1 similar comment
Logged In: YES I'm reopening this just as a precaution. The snake farm reported two messages on HP-UX 11 when the Exception exceptions.AttributeError: "mkstemped instance has The mkstemped class is defined in test_maketemp.py. That |
Logged In: YES I'd like to change the binary=True argument to mkstemp into News about the HP errors from Kalle Svensson: Traceback (most recent call last):
File "../python/dist/src/Lib/test/test_tempfile.py", line
719, in ?
test_main()
File "../python/dist/src/Lib/test/test_tempfile.py", line
716, in test_main
test_support.run_suite(suite)
File
"/mp/slaskdisk/tmp/sfarmer/python/dist/src/Lib/test/test_support.py",
line 188, in run_suite
raise TestFailed(err)
test.test_support.TestFailed: Traceback (most recent call last):
File "../python/dist/src/Lib/test/test_tempfile.py", line
295, in test_basic_many
File "../python/dist/src/Lib/test/test_tempfile.py", line
278, in do_create
File "../python/dist/src/Lib/test/test_tempfile.py", line
33, in failOnException
File
"/mp/slaskdisk/tmp/sfarmer/python/dist/src/Lib/unittest.py",
line 260, in fail
AssertionError: _mkstemp_inner raised exceptions.OSError:
[Errno 24] Too many open files: '/tmp/aaU3irrA' |
Logged In: YES The "Too many open files" problem is solved. The HP system But maybe the test would work just as well if it tried to |
Logged In: YES Closing again. Reduced the number of temp files to 100. |
Logged In: YES Isn't it much more logical to give mkstemp() a mode="w+b" argument? The other routines have that as well, and it is also more in line with open() and such... |
Logged In: YES Nevermind. Just saw the discussion on python-dev (this is a file descriptor returned, not a file pointer, so stdio is nowhere in sight). |
Logged In: YES I hope I'm doing the right thing by re-opening this rather than I'm seeing a very odd failure in test_tempfile on FreeBSD 4.4. The failure occurs when I run the full regression test with ./python -E -tt Lib/test/regrtest.py -l -u network test_tempfile At this point, I haven't tried other -u option combinations. The error log shows:
test test_tempfile failed -- Traceback (most recent call last):
File "/home/andymac/cvs/python/python-
cvs/Lib/test/test_tempfile.py", line 345, in test_noinherit
"child process exited successfully")
File "/home/andymac/cvs/python/python-
cvs/Lib/unittest.py", line 268, in failUnless
if not expr: raise self.failureException, msg
AssertionError: child process exited successfully Unfortunately Real Job has wiped out any time I might have Intuitive guesses about where to start looking would be The OS/2 EMX port has the mkstemped problem noted below |
Logged In: YES It sounds like some other test -- probably one of the ones ./python -E -tt ./Lib/test/regrtest.py -l -u network ? |
Logged In: YES Andrew, can you check again with current CVS? I checked in |
Logged In: YES I didn't get to try Zack's suggestion before my FreeBSD auto With Guido's checkin, test_tempfile passes the TESTOPT="-l OS/2 EMX actually had 2 problems:
I've checked in a small change to test_tempfile.py to deal I'm closing this patch as my issues are now resolved. |
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: