Skip to content

Fix _CFIterateDirectory behavior on some old file systems #1716

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

Merged
merged 1 commit into from
Oct 14, 2018

Conversation

jtxapl
Copy link
Contributor

@jtxapl jtxapl commented Oct 8, 2018

On some old systems readdir does not fill correct filetypes. Tasks like loading CFBundle will fail on these systems since _CFIterateDirectory relies on readdir. Adding a second check with stat when readdir returns unknown filetype.

@millenomi
Copy link
Contributor

Which file systems are affected?

Is there some way to test this?

@millenomi
Copy link
Contributor

@swift-ci please test

@jtxapl
Copy link
Contributor Author

jtxapl commented Oct 10, 2018

Which file systems are affected?

Earlier versions of CentOS / RHEL / Oracle Linux 7 format XFS partitions with ftype=0 (disabling d_type) unless specially configured.

Oracle Linux 7 Update 4 release notes mentioned:

"For systems installed with the Oracle Linux 7 Update 4 installer, when formatting a device using XFS, d_type support is enabled automatically, which means all XFS-formatted partitions are created using the ftype=1 parameter as the default. Whereas, in previous Oracle Linux 7 updates, ftype=0 was the default parameter, meaning d_type was disabled or off and XFS-formatted partitions were created using ftype=0 as the default."

More details can be found here

Is there some way to test this?

One can check if filesystem supports d_type via xfs_info. If it shows ftype = 0, can verify readdir always return d_type = 0 and subsequently CFBundle load will always fail without this patch.

@parkera
Copy link
Contributor

parkera commented Oct 10, 2018

The diff seems reasonable to me.

@millenomi
Copy link
Contributor

@swift-ci please test and merge

@swift-ci swift-ci merged commit cc7d217 into swiftlang:master Oct 14, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants