Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#264: prevent Windows file lock #288

Merged
merged 2 commits into from
Apr 19, 2024

Conversation

mvomiero
Copy link
Contributor

@mvomiero mvomiero commented Apr 15, 2024

Fixes: #264
Fixes: #230

After extensive research and several attempts, it's evident that the reported issue isn't a bug but rather a result of using devon instead of ideasy while installing new tools. For instance:

The problem we were getting was that the moving of the installed software directory fails because of the windows file lock on the directory, e.g. java.lang.IllegalStateException: Failed to move D:\projects\IDEasy\software\java to D:\projects\IDEasy\updates\backups\2024-03-22\java_17-13-29.

This issue specifically arises when the tools are installed using 'devon' (as a directory) instead of 'ideasy' (as a junction).
When installed with 'ideasy', the file lock automatically applies to the target path of the junction IDE_ROOT/_ide/software/default/..., allowing the deletion of the junction itself in IDE_HOME/software/. Consequently, updating a tool version becomes seamless.

The only fix it had to be implemented is for a another exception that was arising in the delete method in FileaccessImpl, that wasn't properly recognizing and deleting junctions.

-      if (Files.isSymbolicLink(path)) {
+      if (Files.isSymbolicLink(path) || isJunction(path)) {
        Files.delete(path);

@coveralls
Copy link
Collaborator

coveralls commented Apr 15, 2024

Pull Request Test Coverage Report for Build 8755991003

Details

  • 0 of 0 changed or added relevant lines in 0 files are covered.
  • 123 unchanged lines in 1 file lost coverage.
  • Overall coverage decreased (-0.004%) to 59.563%

Files with Coverage Reduction New Missed Lines %
com/devonfw/tools/ide/io/FileAccessImpl.java 123 55.48%
Totals Coverage Status
Change from base Build 8755101338: -0.004%
Covered Lines: 4558
Relevant Lines: 7357

💛 - Coveralls

Copy link
Member

@hohwille hohwille left a comment

Choose a reason for hiding this comment

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

@mvomiero thanks for this PR and the nice and simple fix to the problem. 👍
We need to test that again in the native image but I will merge so we can test it after next nightly SNAPSHOT deploy.

@hohwille hohwille merged commit 2ff8bc3 into devonfw:main Apr 19, 2024
4 checks passed
@hohwille hohwille added this to the release:2024.04.001 milestone Apr 19, 2024
@hohwille hohwille added the story-review marks PRs that will be presented in the sprint-review label May 3, 2024
@tobka777 tobka777 added reviewed Marks PRs that have been presented in the sprint-review meeting or that do not need to be presented. and removed story-review marks PRs that will be presented in the sprint-review labels May 7, 2024
@mvomiero mvomiero deleted the bug/264-preventWindowsFileLock branch May 22, 2024 07:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
reviewed Marks PRs that have been presented in the sprint-review meeting or that do not need to be presented.
Projects
Status: ✅ Done
Development

Successfully merging this pull request may close these issues.

Prevent windows file lock error when installing tool update backup() method fails to move directories
4 participants