Skip to content
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

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

Closed
wants to merge 1 commit into from
Closed

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

wants to merge 1 commit into from

Conversation

jquast
Copy link
Contributor

@jquast jquast commented May 5, 2014

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
Copy link
Owner

amoffat commented May 5, 2014

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

@jquast
Copy link
Contributor Author

jquast commented May 5, 2014

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

@amoffat
Copy link
Owner

amoffat commented Dec 24, 2014

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