Skip to content

Conversation

@bneradt
Copy link
Contributor

@bneradt bneradt commented Apr 13, 2022

Some tests create a so-called sandbox directory, use it for the files
the object under test creates, then remove that temporary sandbox
directory. To do this they use getTemporaryDir(). The test_jsonrpcserver
test attempted to do the same thing, but since that function wasn't
readily available, it used a similarly sounding
fs::temp_directory_path(). That function, however, just references /tmp.
As a result, test_jsonrpcserver would store files in /tmp then remove
/tmp instead of a test-specific temporary directory. This is a problem
since it would remove other processes' temporary files stored in /tmp
along with its own test files. This patch fixes this by creating
getTemporaryDir() for test_jsonrpcserver and calling that instead.

Fixes #8792

Some tests create a so-called sandbox directory, use it for the files
the object under test creates, then remove that temporary sandbox
directory. To do this they use getTemporaryDir(). The test_jsonrpcserver
test attempted to do the same thing, but since that function wasn't
readily available, it used a similarly sounding
fs::temp_directory_path(). That function, however, just references /tmp.
As a result, test_jsonrpcserver would store files in /tmp then remove
/tmp instead of a test-specific temporary directory. This is a problem
since it would remove other processes' temporary files stored in /tmp
along with its own test files. This patch fixes this by creating
getTemporaryDir() for test_jsonrpcserver and calling that instead.

Fixes apache#8792
@bneradt bneradt added the Tests label Apr 13, 2022
@bneradt bneradt added this to the 10-Dev milestone Apr 13, 2022
@bneradt bneradt requested a review from bryancall as a code owner April 13, 2022 21:56
@bneradt bneradt self-assigned this Apr 13, 2022
@bneradt bneradt merged commit fc7787d into apache:10-Dev Apr 14, 2022
@bneradt bneradt deleted the fix_rpcserver_test_to_not_delete_tmp branch April 14, 2022 15:26
@zwoop zwoop modified the milestones: 10-Dev, 10.0.0 Feb 2, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants