Ensure scope 'this' is properly restored, add unit test.

Closes #2632 and #2781
(cherry picked from commits 4defc519a1d22d7c4f3461b35bbaf1b9d9e3f59c)
and e8bfa5cee08f37e1e946e66ef88c60329944cfa0)
Fix a typo
(cherry picked from commit 7bcc16d06caa8fca3da10b17d68ef2143b36a692)
Making libpromises the same version as the release
(cherry picked from commit 27114b065ea26b63c774429d4871e9cdc26075f6)
fix for bug #2182. Added more params for the promises hashing algo
(cherry picked from commit f7cd7bd5f1c20eb889d85c48b8422035f7f51d6a)
Missing bug fix into ChangeLog
(cherry picked from commit 0f153a3ea67b80966e43b3bf7f575ab9f3a867b4)
Typo fixes and updates
(cherry picked from commit 5a2ca7502fab1cd32ffc36a9275f1445d1cb597d)
Fix deadlock in cf-serverd, see redmine #2864.

Logging is removed from the signal handler until it is reimplemented as
reentrant (now it calls vasprintf() which calls malloc(), which is not
reentrant).

Also marked exit(0) in the agent for future removal for the same reasons.
(cherry picked from commit 54f2dd564e62d27c99f51f177eab9f3cb9fe88da)
Change select timeout to 1 second.

Previously the worst case for exiting was 10 seconds after the signal arrival.
(cherry picked from commit 5aa0137a390907e0d2116200a7f9fa44f7e8e0b9)
Close all databases as the last thing before exiting

...and keep mutexes locked to make sure they are not reopened by some
background thread.
(cherry picked from commit baf2670ff40bc7fffc3560a1f5426cdfe5e3f647)
Output messages when starting and exiting

...since our signal handlers are silent now.
(cherry picked from commit c34fe052e856f13f86d6938f5fc66496098d9711)
Fix tarball generated by make dist.
(cherry picked from commit a2ef6f02c79c885ba67b90e419c0041572c77286)
Removed invalid comment and superfluous declaration.
(cherry picked from commit 947f97557bdb0cb65bc41a857f803339d44f64ca)
Fixing parsing of lists passed through use_module remine #2239
(cherry picked from commit 6173222bcb6c90e16f84ce8e75505826aef87160)
Fix promise state tracking and compliance stats.
(cherry picked from commit 4445945560aca14b118369ad15f5058c418349aa)
Acceptance test for pull #734. re use_module lists parsing.
(cherry picked from commit d1e4be2a763f6932b3544492c6b9b10ee4e68a51)
Added forgotten nanosleep() declaration

Replacement function already existed in libcompat.
(cherry picked from commit 564924e3ccaf0c90693ca2c23c9fe1d77ef12ba4)
Pre-release version bump
Post-release version bump
Don't display help if avahi is not installed on the machine.
(cherry picked from commit 87021110c4d9542f7b448e18c4c91b046db9563b)
policy distribution host is not in vocabulary