SWAT-engineering / SWAT-engineering/java-watch

`IndexingRescanner` doesn't generate `DELETED` events for content items of moved/renamed directories

Open
#46 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
Java
Stars
1
Forks
0
Avg merge
14h 40m
Merged PRs (30d)
1

Description

To reproduce
// Create file tree
var parent = Files.createTempDirectory("");
var child1 = Files.createDirectories(parent.resolve("from"));
var child2 = Files.createDirectories(parent.resolve("to"));

// Create directory to be moved
var directory = Files.createDirectory(child1.resolve("directory"));
Files.createFile(directory.resolve("file1.txt"));
Files.createFile(directory.resolve("file2.txt"));

// Start a watch for the whole file tree
try (var watch = Watch
        .build(parent, WatchScope.PATH_AND_ALL_DESCENDANTS)
        .onOverflow(Approximation.DIFF)
        .on(System.out::println)
        .start()) {

    // Move directory
    var source = child1.resolve(directory.getFileName());
    var target = child2.resolve(directory.getFileName());
    Files.move(source, target);

    // Wait for events
    Thread.sleep(30000);
}

System.exit(0);
Expected output

DELETED events for file1.txt and file2.txt.

Actual output

No such events:

WatchEvent[C:\Users\sung-\AppData\Local\Temp\16629189291729839418, DELETED, from\directory]
WatchEvent[C:\Users\sung-\AppData\Local\Temp\16629189291729839418, CREATED, to\directory]
WatchEvent[C:\Users\sung-\AppData\Local\Temp\16629189291729839418, MODIFIED, to]
WatchEvent[C:\Users\sung-\AppData\Local\Temp\16629189291729839418, OVERFLOW, to\directory]
WatchEvent[C:\Users\sung-\AppData\Local\Temp\16629189291729839418, CREATED, to\directory\file1.txt]
WatchEvent[C:\Users\sung-\AppData\Local\Temp\16629189291729839418, CREATED, to\directory\file2.txt]

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the IndexingRescanner behavior exercised by the Java reproduction in the issue, focusing on directory move handling and overflow diff processing. Reproduce the move with a recursive watch, then verify that DELETED events are emitted for file1.txt and file2.txt in addition to the existing directory events.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
operating-systems
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.