I thought at first this was just an AppleScript issue, but my crash today from trying to rename something on my desktop has proved that wrong, and pushed me to reaching out to try and find a cause. Now thinking this is a Finder issue, potentially relating to permissions & privacy settings.
So heres the rundown.
I have been working on an app as a project for a forensics class for the past few weeks. The main idea, developmentally speaking, was to provide an actual native .app (Swift or Cocoa) with a GUI to manage tasks people are typically doing via scripts (shell / bash, python, AppleScript, etc). The other goal, which is more just assumed, is to make things compatible and relevant to Catalina.
I ended up using AppleScriptObjC, and making a Cocoa app that relies on AppleScript to provide all the actual functionality.
Here are my Security Settings I believe are relevant.
- The app does not use gatekeeper, isn't sandboxed, uses Full Disk Access, "Full Disk Access" under Files and Folders, "System Events.app" and "Finder" under Automation.
- The user is prompted to allow access for all of these things,
- Terminal has Full Disk Access, as well as "Full Disk Access" under Files and Folders.
As I have been working on it, my computer has crashed more times than in the 4 years I have had my MBP. I have been trying to pin down the cause to something more specific than "Catalina nonsense", and the most recent crash did just that.
The behavior is always the same. I will perform some file operation, then system UI will freeze for maybe ten seconds, but you can still move the mouse, then the crash will happen.
At first, it seemed the crashes were just tied to file operations using AppleScript. Nothing really unique about the operations that would cause the issue. I remember once I was just testing a single line in Script Editor, same idea as the one below, that opened a 'choose folder' at the current users desktop, and that caused a crash. It happened with picking files as well. But there didnt seem to be anything uniquely common to the files or folders being selected before the crashes.
set outputLocation to ((POSIX path of (choose folder with prompt "Please select an output folder:")) as string)
Then I was getting some crashes when multiple (two) instances of the app were somehow running at the same time during tests, but again, I just thought that was tied to resource access with the AppleScript or something. It didnt seem to effect file operations being run in the actual compiled application.
But today, I was playing with the command "sudo sqlite3 auth.db .dump > ~/Desktop/auth.txt". Seeing the output was just a sql structure, I used the [return] key to edit the filename, and changed the extension to .sql. I got the normal confirmation prompt, and clicked 'Use ...', and after that, the system crashed.
So I am now thinking this is a finder issue, linked to permissions & privacy. But I dont really know where to start to try and pin down the cause. Any suggestions would be much appreciated, as I really dont want to have to put up with this as I continue working on the project, especially as it is open source, and I would rather not have to have a huge disclaimer about potential crashing.