-
Notifications
You must be signed in to change notification settings - Fork 72
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Xcode not happy with ZFS #792
Comments
This is with Xcode 13.0 (13A233) running on Big Sur 11.5.2. If no one has ever complained about this before (and that does seem hard to believe), perhaps it's a new problem with the latest versions. |
As you say this sounds like the same issue I was asking about on the openzfsonosx.org forums. To recap on here, I think I've narrowed down a possible cause to something extended attribute related; I've noticed on my projects that the files that will not unlock all have the
This will remove all extended attributes (not just What I can't figure out though is why this is happening; as far as I can tell the attribute is being set correctly, and I can access it using In my case I'm using I also haven't found a way to find out more about what's going on; is there a way to find out all the file system calls that a process is making, in case there's a possible culprit? Maybe Xcode (or macOS) is using a call other than what |
ok i read https://blog.xpnsec.com/we-need-to-talk-about-macl/ to get familiar with the xattr |
The problem was partially solved by enabeling Developer Mode. Xcode can now save changes without problem. However, the inability to track more than one ZFS-hosted project in recently opened persists, nor does it explain why APFS-hosted projects never had a problem to begin with. |
Thanks for the link! Like I say I'm mostly guessing at One thing I forgot to add is that for me at least this issue only seems to affect projects with source control (git) active, which has always been a mess of weird permissions to begin with (.git folders and files that the current user can't always delete) so it could be something to do with that that's causing Xcode to mess up? If I open a project or a single file that isn't source control managed then it seems to have no problems editing (no failures to unlock). So it's possible |
I'm having a problem re-producing this locally, Monterey, zfs mounted inside homedir, with mimic=hfs, and I can start/stop xcode as I see fit. |
Are you using source control (git) for the Xcode project? In my case it seems to be source control (managed by Xcode) that is part of the equation, though I'm not sure if the same is true for the OP. But for myself at least projects and files without source control are unaffected. For starting/stopping Xcode I believe the OP's issue is that when a file in an open project is modified and cannot be unlocked for saving, then Xcode will not close (as there are unsaved changes and it still cannot unlock the file). For my own case a reproduction would look something like:
If you're triggering the same issue then Xcode will complain that the file is locked and ask if you want to unlock it, then give an unknown error if you do. I'm not sure if it's related or not but I've also noticed a lot of sandbox related errors for Also since I didn't mention it here, but I'm macOS Catalina. While it's possible Apple have improved things in Monterey, that still doesn't explain why ZFS is affected in Catalina but APFS/HFS aren't. |
@Haravikk for the sake of helping us debug this further, can you please give us the results of running
on your affected system? If the last line is not "Developer mode is currently enabled." then please see if
resolves your Xcode (and Developer Command Line Tools, like /usr/bin/git) file access problems. |
I do use git for my projects. |
@rottegift Unfortunately enabling developer mode doesn't resolve this issue for me; I dug around in Console.app and found I was getting a lot of the Sandbox related error messages, but granting Xcode Full Disk Access doesn't fix this which is strange (as that's how I've fixed similar issues with In my case at least it seems to be some kind of infuriating interaction with the Sandboxing on macOS which is for some reason behaving differently for ZFS than it did for APFS or HFS+, even though I've always had the bulk of my users relocated onto a different volume so it shouldn't be that, not unless the change in how I've laid out the volumes is part of the problem (I'm using a separate dataset for each user, except admin, whereas before I had a separate users volume for all non-admin users), but in both cases they were located off my main system volume. Might mean my issue is something slightly different; tomorrow I'll try testing against an APFS/HFS+ formatted zvol and an ordinary APFS volume, each with the same mountpoint, to see if I can eliminate the layout as the problem (in case it's not ZFS but just sandbox misinterpreting paths as being on different devices when they're not). For @jeffc768's original case, even if developer mode "fixes" the problem, it doesn't explain why it should be needed though does it? I've never needed to enable developer mode before either, as while it makes some things a bit simpler, everything I usually need always worked fine without it on APFS/HFS+. |
So I can confirm that the issue I'm seeing is specific to ZFS datasets; I copied all of the affected user's data into an HFS+ formatted zvol and everything worked as normal with no need for developer mode to be enabled, and this resolved all of the other sandboxing issues I've been noticing as well. I had the HFS+ volume mounted at the exact same location that I previously mounted my ZFS dataset (to rule out the user home folder being a volume as a possible cause). It definitely seems like the problem with files not unlocking in Xcode, and similar issues in other programs ( What I can't figure out is what the problem is exactly; I still can't help but feel like it must be related to the Are there any other ways I could try to debug this to confirm? Any way to get more detail about what's going on at the filesystem level? It might help if I could isolate some kind of filesystem instruction that could be to blame, but I have no idea how to actually do that. In the mean time I'll have to either expand the HFS+ zvol and use that for my affected user, or move that one back to my system volume; I'll keep the affected dataset for now so I can test (and because I'd really like to be able to use it). |
I found out about the Unfortunately Xcode seems to be a very noisy program in You can download my There are two files, the first ( Please let me know if these are of no use, and if there's anything else I can do to more effectively debug this issue. I also captured some cleaner |
@lundman is there anything more I can do try to debug this? I'm a bit out of my depth on this one as I do not know nearly enough about implementing filesystems in general or on macOS specifically. I had thought maybe if I could figure out where in the code some of the commands reported by My working theory is still that it's extended attribute related somehow, most likely that either By comparing output from |
lesse if I can catch up again. For We may be handling xattrs wrong just in general, or a specific one. But hfs only has 1 xattrs they do special work "cprotect". So perhaps it's the generic case. If you do find we add "an extra null" then we should definitely fix that. Making a new build today for a couple of other issues and to back into the swing of things again. |
Copy an Xcode project to a ZFS dataset and open it.
Select a source file and make a change to it.
Build the project. This might fail with a build error: :0: error: error opening input file 'name of file you modified' (Operation not permitted)
Regardless, make another change to that file. Xcode will ask if you want to unlock it.
Say you do. It'll complain it cannot.
If you're really lucky, Xcode will get into a state where you cannot quit, because it cannot auto-save due to the above problem. Force quitting will be required in that circumstance.
Setting the dataset to mimic APFS does not solve the problem.
Also, possibly related: Xcode can only keep track of one project located on ZFS on the recently opened list. Open a different project, and it replaces the other. Projects located on APFS remain on the list as expected.
The text was updated successfully, but these errors were encountered: