Skip to content

Fix error when using Get-ChildItem c: - #7033

Merged
Aditya Patwardhan (adityapatwardhan) merged 9 commits into
PowerShell:masterfrom
sethvs:GetChildItem
Jun 25, 2018
Merged

Fix error when using Get-ChildItem c:#7033
Aditya Patwardhan (adityapatwardhan) merged 9 commits into
PowerShell:masterfrom
sethvs:GetChildItem

Conversation

@sethvs

@sethvs Sergey Vasin (sethvs) commented Jun 9, 2018

Copy link
Copy Markdown
Contributor

PR Summary

Fix #7032, #7048

Get-ChildItem c: throws an error. #7032

Get-ChildItem c:

Get-ChildItem : Cannot find path 'C:\C:\' because it does not exist.
At line:1 char:1
+ Get-ChildItem c:
+ ~~~~~~~~~~~~~~~~
+ CategoryInfo          : ObjectNotFound: (C:\C:\:String) [Get-ChildItem], ItemNotFoundException
+ FullyQualifiedErrorId : PathNotFound,Microsoft.PowerShell.Commands.GetChildItemCommand

When creating file using -Path c: without a backslash, file created in the drive root and not in the current folder. #7048

Windows PowerShell 5.1: file is created in current path - C:\Folder

[5.1] PS C:\Folder> New-Item -Path c: -Name testfile.txt


    Directory: C:\Folder


Mode                LastWriteTime         Length Name
----                -------------         ------ ----
-a----        6/14/2018  12:30 PM              0 testfile.txt

PowerShell Core 6.0.2: file is created in current path - C:\Folder

[6.0.2] PS C:\Folder> New-Item -Path c: -Name testfile.txt


    Directory: C:\Folder


Mode                LastWriteTime         Length Name
----                -------------         ------ ----
-a----        6/14/2018  12:32 PM              0 testfile.txt

PowerShell Core 6.1.0-preview.2: file is created in current path - C:\Folder

[6.1.0-preview.2] PS C:\Folder> New-Item -Path c: -Name testfile.txt


    Directory: C:\Folder


Mode                LastWriteTime         Length Name
----                -------------         ------ ----
-a----        6/14/2018  12:28 PM              0 testfile.txt

PowerShell Core 6.1.0-preview.3: file is created in root path - C:\

[6.1.0-preview.3] PS C:\Folder> New-Item -Path c: -Name testfile.txt


    Directory: C:\


Mode                LastWriteTime         Length Name
----                -------------         ------ ----
-a----        6/14/2018  12:29 PM              0 testfile.txt

PR Checklist

@bergmeister

Christoph Bergmeister (bergmeister) commented Jun 10, 2018

Copy link
Copy Markdown
Contributor

Sergey Vasin (@sethvs) Please push an empty commit to trigger another build since there seemed to be a sporadic problem that caused the build to hang and timeout. You could do this for example as follows, I recommend putting [feature] in the message so that more advanced tests run as well to test your change, which would be useful for this PR.

git commit -m [feature] --allow-empty
git push

Ilya (@iSazonov) This happened to me last week as well that a build got into a hanging state. Have you see that before as well or is this probably caused by a recently added test?

@iSazonov

Copy link
Copy Markdown
Collaborator

Christoph Bergmeister (@bergmeister) Do you mean a problem only with CIs (not local)?
Can you open new Issue and provide links on broken CI jobs?

@bergmeister

Christoph Bergmeister (bergmeister) commented Jun 10, 2018

Copy link
Copy Markdown
Contributor

Ilya (@iSazonov) I mean the AppVeyor run of this PR here. It must have got stuck or in a hanging state because it timed out after 3 hours.
The same build happened to this PR build of PR 7013. It seems that it happens only randomly.
I put those details into the new issue #7038
To be able to still analyse this build failure later on, we should not restart this build ourselves but rather push a new commit for a new build.

@anmenaga

Copy link
Copy Markdown

Sergey Vasin (@sethvs) After fixing current test failures in New-Item.Tests.ps1, please do a [feature] commit as Christoph Bergmeister (@bergmeister) suggested. Those namespaces APIs is a very fragile piece of code; so we need to run as many tests as we can to ensure that nothing gets broken by these changes.

@sethvs

Copy link
Copy Markdown
Contributor Author

Andrew (@anmenaga) OK.

@sethvs

Copy link
Copy Markdown
Contributor Author

Update-Help and PowerShellGet tests fail.
Can we restart Travis CI?

@iSazonov

Copy link
Copy Markdown
Collaborator

Sergey Vasin (@sethvs) Please look #6149 - perhaps we could fix it too.

@sethvs

Copy link
Copy Markdown
Contributor Author

Ilya (@iSazonov) OK, will take a look.

@sethvs

Sergey Vasin (sethvs) commented Jun 14, 2018

Copy link
Copy Markdown
Contributor Author

Aditya Patwardhan (@adityapatwardhan) Ilya (@iSazonov) I'm afraid I can't allocate much time at the moment. So let's split fixing #6149 to another PR in order not to delay this one. I'm going to address it later.

@sethvs

Copy link
Copy Markdown
Contributor Author

Empty commit to restart tests.

@adityapatwardhan

Copy link
Copy Markdown
Member

Sergey Vasin (@sethvs) it seems that #7048 is fixed in preview.3

@adityapatwardhan

Copy link
Copy Markdown
Member

Rob Holt (@rjmholt) Can you have a look too?

@sethvs

Sergey Vasin (sethvs) commented Jun 15, 2018

Copy link
Copy Markdown
Contributor Author

Aditya Patwardhan (@adityapatwardhan) No, it is not fixed.
The description of this PR contains examples of the issue in 6.1.0-preview.3.

@iSazonov Ilya (iSazonov) left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Leave a comment

@rjmholt Rob Holt (rjmholt) left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Going to build this branch and have a look at it, but it looks good so far.

{
PSTraceSource.NewArgumentNullException("paths");
}
else if (path.EndsWith((":" + Path.DirectorySeparatorChar), StringComparison.Ordinal) || path.EndsWith((":" + Path.AltDirectorySeparatorChar), StringComparison.Ordinal))

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Might be worth hanging a line for the second path check.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agree, done.

@rjmholt Rob Holt (rjmholt) left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, I've put this branch through a test run and got no unusual failures. This looks good to me!

@adityapatwardhan
Aditya Patwardhan (adityapatwardhan) merged commit ffca008 into PowerShell:master Jun 25, 2018
@sethvs
Sergey Vasin (sethvs) deleted the GetChildItem branch July 20, 2018 12:56
Thatgfsj (Thatgfsj) pushed a commit to Thatgfsj-contribs/PowerShell that referenced this pull request Aug 6, 2026
* Fix error when using Get-ChildItem c:

* Fix New-Item test issue.

* Add tests for Get-ChildItem cmdlet.

* Add tests for New-Item cmdlet.

* Fix tests for New-Item cmdlet.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Get-ChildItem c: throws an error.

6 participants