Skip to content

Commit 7c207c0

Browse files
committed
fix(server): avoid treating Ubuntu binaries as Homebrew-managed
- Add regression coverage for `/usr/local/bin` provider executables on Ubuntu - Restrict Homebrew path detection to `/opt/homebrew/bin`
1 parent e4f7b14 commit 7c207c0

2 files changed

Lines changed: 16 additions & 2 deletions

File tree

‎apps/server/src/provider/providerMaintenance.test.ts‎

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -332,6 +332,21 @@ it.layer(NodeServices.layer)("providerMaintenance", (it) => {
332332
});
333333
});
334334

335+
it("does not treat an Ubuntu /usr/local/bin executable as Homebrew-managed", () => {
336+
expect(
337+
packageToolUpdate.resolve({
338+
binaryPath: "/usr/local/bin/package-tool",
339+
env: {
340+
PATH: "",
341+
},
342+
}),
343+
).toEqual({
344+
provider: driver("packageTool"),
345+
packageName: "@example/package-tool",
346+
update: null,
347+
});
348+
});
349+
335350
it.effect(
336351
"switches native-package-tool to native updates when the binary resolves through the native installer",
337352
() =>

‎apps/server/src/provider/providerMaintenance.ts‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -268,8 +268,7 @@ function isHomebrewCommandPath(commandPath: string): boolean {
268268
normalized.includes("/opt/homebrew/caskroom/") ||
269269
normalized.includes("/usr/local/caskroom/") ||
270270
normalized.includes("/homebrew/caskroom/") ||
271-
normalized.startsWith("/opt/homebrew/bin/") ||
272-
normalized.startsWith("/usr/local/bin/")
271+
normalized.startsWith("/opt/homebrew/bin/")
273272
);
274273
}
275274

0 commit comments

Comments
 (0)