6.0.3 - "Cannot Save Document" error

Under 6.03, when I try to save some specific script bundles with code signing turned on, I get the error message:

Cannot Save Document
File is busy (delete) (fBsyErr:-47)

This occurs only with script bundles that contain Wineskin Winery bundles that run Windows apps under Wine. I think the problem may occur because you’re now running xattr to remove detritus, and xattr (when run in a terminal on the same bundle) reports errors trying to remove attributes from symbolic links included in the bundle. But this is only a guess.

I have an Applescript that codesigns an app by first running sudo xattr and then running codesign. When I use that Applescript to codesign an app that causes this problem in SD, the Applescript reports errors from xattr, but then codesigns successfully.

Probably my guess about the problem isn’t right, but maybe it will help point to the correct answer.

Edit: An example of this kind of bundle is here:

https://dl.dropboxusercontent.com/u/271144/vDosMac.zip

The problem appears to be the vDos.app application bundled within your script. When I save here I see these errors coming back from the xattr command:

xattr: [Errno 13] Permission denied: '/private/var/folders/p7/_ndfx7w50jx9gh3py63f3t0r0000gn/T/TemporaryItems/(A Document Being Saved By Script Debugger)/vDosMac.app/Contents/Resources/Files/vdosmacfolder.scpt'
xattr: No such file: /private/var/folders/p7/_ndfx7w50jx9gh3py63f3t0r0000gn/T/TemporaryItems/(A Document Being Saved By Script Debugger)/vDosMac.app/Contents/Resources/vDos.app/Contents/Frameworks/libXplugin.1.0.dylib
xattr: No such file: /private/var/folders/p7/_ndfx7w50jx9gh3py63f3t0r0000gn/T/TemporaryItems/(A Document Being Saved By Script Debugger)/vDosMac.app/Contents/Resources/vDos.app/Contents/Frameworks/libXplugin.1.dylib
xattr: No such file: /private/var/folders/p7/_ndfx7w50jx9gh3py63f3t0r0000gn/T/TemporaryItems/(A Document Being Saved By Script Debugger)/vDosMac.app/Contents/Resources/vDos.app/Contents/Frameworks/libXplugin.dylib
xattr: No such file: /private/var/folders/p7/_ndfx7w50jx9gh3py63f3t0r0000gn/T/TemporaryItems/(A Document Being Saved By Script Debugger)/vDosMac.app/Contents/Resources/vDos.app/Contents/Resources/dosdevices/d:
xattr: No such file: /private/var/folders/p7/_ndfx7w50jx9gh3py63f3t0r0000gn/T/TemporaryItems/(A Document Being Saved By Script Debugger)/vDosMac.app/Contents/Resources/vDos.app/Contents/Resources/dosdevices/e::
xattr: No such file: /private/var/folders/p7/_ndfx7w50jx9gh3py63f3t0r0000gn/T/TemporaryItems/(A Document Being Saved By Script Debugger)/vDosMac.app/Contents/Resources/vDos.app/Contents/Resources/dosdevices/v:
xattr: No such file: /private/var/folders/p7/_ndfx7w50jx9gh3py63f3t0r0000gn/T/TemporaryItems/(A Document Being Saved By Script Debugger)/vDosMac.app/Contents/Resources/vDos.app/Contents/Resources/dosdevices/x:

There are two Script Debugger failures I can see:

  1. Reporting file busy is incorrect
  2. Our code signing logic should deal with the possibility that files within the script’s bundle have been made read-only

But the file not found errors suggest that there are problems with the applet. Perhaps symbolic or hard links have been broken.

That’s exactly what I found when I ran the xattr command.

The not-found files in the dosdevices folder are links created on the fly when the app starts up, so it’s probably all right that the file isn’t found when run from this temporary directory (and the one with two colons in the name should have been deleted; I cleaned up my code).

The three dylib links are probably leftover from older versions of Wineskin. I haven’t tried to remove them, because the app works correctly, but I’ll try it now.

As I said, I can codesign this with the built-in xattr and codesign commands, despite the error messages.

Thanks for looking into this!