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

[SR-14197] Host.current never has names #3233

Closed
Lukasa opened this issue Feb 12, 2021 · 2 comments
Closed

[SR-14197] Host.current never has names #3233

Lukasa opened this issue Feb 12, 2021 · 2 comments

Comments

@Lukasa
Copy link
Contributor

Lukasa commented Feb 12, 2021

Previous ID SR-14197
Radar None
Original Reporter @Lukasa
Type Bug
Status Resolved
Resolution Done
Additional Detail from JIRA
Votes 0
Component/s Foundation
Labels Bug
Assignee None
Priority Medium

md5: efe700676d15ed48f5a820617de156d7

Issue Description:

In the s-c-f implementation of Host, .current() will never have names populated. This is different to the implementation on macOS. As an example, in macOS:

  1> import Foundation
  2> Host.current().names
$R0: [String] = 3 values {
  [0] = "macbook-pro.local"
  [1] = "MacBook-Pro.local"
  [2] = "localhost"
}

Whereas on Linux:

  1> import Foundation
  2> Host.current().names
$R0: [String] = 0 values

This appears to happen because _resolveCurrent simply never puts anything in the names. At the very least it could put the _info field in there, as for .current() that's always derived from currentHostName

@Lukasa
Copy link
Contributor Author

Lukasa commented Feb 12, 2021

See #2981

@spevans
Copy link
Collaborator

spevans commented Feb 23, 2021

Now fixed in main

$ ~/swift-DEVELOPMENT-SNAPSHOT-2021-02-20-a-ubuntu20.04/usr/bin/swift
Welcome to Swift version 5.4-dev (LLVM a823aabb5dbebc7, Swift e854ac4f62963e9).
Type :help for assistance.
  1> import Foundation
  2> Host.current().names
$R0: [String] = 1 value {
  [0] = "ubuntu2004"
}
  3>  
 

@swift-ci swift-ci transferred this issue from apple/swift-issues Apr 25, 2022
@shahmishal shahmishal transferred this issue from apple/swift May 5, 2022
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants