microsoft / microsoft/WSL

Enhance WSLENV to ignore translation failures when running Win32 commands from WSL

Open
#3,725 6 comments 6 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

feature interop
Dominant language
C++
Stars
33.7k
Forks
1.8k
Avg merge
3d 17h
Merged PRs (30d)
116

Description

If I run the command WSLENV='PATH/l' cmd.exe /c echo hello from WSL, I get a bunch of errors printed out on stderr:

<3>init: (13347) ERROR: UtilTranslatePathList:2021: Failed to translate /usr/local/sbin
<3>init: (13347) ERROR: UtilTranslatePathList:2021: Failed to translate /usr/local/bin
<3>init: (13347) ERROR: UtilTranslatePathList:2021: Failed to translate /usr/sbin
<3>init: (13347) ERROR: UtilTranslatePathList:2021: Failed to translate /usr/bin
<3>init: (13347) ERROR: UtilTranslatePathList:2021: Failed to translate /sbin
<3>init: (13347) ERROR: UtilTranslatePathList:2021: Failed to translate /bin
<3>init: (13347) ERROR: UtilTranslatePathList:2021: Failed to translate /usr/games
<3>init: (13347) ERROR: UtilTranslatePathList:2021: Failed to translate /usr/local/games
<3>init: (13347) ERROR: UtilTranslatePathList:2021: Failed to translate /snap/bin

It would be nice to be able to disable these. For example, if we could add a /i option to WSLENV, such that if you use WSLENV='PATH/li' it would suppress those error messages. Either that or another environment variable.

Redirecting stderr is not an option because the Win32 program we call may be printing meaningful information on stderr.

For a single program this is a minor annoyance, but if you are calling a lot of programs in a script (for example a Makefile) you will get this for every Win32 program you call, resulting in a huge amount of output. It also interferes with programmatically parsing stderr in bash scripts (of course we can workaround this but it's not ideal)
Details of my environment:

uname -a

Linux DESKTOP 4.4.0-17763-Microsoft #194-Microsoft Mon Dec 03 17:58:00 PST 2018 x86_64 x86_64 x86_64 GNU/Linux

ver

Microsoft Windows [Version 10.0.17763.195]

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

Start by reproducing the WSLENV='PATH/l' cmd.exe /c echo hello example and trace the WSLENV path-list translation handling. Done means a documented option or setting can suppress translation-failure messages without hiding meaningful stderr from the invoked Win32 command.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
operating-systems
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
52/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.