Project

General

Profile

Actions

Bug #11909

closed

io.popen problem in 2.2 and over

Added by pierisimone (Simone Pieri) almost 9 years ago. Updated about 8 years ago.

Status:
Rejected
Target version:
-
ruby -v:
ruby 2.2.4p230 (2015-12-16 revision 53155) [x86_64-linux]
Backport:
[ruby-core:72557]

Description

Hi, I have a ruby program (prova5.rb) that contains libxml prase and a find. With Ruby 2.1.8 I have no problem, even if I execute it via "ruby prova5.rb" than if I execute it via io.popen in prova2.rb.

In a 2.2.4 environment I have success if I execute "ruby prova5.rb", but xml find stucks if I execute it via prova2.rb.

I attach prova5.rb, prova2.rb out218.txt and out224.txt.

Same problem in all 2.2 versions.

Thanks


Files

prova5.rb (334 Bytes) prova5.rb pierisimone (Simone Pieri), 12/28/2015 03:36 PM
prova2.rb (269 Bytes) prova2.rb pierisimone (Simone Pieri), 12/28/2015 03:36 PM
out218.txt (292 Bytes) out218.txt pierisimone (Simone Pieri), 12/28/2015 03:38 PM
out224.txt (280 Bytes) out224.txt pierisimone (Simone Pieri), 12/28/2015 03:41 PM
prova6.rb (241 Bytes) prova6.rb pierisimone (Simone Pieri), 12/30/2015 10:09 AM
prova2.rb (184 Bytes) prova2.rb pierisimone (Simone Pieri), 12/30/2015 10:10 AM
Result.txt (235 Bytes) Result.txt pierisimone (Simone Pieri), 12/30/2015 10:14 AM

Updated by nobu (Nobuyoshi Nakada) almost 9 years ago

  • Status changed from Open to Feedback

Since I haven't installed libxml, tried with mere puts, and couldn't reproduce it.
Can you reproduce it without libxml?

Updated by pierisimone (Simone Pieri) almost 9 years ago

Hi,
our problem is that we really need libxml, so it's not interesting to try without....

Updated by pierisimone (Simone Pieri) almost 9 years ago

  • Assignee set to nobu (Nobuyoshi Nakada)

Updated by nobu (Nobuyoshi Nakada) almost 9 years ago

We have to tell if libxml is mandatory to reproduce it or not.

Updated by duerst (Martin Dürst) almost 9 years ago

Simone Pieri wrote:

our problem is that we really need libxml, so it's not interesting to try without....

Ruby is an open source project. We depend on help from everybody; we don't have the time to do the heavy lifting for you. Many of the core contributors are very ready to help if you are also ready to help. If you can't reproduce the problem without libxml, then the problem may be with libxml itself, so this may be the wrong place to report it.

Updated by pierisimone (Simone Pieri) almost 9 years ago

OK, excuse me, we have a problem with libxml if it's called via io.popen. I don't want any "heavy lifting" for me ...
I can't reproduce the problem without libxml because I don't have a problem without libxml, like Nobuyoshi says. And ok, libxml is mandatory to reproduce it. And no, Martin, the problem isn't with libxml itself, if you launch "ruby prova5.rb" all is ok... The problem is that if you launch "ruby prova2.rb" (that executes prova5.rb via io.popen) you have the problem. So, I think that the problem is in libxml when it's invoked by io.popen. But Martin, if it's only a waste of your precious time, leave it unresolved and watch beyond. I'll continue to try to resolve the problem and, if I find solution, I'll post here.
Best regards

Updated by pierisimone (Simone Pieri) almost 9 years ago

Hi all, I have a confirmation... The problem is with libxml-ruby invoked by io.popen. If we try with Nokogiri all is ok.
So, do you think I have to submit the problem to libxml-ruby gem team or do you think it may be a problem related to io.popen ?

I attach some files to reproduce and document it.

Updated by jwille (Jens Wille) almost 9 years ago

I don't have time to investigate further right now, but the problem is that the output of prova5.rb gets buffered. The find and everything else executes just fine. You can work around this problem by adding $stdout.sync = true at the beginning of your script or by adding $stdout.flush at the end.

Updated by jwille (Jens Wille) almost 9 years ago

Associated libxml-ruby issue: #115.

Related libxml-ruby issue: #109 (executing test.rb via IO.popen exhibits the same problem).

Updated by pierisimone (Simone Pieri) almost 9 years ago

Hi all and thanks to Jens !
If I add $stdout.sync at the beginning of prova5.rb and $stdout.flush at the end all runs OK !!!!

Yesterday we substitute our logic with Nokogiri, but now we can return back to libxml-ruby (it's faster...).

Thanks a lot, we can close this issue

Actions #11

Updated by akr (Akira Tanaka) about 8 years ago

  • Status changed from Feedback to Rejected
Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0