Bug 552757
| Summary: | unreliable tempfile mechanism in /usr/share/rhn/config_common/file_utils.py | ||||||
|---|---|---|---|---|---|---|---|
| Product: | Red Hat Satellite 5 | Reporter: | Xixi <xdmoon> | ||||
| Component: | Configuration Management | Assignee: | Tomas Lestach <tlestach> | ||||
| Status: | CLOSED ERRATA | QA Contact: | Dimitar Yordanov <dyordano> | ||||
| Severity: | medium | Docs Contact: | |||||
| Priority: | medium | ||||||
| Version: | unspecified | CC: | cperry, dyordano, mzazrivec, tao, xdmoon | ||||
| Target Milestone: | --- | ||||||
| Target Release: | --- | ||||||
| Hardware: | All | ||||||
| OS: | Linux | ||||||
| Whiteboard: | |||||||
| Fixed In Version: | Doc Type: | Bug Fix | |||||
| Doc Text: |
Due to incorrect timing, a temporary file creation may have failed, preventing the configuration file from being deployed. This error has been fixed, and temporary files are now always created as expected.
|
Story Points: | --- | ||||
| Clone Of: | Environment: | ||||||
| Last Closed: | 2010-10-11 14:34:40 UTC | Type: | --- | ||||
| Regression: | --- | Mount Type: | --- | ||||
| Documentation: | --- | CRM: | |||||
| Verified Versions: | Category: | --- | |||||
| oVirt Team: | --- | RHEL 7.3 requirements from Atomic Host: | |||||
| Cloudforms Team: | --- | Target Upstream Version: | |||||
| Embargoed: | |||||||
| Bug Depends On: | |||||||
| Bug Blocks: | 518253 | ||||||
| Attachments: |
|
||||||
|
Description
Xixi
2010-01-06 02:18:43 UTC
Proposed patch from support is attached - file_utils.py.patch. It uses tempfile.mkstemp for temp file creation. If we don't clean up temp files, maybe alternatively consider tempfile.NamedTemporaryFile - however that will delete the file as soon as its closed - or will need to clean it up after use. Created attachment 381901 [details]
file_utils.py.patch
Patch applied with preserving pid as a part of the temp filename. spacewalk.git: 9a8e2ce1a02b731e915815235520cceae08db1ac satellite.git SATELLITE-5.3: f49230a4cc587470509151a837fb61efd1e5de1d From the research and testing I did it turned out that the reason why the bug appeared is the fact that not all systems provide time with a better precision than 1 second. This has direct impact to the time.time() function that was in use. In this case the temporary file name format is like /tmp/test_temp-20468-1283174059. In case the system provides time with a better precision than 1 second the temporary file name is like "/tmp/test_temp-20463-1283174058.92823195" and the problem does not appear. In order the issue to be avoided in the fix is used tempfile.mkstemp function that creates temp files in format that does not depend on system time. Example: /tmp/test_temp-30533-Ybpw51 /tmp/test_temp-30533-YWJojh /tmp/test_temp-30533-zxIW0W /tmp/test_temp-30533-ZyXptw I tested all the functionality of the RHN Manager,Client and Action Control features after the fix was applied (v.5.9.5-6) and I have not found any impact.
Technical note added. If any revisions are required, please edit the "Technical Notes" field
accordingly. All revisions will be proofread by the Engineering Content Services team.
New Contents:
Due to incorrect timing, a temporary file creation may have failed, and thus prevent the configuration file from being deployed. This error has been fixed, and temporary files are now always created as expected.
Technical note updated. If any revisions are required, please edit the "Technical Notes" field
accordingly. All revisions will be proofread by the Engineering Content Services team.
Diffed Contents:
@@ -1 +1 @@
-Due to incorrect timing, a temporary file creation may have failed, and thus prevent the configuration file from being deployed. This error has been fixed, and temporary files are now always created as expected.+Due to incorrect timing, a temporary file creation may have failed, preventing the configuration file from being deployed. This error has been fixed, and temporary files are now always created as expected.
An advisory has been issued which should help the problem described in this bug report. This report is therefore being closed with a resolution of ERRATA. For more information on therefore solution and/or where to find the updated files, please follow the link below. You may reopen this bug report if the solution does not work for you. http://rhn.redhat.com/errata/RHBA-2010-0761.html |