Path: csiph.com!usenet.pasdenom.info!weretis.net!feeder1.news.weretis.net!feeder.erje.net!newsfeed.xs4all.nl!newsfeed5.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.007 X-Spam-Evidence: '*H*': 0.99; '*S*': 0.00; 'received:209.85.223': 0.03; '(even': 0.05; 'modify': 0.05; 'filesystem': 0.09; 'historically': 0.09; 'sqlite': 0.09; 'subject:files': 0.09; 'anyway': 0.11; 'to:name:python-list': 0.15; 'bounds': 0.16; 'readable': 0.16; 'titled': 0.16; 'too).': 0.16; 'url:documentation': 0.16; 'wrote:': 0.17; 'thanks,': 0.18; 'linux': 0.24; 'header:In-Reply-To:1': 0.25; 'url:wiki': 0.26; 'guess': 0.27; 'message-id:@mail.gmail.com': 0.27; 'locking': 0.29; 'locks': 0.29; 'url:wikipedia': 0.29; 'url:mailman': 0.29; 'probably': 0.29; "i'm": 0.29; 'maybe': 0.29; 'knows': 0.30; 'url:2012': 0.30; 'url:python': 0.32; 'file': 0.32; 'not.': 0.32; 'could': 0.32; 'url:listinfo': 0.32; 'to:addr:python-list': 0.33; 'received:google.com': 0.34; 'thanks': 0.34; 'received:209.85': 0.35; 'something': 0.35; 'but': 0.36; 'url:org': 0.36; 'level.': 0.36; "i'll": 0.36; 'should': 0.36; 'problems': 0.36; 'does': 0.37; 'rather': 0.37; 'received:209': 0.37; 'subject:: ': 0.38; 'some': 0.38; 'url:en': 0.38; 'to:addr:python.org': 0.39; 'application': 0.40; 'header:Received:5': 0.40; 'url:mail': 0.40; 'your': 0.60; 'most': 0.61; 'worth': 0.63; 'different': 0.63; 'sit': 0.65; 'afraid': 0.66; 'attention': 0.75; 'andrea': 0.84; 'edwards': 0.91 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; bh=CVf2c1uxdeD95sKiHocIgFFPS6Wo2hGfatbsgySlObQ=; b=nhvR5erwlIVF20H4Tg6IllqB35cG+juiNI1zPzFN/BmeMDCjNviNCue13Jo+co0JRb ZAzYF6V97D70IszdmG8YFRQCXFX65WQhOxLFBk4fpbBZ2mkZQb8uZyaCdIAQe5sGthGl IHRHpkE8JuX6XU7QqpoU1vxiwFAhwrs86UUEwI8mu5IKiuEuY8ZA0ydjXK1j5aB8vVfp dvtvqPy5bpNmz7WGh34vbxrvTg8fs0qeH6MLWq3iDIyXGjt8tlTwCFJ27mjpGh4cOazz VIAZHqxN7MuQYYyFc92KTYciIs0H55yy3CzkoI0UJFZlDn53NEKG/MLSx3TGDSA/Ll+w aTKQ== MIME-Version: 1.0 In-Reply-To: References: Date: Thu, 18 Oct 2012 14:44:27 +0100 Subject: Re: locking files on Linux From: andrea crotti To: python-list Content-Type: text/plain; charset=ISO-8859-1 X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 41 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1350567870 news.xs4all.nl 6915 [2001:888:2000:d::a6]:37283 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:31636 2012/10/18 Grant Edwards : > On 2012-10-18, andrea crotti wrote: > > > File locks under Unix have historically been "advisory". That means > that programs have to _choose_ to pay attention to them. Most > programs do not. > > Linux does support mandatory locking, but it's rarely used and must be > manually enabled at the filesystem level. It's probably worth noting > that in the Linux kernel docs, the document on mandatory file locking > begins with a section titled "Why you should avoid mandatory locking". > > http://en.wikipedia.org/wiki/File_locking#In_Unix-like_systems > http://kernel.org/doc/Documentation/filesystems/locks.txt > http://kernel.org/doc/Documentation/filesystems/mandatory-locking.txt > http://www.thegeekstuff.com/2012/04/linux-file-locking-types/ > http://www.hackinglinuxexposed.com/articles/20030623.html > > -- > Grant Edwards grant.b.edwards Yow! Your CHEEKS sit like > at twin NECTARINES above > gmail.com a MOUTH that knows no > BOUNDS -- > -- > http://mail.python.org/mailman/listinfo/python-list Uhh I see thanks, I guess I'll use the good-old .lock file (even if it might have some problems too). Anyway I'm only afraid that my same application could modify the files, so maybe I can instruct it to check if the file is locked. Or maybe using sqlite would work even if writing from different processes? I would prefer to keep something human readable as INI-format though, rather then a sqlite file.. Thanks