Skip to content

PSNativePSPathResolution is causing weirdness on Linux when trying to specify X server port number #17278

@rkeithhill

Description

@rkeithhill

Prerequisites

Steps to reproduce

Run this on Linux - if you don't have Xvfb then use echoargs or something like that:

~> Xvfb :99

Expected behavior

A headless X server starts up.

Actual behavior

You get an unrecognized option error:

 Xvfb :99
Unrecognized option: /home/mctcbld/:99
use: X [:<display>] [option]

Error details

It seems that PSNativePSPathResolution is transforming :99 to <home-dir>/:99 e.g.:

05-05 08:34:45 12> Trace-Command -Name ParameterBinding -Expression { Xvfb :99 } -PSHost
DEBUG: 2022-05-05 08:35:01.4643 ParameterBinding Information: 0 : BIND NAMED native application line args [/usr/bin/Xvfb]
DEBUG: 2022-05-05 08:35:01.4644 ParameterBinding Information: 0 :     BIND argument [/home/mctcbld/:99]
DEBUG: 2022-05-05 08:35:01.4648 ParameterBinding Information: 0 : CALLING BeginProcessing
Unrecognized option: /home/mctcbld/:99
use: X [:<display>] [option]

Also note that while quoting the arg works Xvfb ':99', it DOES NOT work if you background the process Xvfb ':99' & see the visual below for a screenshot that shows that.

BTW this also repos on the latest 7.3 preview on Windows if you have PSNativePSPathResolution enabled:

05-06 11:24:27 2> echoargs :99
Arg 0 is <C:\Users\Keith\:99>

Command line:
"C:\Users\Keith\Documents\PowerShell\Modules\pscx\4.0.0\Apps\EchoArgs.exe" C:\Users\Keith\:99

Environment data

Name                           Value
----                           -----
PSVersion                      7.2.0
PSEdition                      Core
GitCommitId                    7.2.0
OS                             Linux 3.10.0-229.el7.x86_64 #1 SMP Thu Jan 29 18:37:38 EST 2015
Platform                       Unix
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
WSManStackVersion              3.0

Visuals

image

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions