Skip to content

SharedDirWatcher: include Incoming + category dirs in watch set - #743

Merged
mrjimenez merged 1 commit into
amule-project:masterfrom
got3nks:pr-watcher-include-incoming
May 27, 2026
Merged

SharedDirWatcher: include Incoming + category dirs in watch set#743
mrjimenez merged 1 commit into
amule-project:masterfrom
got3nks:pr-watcher-include-incoming

Conversation

@got3nks

@got3nks got3nks commented May 27, 2026

Copy link
Copy Markdown
Contributor

Fixes #741.

CSharedDirWatcher::RegisterAllPaths() previously subscribed only the explicit shareddir_list to the wxFileSystemWatcher backend. But CSharedFileList::Reload() (around SharedFileList.cpp:370) aggregates three sources as effectively shared:

  1. thePrefs::GetIncomingDir() — the global Incoming dir.
  2. theApp->glob_prefs->GetCatPath(i) for each download category — per-category Incoming dirs.
  3. theApp->glob_prefs->shareddir_list — the explicit user-configured shares.

So the auto-rescan introduced in #591 was missing (1) and (2):

  • A file dropped into ~/.aMule/Incoming did not trigger the watcher — the file only appeared in Shared the next time some unrelated CREATE fired elsewhere in the watched tree and incidentally rescanned.
  • Same story for any category-specific incoming dir.

Completed downloads aren't affected, because CPartFile signals the scanner directly when a file transitions into Incoming. The bug only bites manual / external drops, which is exactly the case #741's reproducer walks through.

Reproducer (from @danim7's report)

# Pre-fix:
echo 123 > ~/.aMule/Incoming/file_in_Incoming
# wait — file NEVER auto-shares.
echo 654 > ~/.aMule/extra/file_in_extra      # 'extra' is in shareddir_list
# within seconds BOTH files appear in Shared.

Fix

Build the effective watch list by mirroring Reload()'s three sources (Incoming + cat paths + shareddir_list), deduplicating by GetRaw() so a user who happened to also list Incoming as an explicit shared dir doesn't get a duplicate watch registration. The dedup matters on Linux/BSD/Windows (per-dir Add()) and on macOS (FSEvents rejects overlapping AddTree streams; an explicit ancestor + Incoming-as-descendant still gets pruned by the existing covered_by_ancestor logic further down).

Test plan

Built the patched AppImage on Ubuntu ARM (amule-dev-vm via packaging/linux/build.sh appimage), drove a clean amuled instance over EC, dropped a file in IncomingDir, polled amulecmd show shared. A/B:

Build After file dropped in IncomingDir, 10s wait Result
Pre-fix (6ac974287, master tip) show shared empty Bug reproduced
Post-fix (86cd0d8f4, this branch) show shared reports the new file with its MD4 hash Fix verified
  • Repro reproduces on master tip.
  • Fix lifts the bug on this branch.
  • @danim7 to re-verify on his Linux setup.
  • CI green on Linux + Windows.

…e-project#741)

CSharedDirWatcher::RegisterAllPaths() previously subscribed only the
explicit shareddir_list to the wxFileSystemWatcher backend. But
CSharedFileList::Reload() treats three sources as shared (around
SharedFileList.cpp:370):

  1) the global Incoming dir   (thePrefs::GetIncomingDir())
  2) each category's Incoming  (theApp->glob_prefs->GetCatPath(i),
                                i = 1 .. GetCatCount()-1)
  3) the explicit shareddir_list

So the auto-rescan introduced in amule-project#591 was missing (1) and (2):

* A file dropped into ~/.aMule/Incoming did not trigger the watcher
  -> the file never appeared in Shared until some unrelated CREATE
  fired elsewhere in the watched tree and incidentally rescanned.
* Same story for any category-specific incoming dir.

Reproducer from amule-project#741:

  echo 123456 > ~/.aMule/Incoming/file_in_Incoming
  # wait — never auto-shared
  echo 654321 > ~/.aMule/extra/file_in_extra   # (extra is shared)
  # both files appear in Shared within seconds

Completed downloads aren't affected: CPartFile signals the scanner
directly when a file transitions to Incoming, so end-of-transfer
sharing keeps working. The bug only bites manual / external drops
into Incoming, which is exactly the case amule-project#741 walks through.

Fix: build the effective watch list by mirroring Reload()'s three
sources (Incoming + cat paths + shareddir_list), deduplicating
by GetRaw() so a user who happened to also list Incoming as an
explicit shared dir doesn't get a duplicate watch registration.
The dedup matters on Linux/BSD/Windows (per-dir Add()) and on
macOS (FSEvents rejects overlapping AddTree streams; an explicit
ancestor + Incoming-as-descendant still gets pruned by the existing
covered_by_ancestor logic further down).

Reported by @danim7 (amule-project#741).
@mrjimenez
mrjimenez merged commit d7f9088 into amule-project:master May 27, 2026
7 checks passed
@got3nks
got3nks deleted the pr-watcher-include-incoming branch May 27, 2026 15:15
mrjimenez pushed a commit to mrjimenez/amule that referenced this pull request Aug 1, 2026
…oject#743)

CMuleNotebook::OnRMButton passed event.GetPosition() to PopupMenu() for
the built-in Close/Close-tab menu. On wxGTK the right-click lands on the
tab strip, which sits outside the client area PopupMenu() positions
against, so the coordinate was offset by the tab-strip height and the
menu opened above the tab instead of at the cursor. Drop the explicit
position so it opens at the pointer.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Testing #591: auto-rescan is only triggered in folders from shared tree, not in Incoming folder

2 participants