| 9709 | #endif |
| 9710 | |
| 9711 | static bool cli_binary_is_externally_managed(const char *self_path, bool self_path_exact, |
| 9712 | const char *bin_dir) { |
| 9713 | (void)bin_dir; |
| 9714 | if (!self_path_exact || !self_path || !self_path[0]) { |
| 9715 | return false; |
| 9716 | } |
| 9717 | /* POSITIVE evidence only: the path must look like a known package manager's. |
| 9718 | * |
| 9719 | * The tempting rule — "anything outside the directory we install into" — |
| 9720 | * is wrong, and the test suite proved it immediately: a test binary runs |
| 9721 | * from build/, and a perfectly ordinary `install --dir=/opt/cbm` also lives |
| 9722 | * outside the default. Both would be misread as foreign, and `update` would |
| 9723 | * refuse to update an installation we own. |
| 9724 | * |
| 9725 | * The asymmetry decides it. A false positive REFUSES a legitimate update; a |
| 9726 | * false negative just leaves today's behaviour in place for an unrecognised |
| 9727 | * manager, which --skip-binary covers explicitly. So we only infer when we |
| 9728 | * can name the owner. */ |
| 9729 | return cli_external_manager_name(self_path) != NULL; |
| 9730 | } |
| 9731 | |
| 9732 | /* Build the agent.install.plan.v1 receipt (#388): a machine-readable list of |
| 9733 | * the config / instruction / skill / agent / hook files `install` WOULD write, produced by |
no test coverage detected