Skip to content

Uninstall names the files it couldn't delete instead of saying they're gone - #620

Open
isaaclins wants to merge 4 commits into
mainfrom
t3/fix-freesnitch-issue-272
Open

isaaclins wants to merge 4 commits into
mainfrom
t3/fix-freesnitch-issue-272

Conversation

@isaaclins

@isaaclins isaaclins commented Nov 26, 2026 •

Copy link
Copy Markdown
Owner

Fixes #272

How it looks

The uninstall ending when one of your FreeSnitch folders can't be deleted (demo mode, FREESNITCH_DEMO_UNINSTALL=files and =both).

Dark Light
Before: says it's uninstalled even though a folder is still there
After: a folder is left
After: the helper and a folder are left

What was wrong

removeUserData deleted the three folders and files in your home folder with try? and threw every error away. The uninstall then carried on as if they were gone. It quit silently or said "FreeSnitch is uninstalled" (or "Everything else is removed") while, for example, the group container was still on disk.

(The root side had the same ; gap. #271 has since fixed that for every privileged step, so this PR leaves that script as #271 left it.)

What changes

  • The uninstall now checks after the attempt that each of the three user paths is really gone, instead of trusting that no error came back. A folder that lost everything except one locked file still counts as there. A symlink counts as itself, never as its target.
  • Anything still on disk is named on the last screen, one path per line, with a Show in Finder button that selects it. The text says that everything not listed is removed. It does the same when the helper is also left (Uninstall says the helper is unregistered even when that step failed #215), and on the "couldn't move itself to the Trash" screen.
  • The step row "Removing the helper and firewall rules" shows a warning instead of a check mark when files were left.
  • Each leftover is written to the log.
  • The new sentences are translated into Russian like the rest of the uninstall screens. The two sentences they replace are gone from the catalog.
  • The preferences domain is dropped before the files are deleted (it was dropped after), so the plist isn't checked and then written back.

For users: nothing changes when the uninstall works. When it can't delete something, you now see what is left and where, instead of being told it's all gone.

How I checked

  • Scripts/test_uninstall_ending.sh replays the issue's steps on real files in a scratch folder. It creates a folder holding an immutable file (uchg), runs the shipping cleanup and checks that exactly that folder is reported while the deleted and never-created paths aren't. It then checks that unlocking makes a second attempt clean, and that a symlink is removed without touching its target. It also checks every ending, with files left, the helper left, and both.
  • Scripts/audit_firewall_safety.sh, Scripts/test_demo_mode_isolation.sh (mutation updated for the new signature, the demo guard is still enforced) and Scripts/test_command_line_tool.sh pass.
  • xcodebuild … CODE_SIGNING_ALLOWED=NO build is clean.
  • The screens above came from the demo build. The demo never deletes anything.

Not checked on a real Mac

I haven't run a real uninstall with an undeletable file on a signed build. To try it: before uninstalling, run chflags uchg ~/Library/Application\ Support/FreeSnitch/somefile (create the file if needed), then uninstall. The last screen should name ~/Library/Application Support/FreeSnitch. Afterwards run chflags nouchg on the file and delete the folder.
On macOS 15 and later, deleting a group container can also be refused by App Data protection. That is the case this is most likely to catch in practice.

@isaaclins

Copy link
Copy Markdown
Owner Author

Local checks on 89ad459:

uninstall ending: PASS: helper kept, extension gone: the ending says the helper is left, instead of quitting silently
uninstall ending: PASS: helper kept, extension waits for a restart: the ending says the helper is left, not 'uninstalled'
uninstall ending: PASS: helper removed, extension waits for a restart: 'uninstalled, finishes at restart'
uninstall ending: PASS: everything removed: the app quits
uninstall ending: PASS: a file left, extension gone: the ending names it, instead of quitting silently
uninstall ending: PASS: a file left, extension waits for a restart: the ending names it, not 'uninstalled'
uninstall ending: PASS: helper and a file left: the ending names both
uninstall ending: PASS: a folder holding a locked file is reported as still there; deleted and never-created paths are not (got ["locked"])
uninstall ending: PASS: the report matches the disk
uninstall ending: PASS: the unlocked folder is deleted and nothing is reported
uninstall ending: PASS: a symbolic link is removed and reported gone; what it points at is left alone
uninstall ending: PASS: unregister failed and macOS still lists the helper: it is reported as left behind
uninstall ending: PASS: unregister failed but macOS no longer lists the helper: nothing is reported as left
uninstall ending: PASS: unregister succeeded: nothing is reported as left
uninstall safety verification: PASS
demo mode isolation: PASS
command line tool verification: PASS
localization formats: PASS (en, ru, 2388 formatted strings)
Firewall safety audit passed
** BUILD SUCCEEDED **

@isaaclins
isaaclins force-pushed the t3/fix-freesnitch-issue-272 branch 2 times, most recently from 256aed5 to b6566c8 Compare November 26, 2026 15:45
@isaaclins
isaaclins force-pushed the t3/fix-freesnitch-issue-272 branch from b6566c8 to c043913 Compare November 26, 2026 17:33

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Uninstall can say user data is gone after a deletion failed

1 participant