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

Test of process launching under uri chdir is flawed #3870

Open
headius opened this issue May 10, 2016 · 0 comments
Open

Test of process launching under uri chdir is flawed #3870

headius opened this issue May 10, 2016 · 0 comments

Comments

@headius
Copy link
Member

headius commented May 10, 2016

The following test (from test/jruby/test_backquote.rb) is used to confirm that doing chdir to a uri/url address does not break process launching. The test passes, but only because we attempt to "cd" in the subprocess shell before executing the code, and that just silently fails.

Here's the test:

  def test_backquote_special_commands_and_cwd_inside_classloader
    # not sure why it fails with java-1.6 - assume it is rare feature
    # and works for java-1.7+
    if File.exists?("/bin/echo") and not ENV_JAVA['java.version'].start_with?("1.6.")
      begin
        cwd = Dir.pwd
        Dir.chdir('uri:classloader:/')
        output = `/bin/echo hello`
        assert_equal("hello\n", output)
      ensure
        Dir.chdir(cwd)
      end
    end
  end

This results in stderr output:

sh: line 0: cd: uri:classloader:/: No such file or directory

This also raises questions about correct behavior here:

  • Should the subprocess launch fail if it can't cd to our chosen cwd?
  • Should it succeed at all if we chdir to a uri/url directory? This test implies it should.
  • Should subprocess launching ignore uri/url-like cwd?

cc @mkristian and @kares since they may have some insight on what we should do here.

This test has been disabled in e86ad04.

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

No branches or pull requests

1 participant