sed in-place write unsafe (was: Power-fail safe writes)

Cristian Ionescu-Idbohrn cristian.ionescu-idbohrn at axis.com
Wed Apr 3 10:07:11 UTC 2019


Denys,

On Tue, 2 Apr 2019, Sebastian Brand wrote:
> 
> I recently had problems when updating a configuration file using sed 
> with in-place edit option (-i), shortly followed by a power fail, 
> which has the end result of an empty configuration file and a system 
> that won't boot.
> The reason behind this is me relying on sed and sed in-place editing 
> not using a power-fail safe write pattern (copy, edit copy, 
> synchronize copy, rename, synchronize folder).

I'd be interested in your comment about this patch, which fsyncs the 
created temporary file and the directory (after rename) before it's 
done.  Any chance it can end up in upstream busybox in this form or 
another?


Cheers,

-- 
Cristian


More information about the busybox mailing list