Skip to content

Cleanup FileSystem provider - #6909

Merged
Ilya (iSazonov) merged 5 commits into
PowerShell:masterfrom
iSazonov:psl-clean-winsafegetfileattributes
Jun 4, 2018
Merged

Ilya (iSazonov) merged 5 commits into
PowerShell:masterfrom
iSazonov:psl-clean-winsafegetfileattributes

Conversation

@iSazonov

Copy link
Copy Markdown
Collaborator

PR Summary

Related #6874. The PR is coming from a code review to cleanup psl. Here we clean up the side branch of the code that will allow later to clean up a branch which uses psl.

  • IO.FileInfo does not make system calls in constructor. So we can create the object and then use the required attributes without direct call IO.FileInfo.GetAttributes() ( SafeGetFileAttributes() ). This allow us to exclude some p/invoke calls in our code in later cleanups. Also we get unified code for both Windows and Unix.
  • Remove SafeGetFileAttributes() and WinSafeGetFileAttributes(). Currently .Net Core support file attributes on all platforms in fastest way and we can remove our workaround. We get a regression in rare case (for files like pagefile.sys). Fix is ready in CoreFX, we get it in 2.1.1. I suggest ignore the regression because this is a very-very rare situation (Get-ChildItem c:\pagefile.sys -Hidden). The .Net Core team was not even able to create an artificial test for such files and uses a real pagefile.sys file for the test. Also the enumeration is still working (dir c:\ -hidden).
  • Re-add test which we lost in Make CodeCoverage tests work with CodeCov.io and related fixes #4050. The test is pending because of the regression.

PR Checklist

IO.FileInfo does not make system calls in constructor.  So we can create the object and then use the required attributes.
@iSazonov

Copy link
Copy Markdown
Collaborator Author

Steve Lee (@SteveL-MSFT) Dongbo Wang (@daxian-dbw) Could you please look the PR?

@iSazonov Ilya (iSazonov) mentioned this pull request May 24, 2018
6 of 11 tasks
@iSazonov

Copy link
Copy Markdown
Collaborator Author

Dongbo Wang (@daxian-dbw) Seems the PR is ready to merge - could you please look?

@iSazonov
Ilya (iSazonov) merged commit 57b3d33 into PowerShell:master Jun 4, 2018
@iSazonov
Ilya (iSazonov) deleted the psl-clean-winsafegetfileattributes branch June 4, 2018 05:01
Thatgfsj (Thatgfsj) pushed a commit to Thatgfsj-contribs/PowerShell that referenced this pull request Aug 6, 2026
The cleanup is coming from a code review to cleanup psl. Here we clean up the side branch of the code that will allow later to clean up a branch which uses psl.
- IO.FileInfo does not make system calls in constructor. So we can create the object and then use the required attributes without direct call IO.FileInfo.GetAttributes() ( SafeGetFileAttributes() ). This allow us to exclude some p/invoke calls in our code in later cleanups. Also we get unified code for both Windows and Unix.
- Remove SafeGetFileAttributes() and WinSafeGetFileAttributes(). Currently .Net Core support file attributes on all platforms in fastest way and we can remove our workaround. We get a regression in rare case (for files like pagefile.sys). Fix is ready in CoreFX, we get it in 2.1.1. I suggest ignore the regression because this is a very-very rare situation (Get-ChildItem c:\pagefile.sys -Hidden). The .Net Core team was not even able to create an artificial test for such files and uses a real pagefile.sys file for the test. Also the enumeration is still working (dir c:\ -hidden).
- Re-add test which we lost in PowerShell#4050. The test is pending because of the regression.
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.

4 participants