Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: jruby/jruby
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: a71693ee4543
Choose a base ref
...
head repository: jruby/jruby
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: adc4d68f2a15
Choose a head ref
  • 2 commits
  • 2 files changed
  • 1 contributor

Commits on Aug 23, 2016

  1. [Truffle] jtr: always sort output from Dir.glob/Dir[].

    * The order is random, especially on Linux.
    eregon committed Aug 23, 2016
    Copy the full SHA
    950ebe8 View commit details
  2. [Truffle] Always sort paths from Dir.glob and Dir[]

    So they are in consistent order across platforms.
    eregon committed Aug 23, 2016
    Copy the full SHA
    adc4d68 View commit details
Showing with 8 additions and 4 deletions.
  1. +4 −4 lib/ruby/truffle/jruby+truffle/lib/truffle/runner.rb
  2. +4 −0 truffle/src/main/ruby/core/dir.rb
8 changes: 4 additions & 4 deletions lib/ruby/truffle/jruby+truffle/lib/truffle/runner.rb
Original file line number Diff line number Diff line change
@@ -198,7 +198,7 @@ module OptionBlocks

begin
apply_pattern = -> (pattern, old, options) do
Dir.glob(pattern) do |file|
Dir.glob(pattern).sort.each do |file|
if options[:exclude_pattern].any? { |p| /#{p}/ =~ file }
puts "skipped: #{file}"
next
@@ -370,7 +370,7 @@ def initialize(argv, options = {})
@gem_name = if @options[:global][:configuration]
@options[:global][:configuration].to_sym
else
candidates = Dir['*.gemspec']
candidates = Dir['*.gemspec'].sort
if candidates.size == 1
gem_name, _ = candidates.first.split('.')
gem_name.to_sym
@@ -518,7 +518,7 @@ def gemfile_use_path!(gems_path)
gem_name, options = parse_gemfile_line(line)
repo_name = options[:git].split('/').last
repo_match = "#{gems_path}/bundler/gems/#{repo_name}-*"
repo_path = Dir[repo_match].first
repo_path = Dir[repo_match].sort.first

["# Overridden by jtr\n",
'# ' + line,
@@ -623,7 +623,7 @@ def subcommand_run(rest)
end

executable = if @options[:run][:executable]
executables = Dir.glob("#{@options[:global][:truffle_bundle_path]}/jruby+truffle/*/gems/*/{bin,exe}/*")
executables = Dir.glob("#{@options[:global][:truffle_bundle_path]}/jruby+truffle/*/gems/*/{bin,exe}/*").sort
executables.find { |path| File.basename(path) == @options[:run][:executable] } or
raise "no executable with name '#{@options[:run][:executable]}' found"
end
4 changes: 4 additions & 0 deletions truffle/src/main/ruby/core/dir.rb
Original file line number Diff line number Diff line change
@@ -167,6 +167,10 @@ def self.glob(pattern, flags=0, &block)
end
end

# Truffle: ensure glob'd files are always sorted in consistent order,
# it avoids headaches due to platform differences (OS X is sorted, Linux not).
matches.sort!

if block
matches.each(&block)
return nil