Fixes #6298 and adds a sudo unit test for synchronize