Weird bug with TextEdit

Developer discussions.

Weird bug with TextEdit

Postby Sharko » Sun Jul 16, 2023 5:09 pm

Just thought I would mentions this. I'm running O3X 2.1.6 on Intel Monterey (under manually configured OpenCore, if it matters). My everyday user's home folder resides on an encrypted zfs dataset; I boot first to an admin user, decrypt the ZFS dataset, then log into the everyday user.

The bug: I can save a brand new TextEdit file to a directory under my home folder to, say, ~/Documents. However, when I then make changes to that file and try to save it again, it gives me a permission error: "The document XXX.rtf could not be saved. You don't have permission. To view or change permissions yada yada yada." The TextEdit program must be using some weird call when saving or overwriting an existing file. I don't have this problem with an alternate text editor (LibreOffice), even creating and/or saving to the same directory where TextEdit doesn't work. So it doesn't seem to be a true permissions problem (I've also looked at the permissions of the destination folder, and my user has read and write permission, group Staff has read permission, and everyone has read permission).

Holding down the option key I can do a "Save As" on the file that I can't do a regular Save on.
Sharko
 
Posts: 230
Joined: Thu May 12, 2016 12:19 pm

Re: Weird bug with TextEdit

Postby tangent » Tue Aug 29, 2023 9:40 pm

I've seen this in a few different guises. It's always in one of the more "native" apps; you can cd into that directory and "touch" the problem file without trouble. So much for "no permission" huh?

The fix varies, but I think the common cause is that these apps think they're running on APFS and are trying to make use of some out-there feature that doesn't exist on alternate filesystems.

One thing that sometimes works is opening the file from a shell or another non-macOS native app. This can give the target app permissions it doesn't get when opening the file from "native" apps like Finder. I've had good success opening Markdown documents I manage with Calibre this way: if open a doc from inside Calibre, it's fine, but if open the same doc from Finder or directly within my native MD editor app of choice (iA Writer), suddenly it gives this bogus permission error on saving my first set of changes. Lunacy.

Another solution is to use a less-native app. Instead of TextEdit, try VSCode or gVim or…anything that's cross-platform and built against portable APIs, not against the macOS specific frameworks.

That's easy to suggest in the case of text editors, where there are many to choose from, but the trouble app that brought me looking for a solution here is Numbers, which simply won't save an edited file back to a ZFS volume. There are other spreadsheets, but none with the fine balance of features that Numbers enjoys. Rather than put up with the pain of Mac Excel or LibreOffice or Google Sheets, I ended up moving it to the Desktop for temporary editing. It's ridiculous, but hopefully this test case will lead one of the developers toward a fix.
tangent
 
Posts: 47
Joined: Tue Nov 11, 2014 6:58 pm


Return to OpenZFS on OS X Development

Who is online

Users browsing this forum: Google [Bot] and 55 guests