[Users] Problem with clawsrc occasionally reverting to default
Michael Schwendt
bugreporter at abwesend.de
Thu Mar 26 15:07:43 CET 2015
On Thu, 26 Mar 2015 14:18:11 +0100, Paul Rolland (ポール・ロラン) wrote:
> > > So what is the situation that leaves you with *no* clawsrc and a
> > > clawsrc.tmp in the ~/.claws-mail folder ?
> >
> > Since I won't be able to skim over the source code until possibly end
> > of next week, here are just my thoughts:
> >
> > Preferably, it would create a _new_ clawsrc.tmp file and write
> > everything to that file, and when done, it would create a backup of
> > the existing clawrc and then rename(3) clawsrc.tmp to clawsrc.
> > If Claws Mail gets interrupted/killed prior to the final renaming
> > step, the old clawsrc file would still be present.
>
> I've just been looking very briefly at the code, and it looks like this is
> what's done...
I've just had a look. It doesn't do that.
It's vulnerable to race-conditions while being killed, because in
prefs_file_close() it
1) _renames_ clawsrc to clawsrc.bak
2) _renames_ clawsrc.tmp to clawsrc
Between 1) and 2) there is no clawsrc file anymore as two separate rename
calls are not atomic. IMO, it ought to copy in step 1.
Comments?
More information about the Users
mailing list