• [^] # Re: Race conditions

    Posté par . En réponse à la dépêche Exploiter inotify, c’est simple. Évalué à 1.

    Ce qui est bizarre avec inotify, c'est que le l'ajout de répertoire fonctionne parfaitement, mais dès que vous en déplacez un hors du scope (répertoires surveillés) de inotify, et que plus tard vous le re-déplacez dans le scope, il se passe des choses bizarres:

    • L'ancien watch nommé nodurépertoire devient nodurépertoire-unknown-path
    • Un nouveau watch est automatiquement créé. Bref il faut retirer les watch à la main.

    ex:
    répertoire surveillé: /tmp/inotify/

    # mkdir /tmp/inotify/aze
    Event IN_CREATE|IN_ISDIR on /tmp/inotify/aze
    Event IN_OPEN|IN_ISDIR on /tmp/inotify/aze
    Event IN_OPEN|IN_ISDIR on /tmp/inotify/aze
    Event IN_CLOSE_NOWRITE|IN_ISDIR on /tmp/inotify/aze
    Event IN_CLOSE_NOWRITE|IN_ISDIR on /tmp/inotify/aze
    # touch /tmp/inotify/aze/k
    Event IN_CREATE on /tmp/inotify/aze/k
    Event IN_OPEN on /tmp/inotify/aze/k
    Event IN_ATTRIB on /tmp/inotify/aze/k
    Event IN_CLOSE_WRITE on /tmp/inotify/aze/k
    # mv /tmp/inotify/aze /tmp/
    Event IN_MOVED_FROM|IN_ISDIR on /tmp/inotify/aze
    [2014年11月25日 08:59:08,714 pyinotify ERROR] The pathname '/tmp/inotify/aze' of this watch <Watch wd=3 path=/tmp/inotify/aze mask=4095 proc_fun=None auto_add=True exclude_filter=<function <lambda> at 0x9dfd454> dir=True > has probably changed and couldn't be updated, so it cannot be trusted anymore. To fix this error move directories/files only between watched parents directories, in this case e.g. put a watch on '/tmp/inotify'.
    Event IN_MOVE_SELF on /tmp/inotify/aze-unknown-path
    # mv /tmp/aze /tmp/inotify/
    Event IN_MOVED_TO|IN_ISDIR on /tmp/inotify/aze
    [2014年11月25日 09:00:15,900 pyinotify ERROR] The pathname '/tmp/inotify/aze' of this watch <Watch wd=3 path=/tmp/inotify/aze mask=4095 proc_fun=None auto_add=True exclude_filter=<function <lambda> at 0x9dfd454> dir=True > has probably changed and couldn't be updated, so it cannot be trusted anymore. To fix this error move directories/files only between watched parents directories, in this case e.g. put a watch on '/tmp/inotify'.
    Event IN_MOVE_SELF on /tmp/inotify/aze-unknown-path
    Event IN_OPEN|IN_ISDIR on /tmp/inotify/aze
    Event IN_OPEN|IN_ISDIR on /tmp/inotify/aze-unknown-path
    Event IN_CLOSE_NOWRITE|IN_ISDIR on /tmp/inotify/aze
    Event IN_CLOSE_NOWRITE|IN_ISDIR on /tmp/inotify/aze-unknown-path