← Back to team overview

ubuntu-phone team mailing list archive

Re: Can we make renames work?

 

Hi,

On 20.05.2015 17:19, Iain Lane wrote:
We sometimes come across bugs where software expects to be able to
rename files to work properly (either to atomically update, or perhaps
to disable some functionality).

I think that most of the trickiness comes from the fact that these renames are not made intentionally by the developer, but by a library. The developer might not even be aware of the fact that a library call is renaming a file.

I encountered a similar problem with libexiv2, which also does occasional renames when writing big files. For the record, I encountered this problem under OS X: my app had read/write access to an file, but not to other files in the same directory.

In other words, this problem is not Ubuntu specific: cross-platform code which is expecting renames to work is not really cross platform, and should be fixed.

IMHO, the g_file_set_contents() should be fixed; how, I'm not sure. My guess is that the rename should be attempted and, if that fails, a set of fallbacks should be implemented (the one from your branch is indeed a good one).

In implementing the fix, one should also keep in mind
https://bugs.launchpad.net/bugs/1220713

Ciao,
  Alberto



References