Bug #11909
closedio.popen problem in 2.2 and over
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
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
- File prova6.rb prova6.rb added
- File prova2.rb prova2.rb added
- File Result.txt Result.txt added
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
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
Updated by akr (Akira Tanaka) about 8 years ago
- Status changed from Feedback to Rejected