davsclaus opened a new pull request, #29427: URL: https://github.com/apache/camel/pull/29427
JIRA: [CAMEL-26749](https://issues.apache.org/jira/browse/CAMEL-26749) Two bugs in the installation check of `camel doctor`, for a Camel CLI installed with the web installer (`install.sh`). Both are in 4.23.0. - **Every upgrade reports a conflict.** The web installer keeps the previous version directories after an upgrade, and `camel doctor` counted each of them as an installation. After upgrading 4.22.2 to 4.23.0 it reports "Found 2 Camel CLI installations", prints the "more than one Camel CLI installation" warning, and exits with 1. - **No installation is marked active.** The active installation is the first `camel` on `PATH`, which for the web installer is the symlink `~/.local/bin/camel`. It was compared with the version directories without following the link, so nothing got `<- active`. Reproduced with the released 4.23.0, in a sandbox with a `4.22.2` and a `4.23.0` version directory: ``` Installs: Found 2 Camel CLI installations .../camel-cli/versions/4.23.0 (WEB_INSTALLER) .../camel-cli/versions/4.22.2 (WEB_INSTALLER) Warning: more than one Camel CLI installation was found. ... ``` ## Changes - `Doctor`: the version directories of the web installer count as one installation: `Found 1 Camel CLI installation (2 versions of the web installer)`. A conflict is still reported when there is another installation next to it, such as Homebrew. - `InstallDetector.resolveActiveOnPath`: follows the symlinks of the `camel` found on `PATH` (a chain of them, at most 16, so a link cycle ends). Only the links of the file itself are followed, not those of its parent directories: `toRealPath()` would also turn macOS `/var` into `/private/var`, while the scanned locations are not resolved either. The existing tests passed the real `camel.sh` path as the active one, which hid the second bug. The new tests use a relative symlink, as the web installer writes, a chain of two links, and a link cycle. Following the link only reads it (`readSymbolicLink`). It is used to mark the active installation in the output, and does not open or run anything. ## Tests `DoctorTest` (22) and `InstallDetectorTest` (18) pass locally. _Claude Code on behalf of Claus Ibsen_ 🤖 Generated with [Claude Code](https://claude.com/claude-code) -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
