fix(setup): verify published configuration content during uninstall

Require publication readback in the owning check so in-place edits are detected and preserved with the original backup.
This commit is contained in:
morluto committed 2026-10-27 06:43:53 +08:00
1 parent 82fd223638
commit 030fa886f9
4 files changed
+43 -9

No files matched your search

@@ -169,12 +169,12 @@ export class ClientConfigurationPublication {
return outcome.value;
}
async assertCurrent(readback?: string): Promise<void> {
async assertCurrent(readback: string): Promise<void> {
const owned = await this.owner.handle.stat();
const named = await lstat(this.path);
if (
owned.ino === 0 ||
(readback !== undefined && readback !== this.contents) ||
readback !== this.contents ||
named.isSymbolicLink() ||
!sameRegularFileState(owned, named)
)
+3 -5
View File
@@ -963,11 +963,9 @@ const removeClient = async (
try {
return await publication.verify(async () => {
try {
const readback = parseClientConfiguration(
await fileSystem.readText(publication.path),
client.format,
);
await publication.assertCurrent();
const text = await fileSystem.readText(publication.path);
await publication.assertCurrent(text);
const readback = parseClientConfiguration(text, client.format);
if (
(removeNative && Object.hasOwn(readback.servers, name)) ||
(readback.dialect === "dsh" &&