Forum: Ruby-core [ruby-trunk - Bug #6490][Open] The 'printf' method in trace_func is not sent to 'stdout' variable in

Posted by mfojtik (Michal Fojtik) (Guest)
on 2012-05-25 00:19
(Received via mailing list)
Issue #6490 has been reported by mfojtik (Michal Fojtik).

----------------------------------------
Bug #6490: The 'printf' method in trace_func is not sent to 'stdout' 
variable in tracer.rb
https://bugs.ruby-lang.org/issues/6490

Author: mfojtik (Michal Fojtik)
Status: Open
Priority: Normal
Assignee:
Category: lib
Target version: 1.9.3
ruby -v: ruby 1.9.3p194 (2012-04-20 revision 35410) 
[x86_64-darwin11.4.0]


Hi,

lib/tracer.rb:189

  def trace_func(event, file, line, id, binding, klass, *) # :nodoc:
    return if file == __FILE__

    for p in @filters
      return unless p.call event, file, line, id, binding, klass
    end

    return unless Tracer::display_c_call? or
      event != "c-call" && event != "c-return"

    Tracer::stdout_mutex.synchronize do
      if EVENT_SYMBOL[event]
        stdout.printf("<%d>", $$) if Tracer::display_process_id?
        stdout.printf("#%d:", get_thread_no) if 
Tracer::display_thread_id?
        if line == 0
          source = "?\n"
        else
          source = get_line(file, line)
        end
        printf("%s:%d:%s:%s: %s",
               file,
               line,
               klass || '',
               EVENT_SYMBOL[event],
               source)
      end
    end

  end

As you see, the last 'printf' method is not sent to 'stdout' which 
unfortunately leads to have the output of Tracer print
always to STDOUT.
Posted by mfojtik (Michal Fojtik) (Guest)
on 2012-05-25 00:20
(Received via mailing list)
Issue #6490 has been updated by mfojtik (Michal Fojtik).

File 0001-Bug-6490.patch added

Attaching patch.
----------------------------------------
Bug #6490: The 'printf' method in trace_func is not sent to 'stdout' 
variable in tracer.rb
https://bugs.ruby-lang.org/issues/6490#change-26806

Author: mfojtik (Michal Fojtik)
Status: Open
Priority: Normal
Assignee:
Category: lib
Target version: 1.9.3
ruby -v: ruby 1.9.3p194 (2012-04-20 revision 35410) 
[x86_64-darwin11.4.0]


Hi,

lib/tracer.rb:189

  def trace_func(event, file, line, id, binding, klass, *) # :nodoc:
    return if file == __FILE__

    for p in @filters
      return unless p.call event, file, line, id, binding, klass
    end

    return unless Tracer::display_c_call? or
      event != "c-call" && event != "c-return"

    Tracer::stdout_mutex.synchronize do
      if EVENT_SYMBOL[event]
        stdout.printf("<%d>", $$) if Tracer::display_process_id?
        stdout.printf("#%d:", get_thread_no) if 
Tracer::display_thread_id?
        if line == 0
          source = "?\n"
        else
          source = get_line(file, line)
        end
        printf("%s:%d:%s:%s: %s",
               file,
               line,
               klass || '',
               EVENT_SYMBOL[event],
               source)
      end
    end

  end

As you see, the last 'printf' method is not sent to 'stdout' which 
unfortunately leads to have the output of Tracer print
always to STDOUT.
Posted by mame (Yusuke Endoh) (Guest)
on 2012-05-26 18:01
(Received via mailing list)
Issue #6490 has been updated by mame (Yusuke Endoh).

Status changed from Open to Assigned
Assignee set to keiju (Keiju Ishitsuka)


----------------------------------------
Bug #6490: The 'printf' method in trace_func is not sent to 'stdout' 
variable in tracer.rb
https://bugs.ruby-lang.org/issues/6490#change-26847

Author: mfojtik (Michal Fojtik)
Status: Assigned
Priority: Normal
Assignee: keiju (Keiju Ishitsuka)
Category: lib
Target version: 1.9.3
ruby -v: ruby 1.9.3p194 (2012-04-20 revision 35410) 
[x86_64-darwin11.4.0]


Hi,

lib/tracer.rb:189

  def trace_func(event, file, line, id, binding, klass, *) # :nodoc:
    return if file == __FILE__

    for p in @filters
      return unless p.call event, file, line, id, binding, klass
    end

    return unless Tracer::display_c_call? or
      event != "c-call" && event != "c-return"

    Tracer::stdout_mutex.synchronize do
      if EVENT_SYMBOL[event]
        stdout.printf("<%d>", $$) if Tracer::display_process_id?
        stdout.printf("#%d:", get_thread_no) if 
Tracer::display_thread_id?
        if line == 0
          source = "?\n"
        else
          source = get_line(file, line)
        end
        printf("%s:%d:%s:%s: %s",
               file,
               line,
               klass || '',
               EVENT_SYMBOL[event],
               source)
      end
    end

  end

As you see, the last 'printf' method is not sent to 'stdout' which 
unfortunately leads to have the output of Tracer print
always to STDOUT.
Posted by zzak (Zachary Scott) (Guest)
on 2012-11-19 00:55
(Received via mailing list)
Issue #6490 has been updated by zzak (Zachary Scott).

Assignee changed from keiju (Keiju Ishitsuka) to mame (Yusuke Endoh)

mame, could you look at this?

Keiju-san last connection was over 1 year ago.
----------------------------------------
Bug #6490: The 'printf' method in trace_func is not sent to 'stdout' 
variable in tracer.rb
https://bugs.ruby-lang.org/issues/6490#change-33072

Author: mfojtik (Michal Fojtik)
Status: Assigned
Priority: Normal
Assignee: mame (Yusuke Endoh)
Category: lib
Target version: 1.9.3
ruby -v: ruby 1.9.3p194 (2012-04-20 revision 35410) 
[x86_64-darwin11.4.0]


Hi,

lib/tracer.rb:189

  def trace_func(event, file, line, id, binding, klass, *) # :nodoc:
    return if file == __FILE__

    for p in @filters
      return unless p.call event, file, line, id, binding, klass
    end

    return unless Tracer::display_c_call? or
      event != "c-call" && event != "c-return"

    Tracer::stdout_mutex.synchronize do
      if EVENT_SYMBOL[event]
        stdout.printf("<%d>", $$) if Tracer::display_process_id?
        stdout.printf("#%d:", get_thread_no) if 
Tracer::display_thread_id?
        if line == 0
          source = "?\n"
        else
          source = get_line(file, line)
        end
        printf("%s:%d:%s:%s: %s",
               file,
               line,
               klass || '',
               EVENT_SYMBOL[event],
               source)
      end
    end

  end

As you see, the last 'printf' method is not sent to 'stdout' which 
unfortunately leads to have the output of Tracer print
always to STDOUT.
Posted by mame (Yusuke Endoh) (Guest)
on 2012-11-19 19:19
(Received via mailing list)
Issue #6490 has been updated by mame (Yusuke Endoh).

Assignee changed from mame (Yusuke Endoh) to zzak (Zachary Scott)

Looks good to me.  Zachary, could you please apply it to trunk?

I guess that Keiju-san does not read English mail (bad!), so I ask him 
to check your commit in Japanese.

いしつかさん、
Tracer で stdout.printf とすべきところが printf になっちゃってるという報告です。
大丈夫だと思ったので勝手にコミットしてもらうように言ってしまいましたが、問題あったら対処してください。

--
Yusuke Endoh <mame@tsg.ne.jp>
----------------------------------------
Bug #6490: The 'printf' method in trace_func is not sent to 'stdout' 
variable in tracer.rb
https://bugs.ruby-lang.org/issues/6490#change-33120

Author: mfojtik (Michal Fojtik)
Status: Assigned
Priority: Normal
Assignee: zzak (Zachary Scott)
Category: lib
Target version: 1.9.3
ruby -v: ruby 1.9.3p194 (2012-04-20 revision 35410) 
[x86_64-darwin11.4.0]


Hi,

lib/tracer.rb:189

  def trace_func(event, file, line, id, binding, klass, *) # :nodoc:
    return if file == __FILE__

    for p in @filters
      return unless p.call event, file, line, id, binding, klass
    end

    return unless Tracer::display_c_call? or
      event != "c-call" && event != "c-return"

    Tracer::stdout_mutex.synchronize do
      if EVENT_SYMBOL[event]
        stdout.printf("<%d>", $$) if Tracer::display_process_id?
        stdout.printf("#%d:", get_thread_no) if 
Tracer::display_thread_id?
        if line == 0
          source = "?\n"
        else
          source = get_line(file, line)
        end
        printf("%s:%d:%s:%s: %s",
               file,
               line,
               klass || '',
               EVENT_SYMBOL[event],
               source)
      end
    end

  end

As you see, the last 'printf' method is not sent to 'stdout' which 
unfortunately leads to have the output of Tracer print
always to STDOUT.
Please log in before posting. Registration is free and takes only a minute.
Existing account (Switch to SSL-encrypted connection)
NEW: Do you have a Google/GoogleMail or Yahoo account? No registration required!
Log in with Google account | Log in with Yahoo account
No account? Register here.