-
Notifications
You must be signed in to change notification settings - Fork 233
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
swift-format causes a infinite loop on Linux if .swift-format
is missing
#847
Comments
swiftlang/swift-foundation#969 may fix this issue. |
Synced to Apple’s issue tracker as rdar://137738047 |
Oh, I see. I wasn’t sure if you built from source. Thanks for your detailed analysis. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Description
On Linux, when all ancestor directories do not have
.swift-format
, swift-format causes a infinite loop.swift-format lint
andswift-format format
do not work.Steps to reproduce
Please make sure that
/
,/home
, and/home/<user name>
do not contain.swift-format
.Expected behavior
Actual behavior
swift-format never finishes because of a infinite loop.
Environment
I use swift-format bundled in the Swift 6.0.1 toolchain.
Supplement
I think that the root cause is a combination of swift-foundation's
URL
and swift-format's this line.swift-foundation's
URL
is different from macOS'sURL
.URL(filePath: "/foo", directoryHint: .notDirectory).deletingLastPathComponent().path()
"/"
URL(filePath: "/foo", directoryHint: .isDirectory).deletingLastPathComponent().path()
""
(empty string)"/"
On Linux, when I added
print(self.path)
to the line,self.path
changed as follows."/foo/bar/baz"
"/foo/bar"
"/foo"
""
(empty string)""
(empty string)""
(empty string)So
self.path == "/"
couldn't returntrue
forever.The text was updated successfully, but these errors were encountered: