Giter Site home page Giter Site logo

Comments (8)

timbertson avatar timbertson commented on August 16, 2024

I've done some digging, the reason no directory move is happening is that in InotifyEmitter.queue_events, inotify.read_events() returns the MOVED_FROM event the first time it is called, and the MOVED_TO event the next time it is called. Because the events don't arrive together, moved_from_events is empty (it gets reset every time the function is called) and the KeyError is raised, causing a silent failure.

Presumably read_events is expected to return both events at once. But I've got pretty consistent behaviour.

Could moved_from_events be made slightly more long-lived? Or is the cookie not a very unique key?

from watchdog.

timbertson avatar timbertson commented on August 16, 2024

This patch (https://gist.github.com/763397) seems to fix the directory move not appearing in the log (moved_from_events is persisted until a set of events is received which doesn't contain any move operations), but the path name is still being reported incorrectly.

Looks like it's coming from the _path_for_wd dictionary, which is not updated on a directory move.

from watchdog.

timbertson avatar timbertson commented on August 16, 2024

I've pushed a commit to my fork ( https://github.com/gfxmonk/watchdog/commit/167e700b9e81143c7ddff6dac04bbaba515a1ef0 ) which fixes both of these problems. It might not be the way you would prefer to fix it though (its's not exactly elegant), so feel free to disregard it ;)

from watchdog.

gorakhargosh avatar gorakhargosh commented on August 16, 2024

Can you please send a pull request?

from watchdog.

gorakhargosh avatar gorakhargosh commented on August 16, 2024

I've cherry picked the changes and they should be available in git HEAD.
Could you please check whether these changes work for you and then
close this issue if it is fixed? I've also added you to the AUTHORS list.
Thank you. =)

from watchdog.

timbertson avatar timbertson commented on August 16, 2024

Yep, cheers - all fixed. Sorry about the formatting, I have vim configured for tabs so I think the conversion was not so great ;)

from watchdog.

kudraw avatar kudraw commented on August 16, 2024

This fix is actually committed into the master branch? Because I've found a problem, this is the scenario:

watchdog listens on folder A, my program will mirror copies on folder B (and do some other processing things, like image processing).

To test the program I've created a script that does the following things:

  1. copy a folder F with images and sub-folder S in A
  2. rename F to N
  3. delete N

All this actions need to be performed also on the mirror directory B.

The first two points seems to works, at the point 3, the program begin to delete files in B/N, but when try to delete files in B/N/S it will show error because try to delete B/F/S that of course doesn't exists more.

I hope that the problem is clear, in case I just try to explain better :).

Thanks!

from watchdog.

kudraw avatar kudraw commented on August 16, 2024

PS: the test is done under Arch Linux with kernel 3.4.4, using python 2.7.

from watchdog.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.