Repository navigation
New-Item -ItemType SymbolicLink cannot understand directory path ending with slash on Linux - #2974
Conversation
Mike Richmond (mirichmo)
left a comment
There was a problem hiding this comment.
Please include tests for this change
|
Mike Richmond (@mirichmo) the tests are added. |
|
Chunqing Chen (@chunqingchen) Thank you. Please assign appropriate reviewer(s) to review this change |
|
Francisco Gamino (@Francisco-Gamino) hi Francisco, it seems you have reviewed the code file recently. Would you mind help me review this change? Thank you~ |
There was a problem hiding this comment.
This should probably be:
Get-Item "$tmpDirectory/$folderName/" -ErrorAction SilentlyContinue | remove-item -force -recurse -ErrorAction SilentlyContinue
There was a problem hiding this comment.
Unfortunately remove-item would not work here because the item is a symboliclink path. It will lead to a System.ComponentModel.Win32Exception.
There was a problem hiding this comment.
if these are all created in $TESTDRIVE, there's no clean up needed at all, as pester will take care of it
Also, please fix spelling error Directoy => Directory
In reply to: 110466085 [](ancestors = 110466085)
There was a problem hiding this comment.
Chunqing Chen (@chunqingchen): Good to know. Thanks.
There was a problem hiding this comment.
Should we specified in the comment that Path.AltDirectorySeparatorChar referred to ('') on UNIX and a slash ('/') on Windows and Mac?
There was a problem hiding this comment.
resolvePath [](start = 20, length = 11)
I'm not sure that this can be so simple, are we guaranteed that the order will be this? For example, will we'll always get "", and then "/"?
|
Francisco Gamino (@Francisco-Gamino) Thanks Francisco for the review, the comments are resolved. |
|
James Truher (@JamesWTruher) Thanks Jim for the review, the comment has been resolved |
There was a problem hiding this comment.
You have an extra space before ' '
char[] charsToTrim = {<extra_pace>' '...
|
Chunqing Chen (@chunqingchen): Just one minor comment. Other than that, it LGTM. |
|
Francisco Gamino (@Francisco-Gamino) the space is removed. thanks ! |
|
Mike Richmond (@mirichmo) can you merge now? |
There was a problem hiding this comment.
Directoy --> Directory
…ng with slash on Linux
…ng with slash on Linux (PowerShell#2974)
Relevant issue: #2865
Steps to reproduce
Expected behavior
Symbolic link is created from /foo/ to /bar/.
Actual behavior
Removing the slash at the end of the Path argument makes the call behave as expected. This is counterintuitive, as a slash at the end of a path generally works fine in PowerShell scripts to designate directories (and directory links).
Environment data
Running PowerShell on Ubuntu 16.04.