Use unique name for AlertNotify tempfile #6527

Merged
merged 1 commit into from Aug 7, 2015

Conversation

Projects
None yet
4 participants
@casey
Contributor

casey commented Aug 6, 2015

Fixes #6524

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

- boost::filesystem::path temp = GetTempPath() / "alertnotify.txt";
- boost::filesystem::remove(temp);
+ boost::filesystem::path temp = GetTempPath() /
+ boost::filesystem::unique_path("alertnotify-%%%%.txt");

This comment has been minimized.

@jonasschnelli

jonasschnelli Aug 6, 2015

Member

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

@jonasschnelli

jonasschnelli Aug 6, 2015

Member

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

This comment has been minimized.

@casey

casey Aug 6, 2015

Contributor

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

@casey

casey Aug 6, 2015

Contributor

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

This comment has been minimized.

@jonasschnelli

jonasschnelli Aug 6, 2015

Member

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.

@jonasschnelli

jonasschnelli Aug 6, 2015

Member

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

This comment has been minimized.

Show comment
Hide comment
@randy-waterhouse

randy-waterhouse Aug 6, 2015

Contributor

tested ACK

Contributor

randy-waterhouse commented Aug 6, 2015

tested ACK

@jonasschnelli

This comment has been minimized.

Show comment
Hide comment
@jonasschnelli

jonasschnelli Aug 6, 2015

Member

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?

Member

jonasschnelli commented Aug 6, 2015

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

This comment has been minimized.

Show comment
Hide comment
@laanwj

laanwj Aug 6, 2015

Member

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.

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

This comment has been minimized.

Show comment
Hide comment
@casey

casey Aug 6, 2015

Contributor

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

Contributor

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

This comment has been minimized.

Show comment
Hide comment
@jonasschnelli

jonasschnelli Aug 6, 2015

Member

@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.

Member

jonasschnelli commented Aug 6, 2015

@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

This comment has been minimized.

Show comment
Hide comment
@laanwj

laanwj Aug 7, 2015

Member

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

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

1 check passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details

laanwj added a commit that referenced this pull request Aug 7, 2015

Merge pull request #6527
231c560 Use unique name for AlertNotify tempfile (Casey Rodarmor)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment