nMustaki / debinterface

A simple Python library for dealing with the /etc/network/interfaces file in most Debian based distributions.
BSD 3-Clause "New" or "Revised" License
10 stars 16 forks source link

toolutils: Fix atomic_write #10

Closed julianscheel closed 8 years ago

julianscheel commented 8 years ago

Using shutil.copy is not atomic. The only guaranteed atomic operation is os.rename, which requires source and target to be on the same filesystem. Ensure this by resolving the real file path in case it is symlink and place the tmp file in the same directory.

Signed-off-by: Julian Scheel julian@jusst.de

nMustaki commented 8 years ago

Many thanks, I thought it was ! Looks like a bunch of tests are failling, I will look into it