Skip to content

Conversation

kkebo
Copy link
Contributor

@kkebo kkebo commented Oct 5, 2024

fixes #836

Changes:

  • Add a relative symlink to FileIteratorTests
    • This causes test failures if the following fixes are not applied
  • Fix relative symlinks when using --follow-symlinks
  • Eliminate duplicated files with standardizedFileURL when comparing them in FileIterator.next()
@kkebo
Copy link
Contributor Author

kkebo commented Oct 7, 2024

It seemed that testFollowSymlinks failed on macOS. I'll investigate it.

https://ci.swift.org/job/swift-syntax-PR-macOS/4601/console

Test Case '-[SwiftFormatTests.FileIteratorTests testFollowSymlinks]' started. /Users/ec2-user/jenkins/workspace/swift-syntax-PR-macOS/branch-main/swift-format/Tests/SwiftFormatTests/Utilities/FileIteratorTests.swift:37: error: -[SwiftFormatTests.FileIteratorTests testFollowSymlinks] : XCTAssertEqual failed: ("4") is not equal to ("3") Test Case '-[SwiftFormatTests.FileIteratorTests testFollowSymlinks]' failed (0.699 seconds). 
@kkebo
Copy link
Contributor Author

kkebo commented Oct 11, 2024

The above error did not occur on macOS Sequoia. So I will prepare macOS Ventura. However, it will take time.

@kkebo
Copy link
Contributor Author

kkebo commented Oct 16, 2024

I have successfully reproduced the issue on macOS 13.6.9 on EC2.

When the test failed, the local variable seen looked like this:

[ "/private/var/folders/5r/59x37fyj13l2hjhq53g287_80000gn/T/TemporaryItems/NSIRD_xctest_Jjw9up/project/real2.swift", "/private/var/folders/5r/59x37fyj13l2hjhq53g287_80000gn/T/TemporaryItems/NSIRD_xctest_Jjw9up/project/.hidden.swift", "/var/folders/5r/59x37fyj13l2hjhq53g287_80000gn/T/TemporaryItems/NSIRD_xctest_Jjw9up/project/.hidden.swift", "/private/var/folders/5r/59x37fyj13l2hjhq53g287_80000gn/T/TemporaryItems/NSIRD_xctest_Jjw9up/project/real1.swift" ]

So it seems that this test failure occurs if a relative symbolic link is linked to a file that its path contains symbolic links.

@kkebo
Copy link
Contributor Author

kkebo commented Oct 16, 2024

Fixed: ef73806

Copy link
Member

@ahoppen ahoppen left a comment

Choose a reason for hiding this comment

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

Thanks for the PR and tracking down the failure, @kkebo. Looks good to me, just two very minor comments.

@ahoppen ahoppen merged commit 3ca1a18 into swiftlang:main Oct 18, 2024
15 checks passed
@kkebo kkebo deleted the relative-symlinks branch October 19, 2024 14:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

3 participants