Unicode Windows hostnames invalid in Linux/WSL
Nobody has claimed this yet.
- Dominant language
- C++
- Stars
- 33.7k
- Forks
- 1.8k
- Avg merge
- 3d 17h
- Merged PRs (30d)
- 116
Description
Version
Windows 11 Dev Channel build 22616.1
WSL Version
- WSL 2
- WSL 1
Kernel Version
5.10.102.1-microsoft-standard-WSL2
Distro Version
Ubuntu 16.04
Other Software
No response
Repro Steps
This is an issue I'm reporting based on a specific issue found when using genie under WSL (see here for original issue: https://github.com/arkane-systems/genie/issues/268 ), but the underlying problem is not specific to any particular application.
- Set the Windows computer name (specifically, DNS host name) to a name containing Unicode characters, such as '机械革命'.
(This is permitted per https://docs.microsoft.com/en-us/troubleshoot/windows-server/identity/naming-conventions-for-computer-domain-site-ou#dns-host-names provided the network it is on uses Microsoft DNS.)
- Start a WSL distribution.
Expected Behavior
The Unicode Windows hostname should be replaced with a translation (such as Punycode, as used for internationalized domain names generally) of the Unicode Windows hostname, or failing that a generic replacement hostname, that is compliant with Linux / RFC952 / RFC 1123 standard for permitted hostnames.
Actual Behavior
The WSL hostname matches the Windows one. This gives rise to assorted Unicode errors, etc., in various applications since Unicode characters are not permitted in Linux hostnames, per hostname(7): https://www.man7.org/linux/man-pages/man7/hostname.7.html and other documentation. Such hostnames are also incompatible with native hostname management commands:
❯ sudo hostname 机械革命
hostname: the specified hostname is invalid
[1] 328332 exit 1 sudo hostname 机械革命
❯ sudo hostnamectl hostname --static 机械革命
Could not set static hostname: Invalid static hostname '机械革命'
[1] 328629 exit 1 sudo hostnamectl hostname --static 机械革命
Diagnostic Logs
No response
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
The report names no file, test, or entry point. Reproduce the issue by setting the Windows DNS hostname to 机械革命 and starting WSL; done means the resulting Linux hostname is RFC 952/1123-compliant through translation or a generic fallback.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- linux
- Domain
- operating-systems
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100