Skip to content

Commit

Permalink
Be careful about Pathnames in $LOAD_PATH
Browse files Browse the repository at this point in the history
  • Loading branch information
ajbouh committed Jul 22, 2016
1 parent ca38e09 commit 4f2727b
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/qa/runner-assets/ruby/shared.rb
Original file line number Diff line number Diff line change
Expand Up @@ -752,7 +752,7 @@ def summarize_exception(error, backtrace, message=nil)
# ]

backtrace_bindings = error.instance_variable_get(:@__qa_caller_bindings)
load_path = $LOAD_PATH
load_path = $LOAD_PATH.map(&:to_s)

backtrace = backtrace.each_with_index.map do |entry, index|
entry =~ /(.+?):(\d+)(?:\:in `(.*)')?/ || (next nil)
Expand Down
5 changes: 5 additions & 0 deletions src/qa_test/fixtures/ruby/all-outcomes/spec/error_spec.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
# Try to pollute LOAD_PATH.
require 'pathname'

$LOAD_PATH.push(Pathname.new("foo"))

RSpec.describe "Error" do
context "world of errors" do
it "always errors" do
Expand Down

0 comments on commit 4f2727b

Please sign in to comment.