Fix for 1804

At creation time we were always assigning 0600 as mode to the new file.
This fix stats the source file first and assigns the same mode as the
original file.
Acceptance tests are updated too.
(cherry picked from commit 426a922790fb94b65239b0a32d21918aa804ec35)
ChangeLog update