-
Notifications
You must be signed in to change notification settings - Fork 49
#1667: fix ide env triggering unintended tool installations #1672
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
#1667: fix ide env triggering unintended tool installations #1672
Conversation
Override isInstalled() in PackageManagerBasedLocalToolCommandlet to use file existence check instead of version computation which was triggering package manager execution and causing unintended installations. - Add isInstalled() override using SystemPath.findBinary() for platform-specific binary resolution - Update JavaDoc for computeInstalledVersion() with warning about not triggering installations - Remove redundant isInstalled() override from NodeBasedCommandlet - Add test in IdeasyTest to verify running 'ide' without arguments doesn't trigger installations - Update CHANGELOG.adoc
Pull Request Test Coverage Report for Build 21099077048Details
💛 - Coveralls |
|
@maybeec thanks for your PR. Awesome that you did the analysis and fix of this issue. |
hohwille
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@maybeec thanks again for this great PR. 👍
So scanning vor env variables iterating the commandlets, we ran every package manager based commandlet triggering an installation that checked for updates and installed them if available.
I now understand why I only saw the download and extract progress bar but no info what tool this is about:
When we run ide env we disable our regular logging and suppress all messages except the environment variables. However, the progress-bar component we are using is not using our logging infrastructure and directly writes to the console bypassing this (see #627).
So this was actually the tool uv (for python/pip) that ships updates very frequently.
I left a small suggestion for improvement. Apart from that we can merge this and finally fix the bug.
cli/src/main/java/com/devonfw/tools/ide/tool/PackageManagerBasedLocalToolCommandlet.java
Outdated
Show resolved
Hide resolved
cli/src/main/java/com/devonfw/tools/ide/tool/PackageManagerBasedLocalToolCommandlet.java
Show resolved
Hide resolved
…edLocalToolCommandlet.java
Summary
Fixes #1667 - Running
idewithout arguments was triggering unexpected downloads and installations.Root Cause
The issue occurred because
EnvironmentCommandlet.setEnvironmentVariablesInLocalTools()iterates through all local tools and callsisInstalled()on each. For package-manager-based tools (pip, npm, yarn, etc.), the inheritedisInstalled()implementation was callinggetInstalledVersion()→computeInstalledVersion()→runPackageManager()withoutskipInstallation=true, which triggered installation cascades.See detailed analysis in issue comment.
Solution
Override
isInstalled()inPackageManagerBasedLocalToolCommandletto use file existence check withSystemPath.findBinary()instead of version computation. This prevents triggering the package manager during environment setup while still correctly detecting installed tools.Changes
isInstalled()inPackageManagerBasedLocalToolCommandletusing platform-specific binary resolution@implNotewarning tocomputeInstalledVersion()JavaDocisInstalled()fromNodeBasedCommandlet(now inherited)testRunWithoutArgumentsDoesNotTriggerInstallation()inIdeasyTestTesting
idewithout arguments doesn't create new tool directoriesChecklist
#«issue-id»: «describe your change»