-
Notifications
You must be signed in to change notification settings - Fork 3.4k
HBASE-28250 Bump jruby to 9.4.8.0 to fix snakeyaml CVE #6127
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
Merged
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -53,18 +53,21 @@ def initialize(workspace = nil, interactive = true, input_method = nil) | |
| $stdout = STDOUT | ||
| end | ||
|
|
||
| def output_value | ||
| def output_value(omit = false) | ||
| # Suppress output if last_value is 'nil' | ||
| # Otherwise, when user types help, get ugly 'nil' | ||
| # after all output. | ||
| super unless @context.last_value.nil? | ||
| super(omit) unless @context.last_value.nil? | ||
| end | ||
|
|
||
| # Copied from irb.rb and overrides the rescue Exception block so the | ||
| # Copied from https://github.com/ruby/irb/blob/v1.4.2/lib/irb.rb | ||
| # We override the rescue Exception block so the | ||
| # Shell::exception_handler can deal with the exceptions. | ||
| def eval_input | ||
| exc = nil | ||
|
|
||
| @scanner.set_prompt do | ||
| |ltype, indent, continue, line_no| | ||
| |ltype, indent, continue, line_no| | ||
| if ltype | ||
| f = @context.prompt_s | ||
| elsif continue | ||
|
|
@@ -80,17 +83,19 @@ def eval_input | |
| else | ||
| @context.io.prompt = p = "" | ||
| end | ||
| if @context.auto_indent_mode | ||
| if @context.auto_indent_mode and [email protected]_to?(:auto_indent) | ||
| unless ltype | ||
| ind = prompt(@context.prompt_i, ltype, indent, line_no)[/.*\z/].size + | ||
| prompt_i = @context.prompt_i.nil? ? "" : @context.prompt_i | ||
| ind = prompt(prompt_i, ltype, indent, line_no)[/.*\z/].size + | ||
| indent * 2 - p.size | ||
| ind += 2 if continue | ||
| @context.io.prompt = p + " " * ind if ind > 0 | ||
| end | ||
| end | ||
| @context.io.prompt | ||
| end | ||
|
|
||
| @scanner.set_input(@context.io) do | ||
| @scanner.set_input(@context.io, context: @context) do | ||
| signal_status(:IN_INPUT) do | ||
| if l = @context.io.gets | ||
| print l if @context.verbose? | ||
|
|
@@ -101,24 +106,51 @@ def eval_input | |
| printf "Use \"exit\" to leave %s\n", @context.ap_name | ||
| end | ||
| else | ||
| print "\n" | ||
| print "\n" if @context.prompting? | ||
| end | ||
| end | ||
| l | ||
| end | ||
| end | ||
|
|
||
| @scanner.set_auto_indent(@context) if @context.auto_indent_mode | ||
|
|
||
| @scanner.each_top_level_statement do |line, line_no| | ||
| signal_status(:IN_EVAL) do | ||
| begin | ||
| line.untaint | ||
| @context.evaluate(line, line_no) | ||
| output_value if @context.echo? | ||
| exc = nil | ||
| line.untaint if RUBY_VERSION < '2.7' | ||
| if IRB.conf[:MEASURE] && IRB.conf[:MEASURE_CALLBACKS].empty? | ||
| IRB.set_measure_callback | ||
| end | ||
| if IRB.conf[:MEASURE] && !IRB.conf[:MEASURE_CALLBACKS].empty? | ||
| result = nil | ||
| last_proc = proc{ result = @context.evaluate(line, line_no, exception: exc) } | ||
| IRB.conf[:MEASURE_CALLBACKS].inject(last_proc) { |chain, item| | ||
| _name, callback, arg = item | ||
| proc { | ||
| callback.(@context, line, line_no, arg, exception: exc) do | ||
| chain.call | ||
| end | ||
| } | ||
| }.call | ||
| @context.set_last_value(result) | ||
| else | ||
| @context.evaluate(line, line_no, exception: exc) | ||
| end | ||
| if @context.echo? | ||
| if assignment_expression?(line) | ||
| if @context.echo_on_assignment? | ||
| output_value(@context.echo_on_assignment? == :truncate) | ||
| end | ||
| else | ||
| output_value | ||
| end | ||
| end | ||
| rescue Interrupt => exc | ||
| rescue SystemExit, SignalException | ||
| raise | ||
| rescue SyntaxError => exc | ||
| # HBASE-27726: Ignore SyntaxError to prevent exiting Shell on unexpected syntax. | ||
| raise exc unless @interactive | ||
| rescue NameError => exc | ||
| raise exc unless @interactive | ||
|
|
@@ -128,43 +160,13 @@ def eval_input | |
| # This modifies this copied method from JRuby so that the HBase shell can | ||
| # manage the exception and set a proper exit code on the process. | ||
| raise exc | ||
| else | ||
| exc = nil | ||
| next | ||
| end | ||
| if exc | ||
| if exc.backtrace && exc.backtrace[0] =~ /irb(2)?(\/.*|-.*|\.rb)?:/ && exc.class.to_s !~ /^IRB/ && | ||
| !(SyntaxError === exc) | ||
| irb_bug = true | ||
| else | ||
| irb_bug = false | ||
| end | ||
|
|
||
| messages = [] | ||
| lasts = [] | ||
| levels = 0 | ||
| if exc.backtrace | ||
| count = 0 | ||
| exc.backtrace.each do |m| | ||
| m = @context.workspace.filter_backtrace(m) or next unless irb_bug | ||
| m = sprintf("%9d: from %s", (count += 1), m) | ||
| if messages.size < @context.back_trace_limit | ||
| messages.push(m) | ||
| elsif lasts.size < @context.back_trace_limit | ||
| lasts.push(m).shift | ||
| levels += 1 | ||
| end | ||
| end | ||
| end | ||
| attr = STDOUT.tty? ? ATTR_TTY : ATTR_PLAIN | ||
| print "#{attr[1]}Traceback#{attr[]} (most recent call last):\n" | ||
| unless lasts.empty? | ||
| puts lasts.reverse | ||
| printf "... %d levels...\n", levels if levels > 0 | ||
| end | ||
| puts messages.reverse | ||
| messages = exc.to_s.split(/\n/) | ||
| print "#{attr[1]}#{exc.class} (#{attr[4]}#{messages.shift}#{attr[0, 1]})#{attr[]}\n" | ||
| puts messages.map {|s| "#{attr[1]}#{s}#{attr[]}\n"} | ||
| print "Maybe IRB bug!\n" if irb_bug | ||
| end | ||
| handle_exception(exc) | ||
| @context.workspace.local_variable_set(:_, exc) | ||
| exc = nil | ||
| end | ||
| end | ||
| end | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
jcoding and joni changes were not needed, hence no change around that here