Skip to content
This repository was archived by the owner on Jun 1, 2023. It is now read-only.

FIX: swift-doc creates file and directory with unexpected permission#146

Merged
mattt merged 2 commits into
SwiftDocOrg:masterfrom
niw:fix_file_and_directory_permission
Jul 29, 2020
Merged

FIX: swift-doc creates file and directory with unexpected permission#146
mattt merged 2 commits into
SwiftDocOrg:masterfrom
niw:fix_file_and_directory_permission

Conversation

@niw

@niw niw commented Jul 28, 2020

Copy link
Copy Markdown
Contributor

Problem

swift-doc creates file with execution bit, also creates directory
without execution bit.

Solution

Remove unexpected permission attributes given to the FileManager
and let them to use default permission respects file system and process umask.

**Problem**

swift-doc creates file with execution bit, also creates directory
without execution bit.

**Solution**

Remove unexpected permission attributes given to the `FileManager`
and let them to use file system defaults.
@mattt

mattt commented Jul 28, 2020

Copy link
Copy Markdown
Contributor

Thanks for the patch, @niw! That was some code left over from the initial proof-of-concept. For whatever reason, I thought I needed to override permissions to get it working on CI.

Could you please add a corresponding entry into Changelog.md? As soon as we have that, this will be ready to merge.

@niw

niw commented Jul 28, 2020

Copy link
Copy Markdown
Contributor Author

I thought I needed to override permissions to get it working on CI.

So, while working on this patch, I was investigating corelibs Foundation and found the next behavior (possibly a bug.)
No updates yet from Swift team, but this could be a potential reason why setting the permissions was needed for CI, which I think might run with corelibs Foundation.

https://bugs.swift.org/browse/SR-13307
(Seems like caused by swiftlang/swift-corelibs-foundation#1876)

@mluisbrown

Copy link
Copy Markdown

Looks like swift-doc is still creating files with unexpected permissions, which means an extra 'sudo chown --recursive $USER Documentation' step is needed in a GitHub workflow before being able to use https://github.com/JamesIves/github-pages-deploy-action to deploy documentation.

Without this extra step, I get "Permission Denied" when trying to copy the documentation files: JamesIves/github-pages-deploy-action#388

@niw

niw commented Aug 7, 2020

Copy link
Copy Markdown
Contributor Author

@mluisbrown Hi, do you know if it’s because the files generated by swift-doc has no read permissions for the others?
e.g. I am wondering if $USER that sudo command taken is the same as the user who runs swift-doc on your CI.

Because that is slightly separated issue but actually Swift corelibs Foundation bug (I would say, it’s bug,) as I describe before on this thread caused by swiftlang/swift-corelibs-foundation#1876.

Also if that’s the case, when you can run the CI on macOS instead of other POSIX system such as Linux, then probably the result would be different, which is using Apple's Foundation not corelibs one.

@mluisbrown

Copy link
Copy Markdown

@niw I don't actually know. It's likely that the problem is the Foundation bug that you mentioned, and not anything specifically related to swift-doc itself 👍

@niw

niw commented Aug 10, 2020

Copy link
Copy Markdown
Contributor Author

FYI here, I just posted a potential fix on swiftlang/swift-corelibs-foundation#2851 for the permission issue.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants