On Sunday, 24. March 2013 16:25:20 Christoph Cullmann wrote: > > On Thursday 21 March 2013 19:02:13 David Faure wrote: > > > I'm afraid it's one or the other: > > > * safe code, always a working file available, but hardlinks get > > > splitted up > > > * possibility to corrupt the existing file, but a backup exists; > > > hardlinks > > > are kept. > > > > OK, bug number 2, saving into a non-writable directory, also leads to > > the > > above issue: no way to use the "safe code". > > > > So I implemented direct-overwrite for the case of a non-writable > > directory. > > https://codereview.qt-project.org/52059 > > If this is approved, then the same solution could be used to preserve > > hardlinks.... and to preserve the owner if different from the current > > user, for > > bug number 3. > > > > In bug number 2 there was a suggestion of "finding another writable > > directory > > in the same partition and moving the file from there", but it seems > > rather > > difficult to find such a directory in general, and it wouldn't help > > with bugs 1 > > and 3 anyway. > > Hi, > > sounds reasonable solutions for the current problems! > Searching for some directory that is writable is anyway problematic, > guess users will have to live with "less safe" saving in such settings.
It sounds very reasonable to me, too. If this patch is rejected, one could maybe add a QSaveFile::setAllowUnsafeWrite(bool) as a fallback or similar. Thanks David for submitting this patch! Very much appreciated. Dominik
