Skip to content

Get-ChildItem on Linux terminates abruptly when accessing directory fails with access denied or file not found #2856

Closed

Description

PS > /home/<user>/ dir

dir : Access to path '/home/<user>/.gvfs' is denied

PS >

Result:

Enumeration of paths and files terminates on access denied error

Expected

Get-ChildItem should skip inaccessible paths (with error) and continue enumerating files and paths that are accessible.

Activity

  1. MaximoTrinidad commented on Dec 8, 2016

    @MaximoTrinidad

    Question: Which version of OS(Ubuntu/RedHat,Fedora...), and version PowerShell?
    Ubuntu 16.04.1 on PowerShell v6.0.0.0-Alpha-13 works fine.
    ubuntudirfine

  2. added this to the milestone on Mar 4, 2017
  3. added
    WG-Engine-Providersbuilt-in PowerShell providers such as FileSystem, Certificates, Registry, etc.
    and removed
    WG-Cmdletsgeneral cmdlet issues
    on Mar 4, 2017
  4. SteveL-MSFT commented on Mar 4, 2017

    @SteveL-MSFT
    Member

    This repro'd for me on Ubuntu16.04 with alpha.16. It may depend on if you have a .gvfs directory in your home directory. dir -force works, but that's not user friendly particularly when ls works happily without issue.

  5. PaulHigin commented on Mar 6, 2017

    @PaulHigin
    ContributorAuthor

    Agreed. We need to make "cannot access" errors non-terminating.

  6. SteveL-MSFT commented on Mar 20, 2017

    @SteveL-MSFT
    Member

    No longer repro'ing for me on Ubuntu16 with alpha.17

  7. removed this from the 6.0.0-beta1 milestone on Mar 20, 2017
  8. changed the title [-]Get-ChildItem on Linux terminates abruptly when accessing directory fails with access denied[/-] [+]Get-ChildItem on Linux terminates abruptly when accessing directory fails with access denied or file not found[/+] on May 8, 2017
  9. added this to the milestone on May 8, 2017
  10. SteveL-MSFT commented on May 8, 2017

    @SteveL-MSFT
    Member

    I'm hearing this also repros if the file gets renamed or deleted while get-childitem is running. Generally, get-childitem shouldn't be throwing terminating errors.

  11. 2 remaining items

  12. jeffbi commented on May 9, 2017

    @jeffbi

    Paul Higinbotham (@PaulHigin) The function that walks directories does handle specific exceptions: ArgumentException, IOException and UnauthorizedAccessException. I'm going to be adding additional try/catch handlers for more specific IO exception types a little deeper in scope within the function.

    I'm thinking what we would want is if a single file or sub-directory within a directory triggers an error we should not abandon that directory, just write an error and move on to the next entry. If, however, the "current" directory itself goes away mid-process then we abandon that directory and go back up to the parent if present. Does that make sense?

  13. PaulHigin commented on May 10, 2017

    @PaulHigin
    ContributorAuthor

    jeffbi Yes, I agree. This sounds like the right behavior.

  14. modified the milestones: , , on May 15, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

OS-LinuxResolution-FixedThe issue is fixed.WG-Engine-Providersbuilt-in PowerShell providers such as FileSystem, Certificates, Registry, etc.

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions