-
Notifications
You must be signed in to change notification settings - Fork 131
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
Permission issue when Swift toolchain/docc is installed as root user #1136
Comments
Can confirm using Swiftly + manually selecting the toolchain in VS Code and updating the PATH as a workaround (at least for Arch Linux). |
From my limited testing using strace, at some point docc tries to Also note that this only started happening in Swift 6. Prior versions do not exhibit this behaviour, at least on my installations. |
Diagnosing Docc directly, it happens here:
copyItem copies all attributes, including ownership and the owning group. |
yretenai@521e2cb I made a small patch that fixes this by manually copying every single file but I am not confident enough to push a PR for this quite yet as I have yet to update the documentation and write a test case for it. (I also don't know if there's a way to tell Swift's FileManager to not copy attributes, it doesn't appear to be so. My code definitely can be improved, however.) While writing this I also discovered the |
It seems the issue is tracked in Foundation already, unfortunately Swift 6.0, through 6.0.3 (possibly all the way to 6.1) will remain broken unless a patch (like mine) gets merged (that is assuming it gets fixed in Foundation before 6.1/6.0.4 releases) |
Well these issues look like "fun". They need to be fixed tho...so even if it happens in 6.2 we'll eventually need them to be resolved! |
Description
When the Swift toolchain is installed to
/
or/usr/libexec
(as is done with Debian and Fedora distributions), thedocc
binary throws a permissions issue when attempting to preview or generate documentation:However, if the Swift toolchain and
docc
are installed to a directory under the user, like in the user's home directory or via Swiftly, then it works perfectly fine:Any ideas why this happens? It makes it impossible to have Swift installed to the system and then use docc to preview and generate documentation, for example in a CI environment...
Checklist
main
branch of this package.Expected Behavior
Running
docc convert
ordocc preview
when the Swift toolchain is installed to a system directory withroot
permissions works.Actual behavior
Running
docc convert
ordocc preview
when the Swift toolchain is installed to a system directory withroot
permissions throws a permissions error:Error: Error Domain=NSCocoaErrorDomain Code=513 "You don’t have permission."
Steps To Reproduce
docc preview
from the system directory.Swift-DocC Version Information
Swift 6.0.3 Release
Swift Compiler Version Information
The text was updated successfully, but these errors were encountered: