-
Notifications
You must be signed in to change notification settings - Fork 8.1k
Fix Export-PSSession to not throw error when a rooted path is specified for -OutputModule
#17671
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
…ed for -OutputModule
Co-authored-by: Aditya Patwardhan <adityap@microsoft.com>
|
This PR has Quantification details
Why proper sizing of changes matters
Optimal pull request sizes drive a better predictable PR flow as they strike a
What can I do to optimize my changes
How to interpret the change counts in git diff output
Was this comment helpful? 👍 :ok_hand: :thumbsdown: (Email) |
|
🎉 Handy links: |
|
/backport release/v7.2.6 |
|
/backport to release/v7.0.12 |
|
Started backporting to release/v7.0.12: https://github.com/PowerShell/PowerShell/actions/runs/2784794011
|
|
/backport to release/v7.2.6 |
|
@adityapatwardhan backporting to release/v7.0.12 failed, the patch most likely resulted in conflicts: $ git am --3way --ignore-whitespace --keep-non-patch changes.patch
Applying: Fix Export-PSSession to not throw error when a rooted path is specified for -OutputModule
Applying: Update comment
error: sha1 information is lacking or useless (src/System.Management.Automation/utils/PathUtils.cs).
error: could not build fake ancestor
hint: Use 'git am --show-current-patch=diff' to see the failed patch
Patch failed at 0002 Update comment
When you have resolved this problem, run "git am --continue".
If you prefer to skip this patch, run "git am --skip" instead.
To restore the original branch and stop patching, run "git am --abort".
Error: The process '/usr/bin/git' failed with exit code 128Please backport manually! |
|
Started backporting to release/v7.2.6: https://github.com/PowerShell/PowerShell/actions/runs/2784796745
|
|
🎉 Handy links: |
|
🎉 Handy links: |
PR Summary
The 7.0.10 release contains a commit for a potential security issue: 38e55e1. Here is the announcement about it: PowerShell/Announcements#31.
This particular change from that commit caused a regression in Azure Function when running
Import-Module <module-name> -UseWindowsPowerShell, where the user's module path doesn't exist. That command worked fine with the PowerShell 7.0.9 SDK but started to fail with the PowerShell 7.0.11 SDK.The root cause is that when
Export-PSSessionis used byImport-Module -UseWindowsPowerShell, a rooted path is always specified to the-OutputModuleparameter, so it doesn't matter whether the user's module path exists or not because it doesn't need it to identify the directory to use.The fix is to use the specified rooted path directly. Actually,
Path.Combine(path1, path2)will returnpath2if it's rooted.The error message is also updated:
PR Checklist
.h,.cpp,.cs,.ps1and.psm1files have the correct copyright headerWIP:or[ WIP ]to the beginning of the title (theWIPbot will keep its status check atPendingwhile the prefix is present) and remove the prefix when the PR is ready.