| 9544 | #endif |
| 9545 | |
| 9546 | static bool cli_binary_is_externally_managed(const char *self_path, bool self_path_exact, |
| 9547 | const char *bin_dir) { |
| 9548 | (void)bin_dir; |
| 9549 | if (!self_path_exact || !self_path || !self_path[0]) { |
| 9550 | return false; |
| 9551 | } |
| 9552 | /* POSITIVE evidence only: the path must look like a known package manager's. |
| 9553 | * |
| 9554 | * The tempting rule — "anything outside the directory we install into" — |
| 9555 | * is wrong, and the test suite proved it immediately: a test binary runs |
| 9556 | * from build/, and a perfectly ordinary `install --dir=/opt/cbm` also lives |
| 9557 | * outside the default. Both would be misread as foreign, and `update` would |
| 9558 | * refuse to update an installation we own. |
| 9559 | * |
| 9560 | * The asymmetry decides it. A false positive REFUSES a legitimate update; a |
| 9561 | * false negative just leaves today's behaviour in place for an unrecognised |
| 9562 | * manager, which --skip-binary covers explicitly. So we only infer when we |
| 9563 | * can name the owner. */ |
| 9564 | return cli_external_manager_name(self_path) != NULL; |
| 9565 | } |
| 9566 | |
| 9567 | /* Build the agent.install.plan.v1 receipt (#388): a machine-readable list of |
| 9568 | * the config / instruction / skill / agent / hook files `install` WOULD write, produced by |
no test coverage detected