Skip to content
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

Implemented FileManager.attributesOfFileSystem() #1250

Merged
merged 5 commits into from
Oct 11, 2017
Merged

Implemented FileManager.attributesOfFileSystem() #1250

merged 5 commits into from
Oct 11, 2017

Conversation

amosavian
Copy link
Contributor

This is reopening of #888 PR. Please read conversation there.

@alblue
Copy link
Contributor

alblue commented Oct 6, 2017

@swift-ci please test

@alblue
Copy link
Contributor

alblue commented Oct 6, 2017

There seems to be a build error reported:

Foundation/FileManager.swift:346:17: error: use of unresolved identifier 'statfs'
        var s = statfs()
                ^~~~~~
SwiftGlibc.statvfs:1:15: note: did you mean 'statvfs'?
public struct statvfs {

@amosavian
Copy link
Contributor Author

amosavian commented Oct 6, 2017

I've forked code for Linux now. We have to use statfs(2) on Darwin to support APFS 64bit inodes.

@amosavian
Copy link
Contributor Author

amosavian commented Oct 6, 2017

Swift's Glibc doesn't import statvfs64(2). I'm not sure how statvfs(2) will count Btrfs or XFS free/total inodes.

@alblue
Copy link
Contributor

alblue commented Oct 6, 2017

@swift-ci please test

1 similar comment
@alblue
Copy link
Contributor

alblue commented Oct 6, 2017

@swift-ci please test

Copy link
Contributor

@alblue alblue left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please fix test failure by changing the systemNumber to a non-zero uint64.


let systemNumber = attrs[.systemNumber] as? NSNumber
XCTAssertNotNil(systemNumber)
XCTAssertGreaterThan(systemNumber!.int64Value, 0)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Test failures reported:

TestFoundation/TestFileManager.swift:221: error: TestFileManager.test_fileSystemAttributes : XCTAssertGreaterThan failed: ("-4983562779004283539") is not greater than ("0") - 

Given that the data is being parsed with a UInt64 in the implementation, it's not clear why this is using an Int64 in its test. Of course, if it is an UInt64 then the greaterThan 0 is basically the same as != 0, so that would be a couple of changes to fix.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You are right I'll do

@alblue
Copy link
Contributor

alblue commented Oct 11, 2017

@swift-ci please test

@alblue
Copy link
Contributor

alblue commented Oct 11, 2017

@swift-ci please test and merge

@swift-ci swift-ci merged commit ece9521 into apple:master Oct 11, 2017
@amosavian amosavian deleted the filemgr/fsattributes branch October 12, 2017 06:06
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.

None yet

3 participants