[#1011] Truncate the file when writing into existing files.

Merge commit message.

Problem description
===================

Describe the problem that these changes wants to solve.
This content should be created when a ticket is submitted and just link
the ticket or copy paste the ticket description... or find a way for
linking this review to a ticket.


Why we got into this (5 whys)
=============================

I did not read carefully the "man 2 open" to check the usage of O_WRONLY and O_TRUNC flags from "open()"

There was no test for this usecase.


Changes description
===================

openFileForWriting was updated to add the O_TRUNC flag when getting the
file descriptor.


How to try and test the changes
===============================

    paver test compat.test_filesystem