Skip to content

Make sure linked preferences remain in-sync after external file change - #2914

Open
ptziegler wants to merge 1 commit into
eclipse-platform:masterfrom
ptziegler:linked-preference-scope
Open

Make sure linked preferences remain in-sync after external file change#2914
ptziegler wants to merge 1 commit into
eclipse-platform:masterfrom
ptziegler:linked-preference-scope

Conversation

@ptziegler

Copy link
Copy Markdown
Contributor

When a preference file is changed by an external process (e.g. a Git update), it may happen that the preference node for projects that link to this file are not updated properly. Those projects will then continue working with outdated preferences, until either the application is restarted or the preference file is manually updated.

@iloveeclipse
iloveeclipse requested a balanced review from Copilot September 8, 2026 20:51
@ptziegler

Copy link
Copy Markdown
Contributor Author

Here's a short video demonstrating the problem. When restoring the original preferences by clicking on "Replace with HEAD revision", I would expect the project scope of the project with those linked preferences to also update. This doesn't happen and instead it's stuck with the outdated scope.

Screencast_20260908_224550.webm

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

Reverse alias refresh remains incomplete, and the external-change test may be flaky due to timestamp granularity.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Pull request overview

Updates project preference synchronization when linked preference files change externally.

Changes:

  • Refreshes metadata for changed linked files.
  • Adds linked-project preference synchronization tests.
File summaries
File Description
RefreshLocalVisitor.java Reloads metadata for changed linked files.
ProjectPreferencesTest.java Tests linked preference synchronization paths.
Review details
  • Files reviewed: 2/2 changed files
  • Comments generated: 2
  • Review effort level: Balanced

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

The new test must create project2’s .settings parent folder before creating the link.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Review details
  • Files reviewed: 2/2 changed files
  • Comments generated: 1
  • Review effort level: Balanced


IFile prefFile1 = getFileInWorkspace(project1, nodeName);
IFile prefFile2 = getFileInWorkspace(project2, nodeName);
prefFile2.createLink(prefFile1.getLocationURI(), IResource.ALLOW_MISSING_LOCAL, createTestMonitor());

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That is not true. When project2 is created, the Platform automatically creates the .settings/org.eclipse.core.resources.prefs file. So the settings folder will always exist, which is also the reason why no error is thrown when executing the test without this change.

@github-actions

github-actions Bot commented Sep 8, 2026

Copy link
Copy Markdown
Contributor

Test Results

    45 files   -   9      45 suites   - 9   55m 37s ⏱️ - 3m 32s
 4 550 tests  - 217   4 527 ✅  - 218   22 💤 ±0  1 ❌ +1 
11 541 runs   - 651  11 385 ✅  - 654  153 💤 ±0  3 ❌ +3 

For more details on these failures, see this check.

Results for commit 67e12fd. ± Comparison against base commit e9ab4bb.

This pull request removes 220 and adds 3 tests. Note that renamed tests count towards both.
org.eclipse.compare.tests.AsyncExecTests ‑ testCancelOnRequeue
org.eclipse.compare.tests.AsyncExecTests ‑ testQueueAdd
org.eclipse.compare.tests.AsyncExecTests ‑ testWorker
org.eclipse.compare.tests.CompareFileRevisionEditorInputTest ‑ testPrepareCompareInputWithNonLocalResourceTypedElements
org.eclipse.compare.tests.CompareOpenEfficiencyTest ‑ testBinaryContentsAreNotReadAhead
org.eclipse.compare.tests.CompareOpenEfficiencyTest ‑ testGetContentsCallCountPerSide
org.eclipse.compare.tests.CompareOpenEfficiencyTest ‑ testPrepareInputOffUiThreadUnifiedOff
org.eclipse.compare.tests.CompareOpenEfficiencyTest ‑ testPrepareInputOffUiThreadUnifiedOn
org.eclipse.compare.tests.CompareOpenEfficiencyTest ‑ testPrepareInputRunsOnceUnifiedOff
org.eclipse.compare.tests.CompareOpenEfficiencyTest ‑ testPrepareInputRunsOnceUnifiedOn
…
org.eclipse.core.tests.internal.resources.ProjectPreferencesTest ‑ testLinkedProjectPreferences
org.eclipse.core.tests.internal.resources.ProjectPreferencesTest ‑ testLinkedProjectPreferencesFolder
org.eclipse.core.tests.internal.resources.ProjectPreferencesTest ‑ testSymLinkedProjectPreferences

