Skip to content

Use unique name for AlertNotify tempfile#6527

Merged
laanwj merged 1 commit into
bitcoin:masterfrom
casey:alert-tests-tempfile
Aug 7, 2015
Merged

Use unique name for AlertNotify tempfile#6527
laanwj merged 1 commit into
bitcoin:masterfrom
casey:alert-tests-tempfile

Conversation

@casey
Copy link
Copy Markdown
Contributor

@casey casey commented Aug 6, 2015

Fixes #6524

Use a unique name for alertnotify.txt tempfile during AlertNotify test

Comment thread src/test/alert_tests.cpp
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

minor nit: wrong indent (same on L171 / not related to this PR)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Isn't the right indentation four spaces? Or is it different for a line continuation?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Meh. Sorry. I oversaw the line break... all good!
You can always use clang-format -i <file> if you wan't to confirm to the code-style-guidelines.

@randy-waterhouse
Copy link
Copy Markdown
Contributor

tested ACK

@jonasschnelli
Copy link
Copy Markdown
Contributor

ACK.
Couldn't find any details about when files generated with boost::filesystem::unique_path are deleted.
I think adding a boost::filesystem::remove(temp); wouldn't harm?

@laanwj
Copy link
Copy Markdown
Member

laanwj commented Aug 6, 2015

ACK. Using a hardcoded/predictable temporary file name can be dangerous.

And agree with @jonasschnelli that the test should try to clean up after itself.

@casey
Copy link
Copy Markdown
Contributor Author

casey commented Aug 6, 2015

@jonasschnelli @laanwj It actually does clean up after itself; there's a call to boost::filesystem::remove(temp) at the end of the function.

@jonasschnelli
Copy link
Copy Markdown
Contributor

@casey: Ah. Now i see how this works. The boost::filesystem::remove(temp); removed in this PR was there because the file was not really a random tmp file.

ACK.

@laanwj
Copy link
Copy Markdown
Member

laanwj commented Aug 7, 2015

Oh! oops. Apologies for the spurious comment, then.

@laanwj laanwj merged commit 231c560 into bitcoin:master Aug 7, 2015
laanwj added a commit that referenced this pull request Aug 7, 2015
231c560 Use unique name for AlertNotify tempfile (Casey Rodarmor)
@bitcoin bitcoin locked as resolved and limited conversation to collaborators Sep 8, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

make check leaves behind /tmp/alertnotify.txt

4 participants