mirror of
https://github.com/morluto/rea.git
synced 2026-11-22 06:25:44 +00:00
* fix(desktop): preserve exact dpkg ownership from partial queries * test(desktop): cover dpkg executable ownership transcripts * test(desktop): keep executable ownership regression outside describe
16 lines
581 B
TypeScript
16 lines
581 B
TypeScript
/** A partial dpkg reply with a diversion, one exact owner, and a path that decodes lossily. */
|
|
export const mixedDpkgOwnershipStdout = (
|
|
ownedPath: string,
|
|
damagedPath: string,
|
|
): Buffer => {
|
|
const marker = damagedPath.indexOf("\uFFFD");
|
|
if (marker < 0) throw new Error("Expected a replacement marker in the path");
|
|
return Buffer.concat([
|
|
Buffer.from(
|
|
`local diversion from: ${ownedPath}\nactual-owner: ${ownedPath}\nwrong-owner: ${damagedPath.slice(0, marker)}`,
|
|
),
|
|
Buffer.from([0xff]),
|
|
Buffer.from(`${damagedPath.slice(marker + 1)}\n`),
|
|
]);
|
|
};
|