♻️ This comment has been updated with latest results.

@ptziegler
ptziegler force-pushed the linked-preference-scope branch from ff9ec1e to a34a529 Compare September 9, 2026 04:42
@merks

merks commented Sep 9, 2026

Copy link
Copy Markdown
Contributor

I wonder about the general handling of the tree under a linked folder. E.g., if one linked the .settings folder, would that have similar/different problems with respect the the IDE seeing the preference changes?

@ptziegler

Copy link
Copy Markdown
Contributor Author

E.g., if one linked the .settings folder, would that have similar/different problems with respect the the IDE seeing the preference changes?

AFAIK, you can only link files, not folders. You even get a funny error message when trying to do so,

image

When trying to use the "New" wizard, you get a similar error:

image

@iloveeclipse

Copy link
Copy Markdown
Member

AFAIK, you can only link files, not folders.

Of course links are not restricted to files, just try to use "new folder" wizard :-)

@iloveeclipse

Copy link
Copy Markdown
Member

if one linked the .settings folder, would that have similar/different problems with respect the the IDE seeing the preference changes?

One can check, with real FS links it works for sure, probably also should work with "virtual", we link .settings since years on Linux.

@merks

merks commented Sep 9, 2026

Copy link
Copy Markdown
Contributor

It seems to offer it, which is why I asked...

image

@ptziegler

ptziegler commented Sep 9, 2026

Copy link
Copy Markdown
Contributor Author

Of course links are not restricted to files, just try to use "new folder" wizard :-)

Good point, I missed that it's a different wizard.

After a quick test I can tell that when the folder is linked and the preference file is changed, the test is still successful, regardless of whether the refresh is done on the file or the folder (and also fails without the change). Which I don't think is really surprising, because when a folder is linked, the containing files are obviously also linked. The only relevant part is that a resource-changed event is fired for the file.

Though I'll try to write a dedicated test for that once I'm back at my PC.

One can check, with real FS links it works for sure, probably also should work with "virtual", we link .settings since years on Linux.

I don't have any way of testing that.

@ptziegler
ptziegler force-pushed the linked-preference-scope branch from a34a529 to 14bcc05 Compare September 9, 2026 16:59
@ptziegler

Copy link
Copy Markdown
Contributor Author

I've added an additional test case to also check the correctness when linking folders. Regarding virtual file systems: As said before, I don't have any means of testing this. But conceptually, the only requirement is that resource-change events are fired correctly.

@iloveeclipse

Copy link
Copy Markdown
Member

Regarding virtual file systems

I probably was not clear enough in my previous comment. Links you were fixing/testing here are "Eclipse-only", thus "virtual", compared with real file system links.

@ptziegler
ptziegler force-pushed the linked-preference-scope branch from 14bcc05 to 965873b Compare September 9, 2026 19:24
@ptziegler

Copy link
Copy Markdown
Contributor Author

I probably was not clear enough in my previous comment. Links you were fixing/testing here are "Eclipse-only", thus "virtual", compared with real file system links.

Ah, you meant physical and symbolic links. Yes, those won't work (yet) because they aren't tracked by the alias-manager. I've added a new test case which covers this configuration as well, but which will fail.

When a preference file is changed by an external process (e.g. a Git
update), it may happen that the preference node for projects that link
to this file are not updated properly. Those projects will then continue
working with outdated preferences, until either the application is
restarted or the preference file is manually updated.
@ptziegler
ptziegler force-pushed the linked-preference-scope branch from 965873b to 67e12fd Compare September 9, 2026 19:26
@ptziegler

Copy link
Copy Markdown
Contributor Author

those won't work (yet) because they aren't tracked by the alias-manager

Bug 198291 - AliasManager should track symlinks

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.

4 participants