Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

build.ps doesn't handle unmapped UNC-paths #494

Open
DennisL68 opened this issue Sep 2, 2024 · 0 comments
Open

build.ps doesn't handle unmapped UNC-paths #494

DennisL68 opened this issue Sep 2, 2024 · 0 comments
Labels
enhancement The issue is an enhancement request. help wanted The issue is up for grabs for anyone in the community.

Comments

@DennisL68
Copy link

Problem description

When trying to build a module stored on a share using a pure UNC-path (i.e. \server\share\mymodule not mapped to a drive letter), the build fails with the error message

Get-SamplerAbsolutePath : Cannot bind arguments to parameter 'Path' because it is null.
At C:\Program Files\WindowsPowerShell\Modules\Sampler\0.118.1\tasks\Clean.ModuleBuilder.build.ps1:17 char:25

Verbose logs

-

How to reproduce

cd \\server\share\mymodule
.\build.ps1 .

Expected behavior

The Sampler should check that the path is not an UNC-path as some cmdlets doesn't work with UNC-paths and output an error referring to UNC-paths not being supported for source files.

Current behavior

The build fails, but it's not apparent it is because of the path being an UNC-path and not a drive letter path.

Suggested solution

I'm assuming that the param RelativeTo is the one that needs to be checked in the function Get-SamplerAbsolutePath.

if (([uri]$RelativeTo).IsUnc) {
  Write-Error 'UNC paths not supported' -ErrorAction Stop
}

Operating system the target node is running

OsName               : Microsoft Windows 10 Enterprise
OsOperatingSystemSKU : EnterpriseEdition
OsArchitecture       : 64-bit
WindowsVersion       : 2009
WindowsBuildLabEx    : 19041.1.amd64fre.vb_release.191206-1406
OsLanguage           : en-US
OsMuiLanguages       : {en-US}

PowerShell version and build the target node is running

Name                           Value
----                           -----
PSVersion                      5.1.19041.4780
PSEdition                      Desktop
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}
BuildVersion                   10.0.19041.4780
CLRVersion                     4.0.30319.42000
WSManStackVersion              3.0
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1

Module version used

Name    Version Path
----    ------- ----
Sampler 0.118.1 C:\Program Files\WindowsPowerShell\Modules\Sampler\0.118.1\Sampler.psd1
@johlju johlju added enhancement The issue is an enhancement request. help wanted The issue is up for grabs for anyone in the community. labels Sep 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement The issue is an enhancement request. help wanted The issue is up for grabs for anyone in the community.
Projects
None yet
Development

No branches or pull requests

2 participants