Code signing in Script Debugger fails every now and then

I assume other users of Script Debugger is familiar with the “Cannot sign Document” error message in Script Debugger (attached below). It appears on saving in some cases where the bundle have unsaved changes that does not affect the code itself – for example if something have been changed in the Bundle & Export settings (like version number) or, sometimes, when a space is added on the and of a code line.

This can easily be worked around by trying other changes that changes the text without changing the code until the error message won’t appear. However, since the document/bundle gets saved even when code signing fails, the result can be that a bundle is saved, closed and deployed without being code signed by mistake.

In my case the apps I write in Applescript is distributed inhouse only. Therefore they don’t have to notarize them, and therefore the automatic code signing with Script Debugger is very convenient. However, the described problem leaves room for apps being deployed without being properly code signed. That in turn has the effect that a bunch of integrity check dialogs comes up every time the app is run, and PPPC profiles have no effect.

So my question to the developers is if something can be to improve this behavior, @ShaneStanley @alldritt

As far as I’m aware, this is the first time it’s been reported.

That error is usually the result of metadata being changed by the system. Are you saving files on remote volumes? Do you have the bundle contents displayed in the Finder? Is there any correlation with how long the file is open?

I’m just trying to see what might prompt the behaviour.

Alright, then I made a wrong assumption for no good reason. And then a plausible explanation is that currently I store my code on my iCloud Drive.
I have experienced the code signing errosr for a long time now – but it did’t hit me that it might have started when I moved them to my iCloud Drive (which is in other ways is very convenient for backup, movability etc.).
So a very likely a solution for me is just to move them out of iCloud Drive.
Thank’s for the input.

Please let us know if it solves the problem.

Yes, moving the scripts out of iCloud Drive solves the issue.
I guess other cloud drive solutions could result in similar (or other) problems – so I’ll avoid them completely from now. For example, storing my scripts on Dropbox resulted in other problems (and maybe this problem too) when I tried it earlier). Using iCloud drive worked fine in other aspects as log as I didn’t switch between computers, opening the same scripts on both.

Thanks for the follow-up. The problems with Dropbox tend to be because it treats bundles as simple folders, and therefore contents aren’t always kept closely in sync. With iCloud, extended attributes are used and sometimes modified, and that’s what looks to be causing this problem. Script Debugger removes all the attributes before signing, but in this case the system is probably just replacing them.

1 Like