Skip to content

Conversation

@iSazonov
Copy link
Collaborator

@iSazonov iSazonov commented Sep 3, 2018

PR Summary

Address #3572.

On Windows we use file extensions to detect executables. Windows define a list of the extensions in PATHEXT environment variable by default. If the variable is absent Powershell added env:PATHEXT special variable on all platforms. A problem is that on Unix the PATHEXT is not defined by default and is not needed. The fix exclude creating PATHEXT on Unix.

It is a breaking change in grace area - no PowerShell scripts should depend on PATHEXT on Unix.

PR Checklist

@iSazonov iSazonov added the Breaking-Change breaking change that may affect users label Sep 3, 2018
@iSazonov iSazonov self-assigned this Sep 3, 2018
@iSazonov iSazonov requested a review from BrucePay as a code owner September 3, 2018 13:53
@iSazonov iSazonov added the Review - Committee The PR/Issue needs a review from the PowerShell Committee label Sep 3, 2018
@SteveL-MSFT
Copy link
Member

SteveL-MSFT commented Sep 5, 2018

@PowerShell/powershell-committee reviewed this and it seems that $env:PATHEXT can provide utility on Unix systems if the user creates the environment variable. Example is if user has foo.py and wants PowerShell to execute foo, they can use this.

@SteveL-MSFT SteveL-MSFT added Committee-Reviewed PS-Committee has reviewed this and made a decision and removed Review - Committee The PR/Issue needs a review from the PowerShell Committee labels Sep 5, 2018
@iSazonov iSazonov requested a review from rjmholt September 6, 2018 04:10
Copy link
Collaborator

@rjmholt rjmholt left a comment

Choose a reason for hiding this comment

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

LGTM!

Copy link
Member

@SteveL-MSFT SteveL-MSFT left a comment

Choose a reason for hiding this comment

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

Based on @PowerShell/powershell-committee conclusion, we should not make this change as there is utility for an end user to create the PATHEXT env var and use it on non-Windows

@iSazonov
Copy link
Collaborator Author

iSazonov commented Sep 7, 2018

@SteveL-MSFT Your request was addressed.

@iSazonov
Copy link
Collaborator Author

iSazonov commented Sep 7, 2018

CI Appveyor temporary failed.

// Now check the extension and see if it's one of the ones in pathext
#if UNIX

if (Platform.NonWindowsIsExecutable(this.Path))
Copy link
Member

Choose a reason for hiding this comment

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

Why not just:

return Platform.NonWindowsIsExecutable(this.Path);

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

From PowerShell Committee conclusion we should fallback on Unix to read PATHEXT.

Copy link
Member

Choose a reason for hiding this comment

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

Additional code would need to be added to support something like executing foo where foo.py exists and .py was added to PATHEXT on Unix since Windows takes care of this automatically. That is a feature and not bug fix so certainly out of scope of this PR. I'd also wait until there's customer request for such a feature.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@SteveL-MSFT I fixed your request. Tracking issue #7755 .

@iSazonov iSazonov closed this Sep 10, 2018
@iSazonov iSazonov reopened this Sep 10, 2018
@iSazonov
Copy link
Collaborator Author

Reopen the PR to restart CIs.

@mklement0
Copy link
Contributor

@SteveL-MSFT: I don't think PATHEXT fits into the Unix world - please see #7755 (comment)

@iSazonov
Copy link
Collaborator Author

@SteveL-MSFT Please update your review. I believe we can merge.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Breaking-Change breaking change that may affect users Committee-Reviewed PS-Committee has reviewed this and made a decision

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants