microsoft / microsoft/WSL

wslpath on Ubuntu sometimes outputs to stderr with a prefix

Open
#6,283 3 comments 0 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

The error-handling behavior shown below is confusing. The error is that the USERPROFILE variable is in *nix format, not windows format. When an attempt is made to use wslpath to translate the output to *nix format (again) the result leaves the user wondering what is going on.

Environment

WSLVER is defined to be USERPROFILE/up

$ cmd.exe /c ver
Microsoft Windows [Version 10.0.19042.630]

$ lsb_release -r
Release:        20.10

$ cat /proc/version
Linux version 4.19.128-microsoft-standard (oe-user@oe-host) (gcc version 8.2.0 (GCC)) #1 SMP Tue Jun 23 12:58:10 UTC 2020

Steps to reproduce

$ x="$(wslpath -u "$USERPROFILE" 2>&1)"

$ echo $x
wslpath: /mnt/c/Users/Mike Slinn

Expected behavior

Two possible behaviors would make sense (to me):

  1. wslpath should write a more informative error message to stderr, perhaps something like:
    Error: wslpath received a *nix format path.

  2. 'wslpathshould just echo the incoming *nix path tostdout` without any warning (this would be my preference)

Actual behavior

The path in Windows format is sent to stderr instead, with the prefix wslpath: .

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 documented wslpath -u "$USERPROFILE" command on the stated WSL environment and inspect the wslpath entry point. Compare the handling of the path, stdout, and stderr with the two proposed behaviors; the issue is done when the selected behavior is implemented and verified against this reproduction.

Written by the indexing model from the issue text.

Assessment

Domain
operating-systems
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.