Merge lp:~widelands-dev/widelands/bug-1776008-boost-deleted-uuid-function into lp:widelands

Proposed by Notabilis
Status: Merged
Merged at revision: 8731
Proposed branch: lp:~widelands-dev/widelands/bug-1776008-boost-deleted-uuid-function
Merge into: lp:widelands
Diff against target: 24 lines (+2/-2)
2 files modified
src/random/random.cc (+1/-1)
src/wlapplication.cc (+1/-1)
To merge this branch: bzr merge lp:~widelands-dev/widelands/bug-1776008-boost-deleted-uuid-function
Reviewer Review Type Date Requested Status
kaputtnik (community) testing Approve
Review via email: mp+347773@code.launchpad.net

Commit message

Removing explicit assignment when creating random UUID generator.

Description of the change

Removing explicit assignment when creating random generator. This fixes a problem with the current version of the boost library which no longer permits assignments.

I can't confirm the linked bug since I am using an older version of boost, so I need someone to compile this with the new version (1.67). On my system the changed code still compiles and works as expected with the old boost version.

For a quick test, open ~/.widelands/config and look at the line which is similar to:
  uuid="8440371b-db4f-41aa-b742-611b3b90841f"
when removing the line "last_start=..." it should generate a new UUID in the file on start of widelands. The new UUID should be something similar long with this branch and with trunk.

The change in wlapplication.cc is a bug I encountered while testing: When removing only the "uuid=..." line it crashes when trying to join the metaserver lobby as an unregistered user. The change fixes that by making sure the configuration value is initialized.

To post a comment you must log in.
Revision history for this message
kaputtnik (franku) wrote :

Compiling works fine :-) (beside the known issues)

Here are the values of your quick test:

Old values:
uuid="3436e035-dc2e-46b8-ac1f-7487343547e6"
last_start="1528746135"

After deleting last_start:
uuid="a9f6baf2-04c9-4588-9bbd-7c42e83eb1e6"
last_start="1528746335"

After deleting uuid:
uuid="93113199-e1b7-47e2-9d49-6f21be977be9"
last_start="1528746469"

After deleting both:
uuid="8fb0f3f7-1109-4c85-bed2-c049e043e909"
last_start="1528746596"

Did also run the regression tests (no idea if this is importand :-D ):

> Ran 42 tests in 513.259s
> OK

From my side all fine now.

review: Approve (testing)
Revision history for this message
bunnybot (widelandsofficial) wrote :

Continuous integration builds have changed state:

Travis build 3603. State: passed. Details: https://travis-ci.org/widelands/widelands/builds/390925937.
Appveyor build 3405. State: success. Details: https://ci.appveyor.com/project/widelands-dev/widelands/build/_widelands_dev_widelands_bug_1776008_boost_deleted_uuid_function-3405.

Revision history for this message
Notabilis (notabilis27) wrote :

Thanks for testing! The results look good and bunnybot does not complain either, so lets merge this.

@bunnybot merge

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/random/random.cc'
2--- src/random/random.cc 2018-04-07 16:59:00 +0000
3+++ src/random/random.cc 2018-06-11 18:36:01 +0000
4@@ -105,6 +105,6 @@
5 }
6
7 std::string generate_random_uuid() {
8- static boost::uuids::random_generator gen = boost::uuids::random_generator();
9+ static boost::uuids::random_generator gen;
10 return boost::uuids::to_string(gen());
11 }
12
13=== modified file 'src/wlapplication.cc'
14--- src/wlapplication.cc 2018-06-01 15:42:03 +0000
15+++ src/wlapplication.cc 2018-06-11 18:36:01 +0000
16@@ -782,7 +782,7 @@
17 // KLUDGE!
18
19 long int last_start = s.get_int("last_start", 0);
20- if (last_start + 12 * 60 * 60 < time(nullptr)) {
21+ if (last_start + 12 * 60 * 60 < time(nullptr) || !s.get_string("uuid")) {
22 // First start of the game or not started for 12 hours. Create a (new) UUID.
23 // For the use of the UUID, see network/internet_gaming_protocol.h
24 s.set_string("uuid", generate_random_uuid());

Subscribers

People subscribed via source and target branches

to status/vote changes: