Skip to content

Make Add-Type open source files with FileAccess.Read and FileShare.Read explicitly - #7915

Merged
Ilya (iSazonov) merged 3 commits into
PowerShell:masterfrom
IISResetMe:patch-1
Oct 3, 2018
Merged

Ilya (iSazonov) merged 3 commits into
PowerShell:masterfrom
IISResetMe:patch-1

Conversation

@IISResetMe

Copy link
Copy Markdown
Collaborator

Fix #7914

Omitting the FileAccess attribute when constructing a FileStream with FileMode.Open makes the constructor default to FileAccess.ReadWrite, which is completely unecessary and inappropriate for Add-Type when compiling from source

PR Summary

This PR ensures that Add-Type explicitly opens source code files with only Read access

PR Checklist

Omitting the `FileAccess` attribute when constructing a `FileStream` with `FileMode.Open` makes the constructor default to `FileAccess.ReadWrite`, which is completely unecessary and inappropriate for Add-Type when compiling from source
@IISResetMe Mathias R. Jessen (IISResetMe) changed the title Make Add-Type open source files with FileAccess.Read explicitly (#7914) #1 Make Add-Type open source files with FileAccess.Read explicitly (Fix #7914) Oct 1, 2018
@iSazonov

Copy link
Copy Markdown
Collaborator

Mathias R. Jessen (@IISResetMe) Please update package versions. (It is not your issue but our test system requirement.)

@IISResetMe

Copy link
Copy Markdown
Collaborator Author

Ilya (@iSazonov) done, not sure why the WebListener test fails though

@TravisEz13

Copy link
Copy Markdown
Member

Restarted AppVeyor

@iSazonov Ilya (iSazonov) changed the title Make Add-Type open source files with FileAccess.Read explicitly (Fix #7914) Make Add-Type open source files with FileAccess.Read and FileShare.Read explicitly Oct 3, 2018
@iSazonov
Ilya (iSazonov) merged commit 5e525de into PowerShell:master Oct 3, 2018
Aditya Patwardhan (adityapatwardhan) pushed a commit to adityapatwardhan/PowerShell that referenced this pull request Apr 9, 2019
Thatgfsj (Thatgfsj) pushed a commit to Thatgfsj-contribs/PowerShell that referenced this pull request Aug 6, 2026
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.

Bug: Add-Type needs write-access when compiling from source

3 participants