Skip to content

sh.py should not try to execute a folder - #189

Closed
jquast wants to merge 1 commit into
amoffat:masterfrom
jquast:should-not-execute-folders
Closed

jquast wants to merge 1 commit into
amoffat:masterfrom
jquast:should-not-execute-folders

Conversation

@jquast

@jquast jquast commented May 5, 2014

Copy link
Copy Markdown
Contributor

Problem: sh attempts to execute folders because which(1) fails
to determine that although folders may have execute-bit
set, they are not executable by execv(3)-family calls

Symptom: such call is blocking, never returns (!)

Solution: check the target is a file (following symlinks).

Details: The internal which(1) clone will attempt to execute any
folder matching the Command issued. So, given the PATH of:

          /usr/opt/bin/gcc   <- directory
          /usr/bin/gcc       <- executable file

     sh would attempt to execute the folder, /usr/opt/bin/gcc.

[ As executing a folder would cause sh to block indefinitely
(an unhandled OSError is thrown on exec), the test adds a ._path
value assertion first, which prevents this test from hanging when
the fix is un-applied. ]

Problem: sh attempts to execute folders because which(1) fails
         to determine that although folders may have execute-bit
         set, they are not executable by execv(3)-family calls

Symptom: such call is blocking, never returns (!)

Solution: check the target is a file (following symlinks).

Details: The internal which(1) clone will attempt to execute any
         folder matching the Command issued. So, given the PATH of:

              /usr/opt/bin/gcc   <- directory
              /usr/bin/gcc       <- executable file

         sh would attempt to execute the folder, /usr/opt/bin/gcc.

[ As executing a folder would cause sh to block indefinitely
  (an unhandled OSError is thrown on exec), the test adds a ._path
  value assertion first, which prevents this test from hanging when
  the fix is un-applied.  ]
@amoffat

amoffat commented May 5, 2014

Copy link
Copy Markdown
Owner

Good fix, I'll schedule this for the next release

@jquast

jquast commented May 5, 2014

Copy link
Copy Markdown
Contributor Author

glad to help, a little cross-pollination from pexpect :-) pexpect/pexpect#37

@amoffat

amoffat commented Dec 24, 2014

Copy link
Copy Markdown
Owner

merged into release-1.10 branch

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.

2 participants