[MacRuby] #979: Find.find standard library broken in macirb
#979: Find.find standard library broken in macirb -----------------------------+---------------------------------------------- Reporter: lp@… | Owner: lsansonetti@… Type: defect | Status: new Priority: major | Milestone: Component: MacRuby | Keywords: macirb standardlib -----------------------------+---------------------------------------------- in macirb: {{{
require 'find' => true Find.find('.') { |path| puts path } (irb) => nil }}}
the behaviour is ok in interpreted scripts. -- Ticket URL: <http://www.macruby.org/trac/ticket/979> MacRuby <http://macruby.org/>
#979: Find.find standard library broken in macirb -----------------------------+---------------------------------------------- Reporter: lp@… | Owner: eloy.de.enige@… Type: defect | Status: new Priority: major | Milestone: Component: MacRuby | Keywords: macirb standardlib -----------------------------+---------------------------------------------- Changes (by lsansonetti@…): * owner: lsansonetti@… => eloy.de.enige@… Comment: Moving to Eloy for diagnosis. -- Ticket URL: <http://www.macruby.org/trac/ticket/979#comment:1> MacRuby <http://macruby.org/>
#979: Find.find standard library broken in macirb -----------------------------+---------------------------------------------- Reporter: lp@… | Owner: eloy.de.enige@… Type: defect | Status: new Priority: major | Milestone: Component: MacRuby | Keywords: macirb standardlib -----------------------------+---------------------------------------------- Comment(by eloy.de.enige@…): Indeed, but it seems a MacRuby problem, because on 1.9 the code runs fine. I’ll do a bit more debugging to see if I can find the cause. {{{ $ rake19 (in /Users/eloy/code/DietRB) /usr/local/bin/ruby19 -I lib ./bin/dietrb -d -r irb/ext/colorize -r pp irb(main):001:0> require 'find' => true irb(main):002:0> Find.find('.') {|path| puts path } . ./LICENSE ./README.rdoc ./Rakefile ./TODO ./bin ./bin/dietrb ./dietrb.gemspec ./lib ./lib/irb ./lib/irb/completion.rb ./lib/irb/context.rb ./lib/irb/deprecated.rb ./lib/irb/driver ./lib/irb/driver/readline.rb ./lib/irb/driver/socket.rb ./lib/irb/driver/tty.rb ./lib/irb/driver.rb ./lib/irb/ext ./lib/irb/ext/colorize.rb ./lib/irb/ext/completion.rb ./lib/irb/ext/history.rb ./lib/irb/formatter.rb ./lib/irb/source.rb ./lib/irb/version.rb ./lib/irb.rb ./spec ./spec/context_spec.rb ./spec/driver ./spec/driver/readline_spec.rb ./spec/driver/tty_spec.rb ./spec/driver_spec.rb ./spec/ext ./spec/ext/colorize_spec.rb ./spec/ext/completion_spec.rb ./spec/ext/history_spec.rb ./spec/formatter_spec.rb ./spec/regression ./spec/regression/context_spec.rb ./spec/source_spec.rb ./spec/spec_helper.rb ./t.rb => nil irb(main):003:0> }}} -- Ticket URL: <http://www.macruby.org/trac/ticket/979#comment:2> MacRuby <http://macruby.org/>
#979: Find.find standard library broken in macirb -----------------------------+---------------------------------------------- Reporter: lp@… | Owner: eloy.de.enige@… Type: defect | Status: new Priority: major | Milestone: Component: MacRuby | Keywords: macirb standardlib -----------------------------+---------------------------------------------- Comment(by eloy.de.enige@…): I've reduced it a bit more. It seems that requiring the `find.rb' source file *before* anything else makes it work. But if it's required from within the IRB session it breaks, in a catch block, by returning the {{{__FILE__}}} string that was given to eval. The relevant code from find.rb: {{{ $ cat f.rb def find(file) p file catch(:prune) { p file } end }}} Breaks when requiring the file from *within* the IRB session: {{{ $ macirb irb(main):001:0> require 'f' => true irb(main):002:0> find('.') "." "(irb)" }}} Works when requiring the file *before* starting the IRB session: {{{ $ macirb -r f.rb irb(main):001:0> find('.') "." "." }}} -- Ticket URL: <http://www.macruby.org/trac/ticket/979#comment:3> MacRuby <http://macruby.org/>
#979: Find.find standard library broken in macirb -----------------------------+---------------------------------------------- Reporter: lp@… | Owner: lsansonetti@… Type: defect | Status: new Priority: major | Milestone: Component: MacRuby | Keywords: binding __FILE__ -----------------------------+---------------------------------------------- Changes (by eloy.de.enige@…): * keywords: macirb standardlib => binding __FILE__ * owner: eloy.de.enige@… => lsansonetti@… Comment: Ok, more reduction work, no more IRB files are being loaded: {{{ $ cat f.rb def find(file) p file catch(:prune) { p file } end cat t3.rb # Loading the library before evalling makes it work # require "f" source = 'require "f"; find(".")' file = "(foo)" eval(source, TOPLEVEL_BINDING, file) # Renaming the `file' variable makes it all work again # source_file = "(foo)" # eval(source, TOPLEVEL_BINDING, source_file) }}} {{{ $ macruby t3.rb "." "(foo)" }}} With a different variable name than `file': {{{ $ macruby t3.rb "." "." }}} -- Ticket URL: <http://www.macruby.org/trac/ticket/979#comment:4> MacRuby <http://macruby.org/>
#979: Find.find standard library broken in macirb -----------------------------+---------------------------------------------- Reporter: lp@… | Owner: lsansonetti@… Type: defect | Status: new Priority: major | Milestone: Component: MacRuby | Keywords: binding __FILE__ -----------------------------+---------------------------------------------- Comment(by eloy.de.enige@…): PS: Renaming the `file' variable in f.rb works too. So it really seems the lvar is being shared by name. -- Ticket URL: <http://www.macruby.org/trac/ticket/979#comment:5> MacRuby <http://macruby.org/>
#979: Find.find standard library broken in macirb -----------------------------+---------------------------------------------- Reporter: lp@… | Owner: lsansonetti@… Type: defect | Status: new Priority: major | Milestone: Component: MacRuby | Keywords: binding __FILE__ -----------------------------+---------------------------------------------- Comment(by lsansonetti@…): Wow, nice detective work. -- Ticket URL: <http://www.macruby.org/trac/ticket/979#comment:6> MacRuby <http://macruby.org/>
#979: Find.find standard library broken in macirb ------------------------------+--------------------------------------------- Reporter: lp@… | Owner: lsansonetti@… Type: defect | Status: closed Priority: major | Milestone: MacRuby 0.8 Component: MacRuby | Resolution: fixed Keywords: binding __FILE__ | ------------------------------+--------------------------------------------- Changes (by lsansonetti@…): * status: new => closed * resolution: => fixed * milestone: => MacRuby 0.8 Comment: Should be fixed in r4874. -- Ticket URL: <http://www.macruby.org/trac/ticket/979#comment:7> MacRuby <http://macruby.org/>
participants (1)
-
MacRuby