Skip to content

Unexpected behavior in command execution when two files have the same basename. #2095

Closed

Description

Steps to reproduce

Create two files

  1. Simple shell script, name it loop and mark it executable
  2. Simple powershell script, name it loop.ps1

Expected behavior

Typing ./loop should launch the program loop

Actual behavior

When you type ./loop you would expect loop (the first file) to execute. It does not, in fact loop.ps1 executes.

Environment data

Name                           Value                                                                         
----                           -----                                                                         
PSVersion                      5.1.10032.0                                                                   
PSEdition                      Linux                                                                         
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}                                                       
BuildVersion                   3.0.0.0                                                                       
GitCommitId                    v0.6.0                                                                        
CLRVersion                                                                                                   
WSManStackVersion              1.0                                                                           
PSRemotingProtocolVersion      2.3                                                                           
SerializationVersion           1.1.0.1       

Activity

  1. added
    WG-Engine
    on Sep 1, 2016
  2. added
    Issue-Bug
    on Sep 6, 2016
  3. joeyaiello commented on Sep 6, 2016

    @joeyaiello
    Contributor

    Heads-up, I edited your comment to wrap $PSVersionTable in a code block.

  4. added
    Issue-Discussion
    on Sep 6, 2016
  5. joeyaiello commented on Sep 6, 2016

    @joeyaiello
    Contributor

    As far as the bug is concerned, that's definitely a problem, but I believe anything we do here is a breaking change that would need to be discussed. /cc @PowerShell/powershell-committee

  6. nocentino commented on Sep 6, 2016

    @nocentino
    Author

    Cool, however I can help please let me know.

  7. andyleejordan commented on Sep 19, 2016

    @andyleejordan
    Member

    This essentially comes down to the ordering of the paths here, which Jason Shirk (@lzybkr), James Truher (@JamesWTruher), and I discussed but I guess came to the wrong conclusion. At least now, I totally agree that foo should be ordered before foo.ps1 (and it before foo.*).

  8. added
    Review - Committee
    and removed
    Review - Committee
    on Oct 28, 2016
  9. added this to the milestone on Nov 2, 2016
  10. SteveL-MSFT commented on Nov 2, 2016

    @SteveL-MSFT
    Member

    @PowerShell/powershell-committee reviewed this and since there is no extension (unlike Windows) to explicitly call the exe, we should make the change to call the native command first before the script

  11. modified the milestones: , on May 25, 2017
  12. added
    Committee-Reviewed
    on May 25, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

Committee-ReviewedIssue-BugIssue-DiscussionResolution-FixedWG-Engine

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions