Item8398: Possible race writing .changes

Priority: Normal
Current State: Closed
Released In: 1.1.0
Target Release: minor
Applies To: Engine
Reported By: CrawfordCurrie
Waiting For: Main.OlivierRaginel
Last Change By: KennethLavrsen
I have just seen a case on a customer site where a .changes file became corrupted, AFAICT due to a simultaneous write between two processes. There is no locking on the .changes file, so I guess this is feasible.

I can't reproduce this, and have only seen it once, but reporting in case someone feels motivated to look into the possibility of a race.

-- CrawfordCurrie - 20 Jan 2010

Implemented flock (locks) on saveFile in the VCHandler, so this should fix it. It should also fix most other race conditions we might have using saveFile, and should still work as it used to.

perldoc perlport states:
       flock   Not implemented (Mac OS, VMS, RISC OS, VOS).
               Available only on Windows NT (not on Windows 95). (Win32)

So I guess that means it works everywhere now smile

Oh, I won't backport this to the release branch, I doubt it's useful.

-- OlivierRaginel - 13 Jun 2010

erm, if it doesn't work on Mac OS (by this I assume they mean OSX), it for sure doesn't work everywhere....

-- CrawfordCurrie - 14 Jun 2010

No, Mac OS is pre-OS-X, so up to OS-9. It for sure works on OS-X. It does NOT work on Mac OS (so pre-OS-X), Vax VMS, Risc OS, VOS, and windows <= 98, from what perlport says. It's supposed to work on everything else.

Also, please note that the HtPasswd user manager has always been using it for locking the password file, so it's not like we've never been using it...

-- OlivierRaginel - 14 Jun 2010

Vax VMSOpen VMS, you mean wink

And HtpasswdManager has only been using it since Lavr coded his fix, not "always" (at least I don't think so).

-- CrawfordCurrie - 14 Jun 2010

CGI::Session uses flock. That is where I got inspiration for the htpasswd protection.

On all OS'es that I can imagine will run Foswiki in practical life, we can count on flock to be present.

-- KennethLavrsen - 14 Jun 2010

I believe the flock fix is good and will work on anything that people will normally install Foswiki on. As I said CGI::Session also uses flock so forget MS Dos 3.2 and Windows 95 or old Mac OS noone uses anymore. All Macs today are on a BSD based OS now which for sure has flock.

-- KennethLavrsen - 11 Jul 2010

ItemTemplate edit

Summary Possible race writing .changes
ReportedBy CrawfordCurrie
Codebase 1.0.8
SVN Range
AppliesTo Engine
Priority Normal
CurrentState Closed
WaitingFor OlivierRaginel
Checkins distro:61ba4f225f34 distro:df39d9986c96
TargetRelease minor
ReleasedIn 1.1.0
Topic revision: r10 - 04 Oct 2010, KennethLavrsen
The copyright of the content on this website is held by the contributing authors, except where stated elsewhere. See Copyright Statement. Creative Commons License    Legal Imprint    Privacy Policy