Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #31636

Re: locking files on Linux

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 <andrea.crotti.0@gmail.com>
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 <k5p03u$3t8$2@reader1.panix.com>
References <mailman.2430.1350566044.27098.python-list@python.org> <k5p03u$3t8$2@reader1.panix.com>
Date Thu, 18 Oct 2012 14:44:27 +0100
Subject Re: locking files on Linux
From andrea crotti <andrea.crotti.0@gmail.com>
To python-list <python-list@python.org>
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 <python-list.python.org>
List-Unsubscribe <http://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.2431.1350567869.27098.python-list@python.org> (permalink)
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

Show key headers only | View raw


2012/10/18 Grant Edwards <invalid@invalid.invalid>:
> On 2012-10-18, andrea crotti <andrea.crotti.0@gmail.com> 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

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

locking files on Linux andrea crotti <andrea.crotti.0@gmail.com> - 2012-10-18 14:14 +0100
  Re: locking files on Linux Grant Edwards <invalid@invalid.invalid> - 2012-10-18 13:27 +0000
    Re: locking files on Linux andrea crotti <andrea.crotti.0@gmail.com> - 2012-10-18 14:44 +0100
      Re: locking files on Linux Grant Edwards <invalid@invalid.invalid> - 2012-10-18 13:57 +0000
        Re: locking files on Linux andrea crotti <andrea.crotti.0@gmail.com> - 2012-10-18 15:49 +0100
        Re: locking files on Linux Oscar Benjamin <oscar.j.benjamin@gmail.com> - 2012-10-18 16:04 +0100
        Re: locking files on Linux andrea crotti <andrea.crotti.0@gmail.com> - 2012-10-18 16:08 +0100
        Re: locking files on Linux Oscar Benjamin <oscar.j.benjamin@gmail.com> - 2012-10-18 16:31 +0100
        Re: locking files on Linux andrea crotti <andrea.crotti.0@gmail.com> - 2012-10-19 13:15 +0100
      Re: locking files on Linux Nobody <nobody@nowhere.com> - 2012-10-19 15:36 +0100
    Re: locking files on Linux Oscar Benjamin <oscar.j.benjamin@gmail.com> - 2012-10-18 14:58 +0100

csiph-web