| 10957 | #endif |
| 10958 | |
| 10959 | static bool cli_binary_is_externally_managed(const char *self_path, bool self_path_exact, |
| 10960 | const char *bin_dir) { |
| 10961 | (void)bin_dir; |
| 10962 | if (!self_path_exact || !self_path || !self_path[0]) { |
| 10963 | return false; |
| 10964 | } |
| 10965 | /* POSITIVE evidence only: the path must look like a known package manager's. |
| 10966 | * |
| 10967 | * The tempting rule — "anything outside the directory we install into" — |
| 10968 | * is wrong, and the test suite proved it immediately: a test binary runs |
| 10969 | * from build/, and a perfectly ordinary `install --dir=/opt/cbm` also lives |
| 10970 | * outside the default. Both would be misread as foreign, and `update` would |
| 10971 | * refuse to update an installation we own. |
| 10972 | * |
| 10973 | * The asymmetry decides it. A false positive REFUSES a legitimate update; a |
| 10974 | * false negative just leaves today's behaviour in place for an unrecognised |
| 10975 | * manager, which --skip-binary covers explicitly. So we only infer when we |
| 10976 | * can name the owner. */ |
| 10977 | return cli_external_manager_name(self_path) != NULL; |
| 10978 | } |
| 10979 | |
| 10980 | /* Build the agent.install.plan.v1 receipt (#388): a machine-readable list of |
| 10981 | * the config / instruction / skill / agent / hook files `install` WOULD write, produced by |
no test coverage detected