From 0232f160ec89b9ef0fe223878fe933374649ac04 Mon Sep 17 00:00:00 2001 From: Andrew Schwartzmeyer Date: Wed, 15 Jun 2016 12:16:03 -0700 Subject: [PATCH] Add backward slash in filename as known issue --- docs/KNOWNISSUES.md | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/docs/KNOWNISSUES.md b/docs/KNOWNISSUES.md index 34f6f312e..5b6587183 100644 --- a/docs/KNOWNISSUES.md +++ b/docs/KNOWNISSUES.md @@ -87,3 +87,38 @@ following cmdlets that exist in the FullCLR version: - Send-MailMessage - Show-Command - Update-List + +## File paths with literal backward slashes + +On some filesystems (Linux, OS X), file paths are allowed to contain literal +backward slashes, '\', as valid filename characters. These slashes, when +escaped, are not directory separators. In Bash, the backward slash is the escape +character, so a `path/with/a\\slash` is two directories, `path` and `with`, and +one file, `a\slash`. In PowerShell, we *will* support this using the normal +backtick escape character, so a `path\with\a``\slash` or a +`path/with/a``\slash`, but this edge case is *currently unsupported*. + +That being said, native commands will work as expected. Thus this is the current +scenario: + +```powershell +PS > Get-Content a`\slash +Get-Content : Cannot find path '/home/andrew/src/PowerShell/a/slash' because it does not exist. +At line:1 char:1 ++ Get-Content a`\slash ++ ~~~~~~~~~~~~~~~~~~~~ + + CategoryInfo : ObjectNotFound: (/home/andrew/src/PowerShell/a/slash:String) [Get-Co + ntent], ItemNotFoundException + + FullyQualifiedErrorId : PathNotFound,Microsoft.PowerShell.Commands.GetContentCommand + +PS > /bin/cat a\slash +hi + +``` + +The PowerShell cmdlet `Get-Content` cannot yet understand the escaped backward +slash, but the path is passed literally to the native command `/bin/cat`. Most +file operations are thus implicitly supported by the native commands. The +notable exception is `cd` since it is not a command, but a shell built-in, +`Set-Location`. So until this issue is resolved, PowerShell cannot change to a +directory whose name contains a literal backward slash.