microsoft / microsoft/WSL

Unicode Windows hostnames invalid in Linux/WSL

Open
#8,386 1 comment 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

feature
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.

  1. 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.)

  1. 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

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.