Advertisement
Guest User

Untitled

a guest
Dec 2nd, 2011
97
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.87 KB | None | 0 0
  1. Hi List,
  2.  
  3. I'm working on a PDF parser using Poppler. Part of the game is to extract the inner links and convert them to a usable format.
  4.  
  5. I'm using that code:
  6. [...]
  7. elsif(action.is_a?(Poppler::ActionGotoDest))
  8. puts "Destination: page_num: %d, top: %f, left: %f, right: %f, zoom: %f, dest: %s" %
  9. [action.dest.page_num, action.dest.top, action.dest.left, action.dest.right, action.dest.zoom, action.dest.named_dest]
  10. namedDest = action.dest.named_dest
  11. puts namedDest
  12. if (namedDest != nil) then
  13. dest = @poppler.find_dest(namedDest)
  14. end
  15. end
  16. [...]
  17.  
  18. to handle the ActionGotoDest links.
  19.  
  20. However, when running it, I get a segfault with the following stack trace:
  21.  
  22. crackpot:~/ruby/pdfparser$ ruby1.9.1 runtime.rb
  23. Page: 1, width: 612, height: 792
  24. x1: 0.152242, x2: 0.327596, y1: 0.125557, y2: 0.139822, action: #<Poppler::ActionUri:0x000000024761f0>
  25. URI: http://xxx.lanl.gov/hypertex/
  26. x1: 0.789634, x2: 0.846529, y1: 0.140740, y2: 0.154917, action: #<Poppler::ActionUri:0x00000002475f20>
  27. URI: http://xxx.lanl.gov/hypertex/
  28. x1: 0.152242, x2: 0.463363, y1: 0.212577, y2: 0.223999, action: #<Poppler::ActionGotoDest:0x00000002520b50>
  29. Destination: page_num: 0, top: 0.000000, left: 0.000000, right: 0.000000, zoom: 0.000000, dest: section.10
  30. section.10
  31. /home/chloe/ruby/pdfparser/PDFParser.rb:83: [BUG] Segmentation fault
  32. ruby 1.9.2p290 (2011-07-09 revision 32553) [x86_64-linux]
  33.  
  34. -- control frame ----------
  35. c:0011 p:---- s:0044 b:0044 l:000043 d:000043 CFUNC :find_dest
  36. c:0010 p:0371 s:0040 b:0040 l:000010 d:000039 BLOCK /home/chloe/ruby/pdfparser/PDFParser.rb:83
  37. c:0009 p:---- s:0029 b:0029 l:000028 d:000028 FINISH
  38. c:0008 p:---- s:0027 b:0027 l:000026 d:000026 CFUNC :each
  39. c:0007 p:0092 s:0024 b:0024 l:000010 d:000023 BLOCK /home/chloe/ruby/pdfparser/PDFParser.rb:67
  40. c:0006 p:---- s:0016 b:0016 l:000015 d:000015 FINISH
  41. c:0005 p:---- s:0014 b:0014 l:000013 d:000013 CFUNC :each
  42. c:0004 p:0088 s:0011 b:0011 l:000010 d:000010 METHOD /home/chloe/ruby/pdfparser/PDFParser.rb:61
  43. c:0003 p:0065 s:0007 b:0007 l:0005d8 d:000f40 EVAL runtime.rb:8
  44. c:0002 p:---- s:0004 b:0004 l:000003 d:000003 FINISH
  45. c:0001 p:0000 s:0002 b:0002 l:0005d8 d:0005d8 TOP
  46. ---------------------------
  47. -- Ruby level backtrace information ----------------------------------------
  48. runtime.rb:8:in `<main>'
  49. /home/chloe/ruby/pdfparser/PDFParser.rb:61:in `DumpLinks'
  50. /home/chloe/ruby/pdfparser/PDFParser.rb:61:in `each'
  51. /home/chloe/ruby/pdfparser/PDFParser.rb:67:in `block in DumpLinks'
  52. /home/chloe/ruby/pdfparser/PDFParser.rb:67:in `each'
  53. /home/chloe/ruby/pdfparser/PDFParser.rb:83:in `block (2 levels) in DumpLinks'
  54. /home/chloe/ruby/pdfparser/PDFParser.rb:83:in `find_dest'
  55.  
  56. -- C level backtrace information -------------------------------------------
  57. /usr/lib/libruby-1.9.1.so.1.9(rb_vm_bugreport+0x61) [0x7f544a838db1]
  58. /usr/lib/libruby-1.9.1.so.1.9(+0x592fe) [0x7f544a7402fe]
  59. /usr/lib/libruby-1.9.1.so.1.9(rb_bug+0xa5) [0x7f544a740d55]
  60. /usr/lib/libruby-1.9.1.so.1.9(+0xf3c84) [0x7f544a7dac84]
  61. /lib/x86_64-linux-gnu/libc.so.6(+0x36420) [0x7f544a37e420]
  62. /usr/lib/ruby/vendor_ruby/1.9.1/x86_64-linux/glib2.so(rbgobj_ruby_object_from_instance2+0x1a) [0x7f5448d6d13a]
  63. /usr/lib/ruby/vendor_ruby/1.9.1/x86_64-linux/poppler.so(+0xb366) [0x7f54409f1366]
  64. /usr/lib/libruby-1.9.1.so.1.9(+0x14aac6) [0x7f544a831ac6]
  65. /usr/lib/libruby-1.9.1.so.1.9(+0x141806) [0x7f544a828806]
  66. /usr/lib/libruby-1.9.1.so.1.9(+0x14743d) [0x7f544a82e43d]
  67. /usr/lib/libruby-1.9.1.so.1.9(rb_yield+0x26e) [0x7f544a833f2e]
  68. /usr/lib/libruby-1.9.1.so.1.9(rb_ary_each+0x46) [0x7f544a7177d6]
  69. /usr/lib/libruby-1.9.1.so.1.9(+0x14aac6) [0x7f544a831ac6]
  70. /usr/lib/libruby-1.9.1.so.1.9(+0x141806) [0x7f544a828806]
  71. /usr/lib/libruby-1.9.1.so.1.9(+0x14743d) [0x7f544a82e43d]
  72. /usr/lib/libruby-1.9.1.so.1.9(rb_yield+0x26e) [0x7f544a833f2e]
  73. /usr/lib/ruby/vendor_ruby/1.9.1/x86_64-linux/poppler.so(+0xb270) [0x7f54409f1270]
  74. /usr/lib/libruby-1.9.1.so.1.9(+0x14aac6) [0x7f544a831ac6]
  75. /usr/lib/libruby-1.9.1.so.1.9(+0x141806) [0x7f544a828806]
  76. /usr/lib/libruby-1.9.1.so.1.9(+0x14743d) [0x7f544a82e43d]
  77. /usr/lib/libruby-1.9.1.so.1.9(rb_iseq_eval_main+0xb2) [0x7f544a835432]
  78. /usr/lib/libruby-1.9.1.so.1.9(+0x5d4a2) [0x7f544a7444a2]
  79. /usr/lib/libruby-1.9.1.so.1.9(ruby_exec_node+0x1d) [0x7f544a744f9d]
  80. /usr/lib/libruby-1.9.1.so.1.9(ruby_run_node+0x1e) [0x7f544a746bde]
  81. ruby1.9.1(main+0x4b) [0x4007fb]
  82. /lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xed) [0x7f544a36930d]
  83. ruby1.9.1() [0x400829]
  84.  
  85. [NOTE]
  86. You may have encountered a bug in the Ruby interpreter or extension libraries.
  87. Bug reports are welcome.
  88. For details: http://www.ruby-lang.org/bugreport.html
  89.  
  90. Aborted
  91.  
  92.  
  93. The PDF document I use for test purpose is:
  94. ftp://tug.ctan.org/tex-archive/macros/latex/contrib/hyperref/doc/manual.pdf
  95.  
  96. My Ruby:
  97. crackpot:~/ruby/pdfparser$ ruby1.9.1 -v
  98. ruby 1.9.2p290 (2011-07-09 revision 32553) [x86_64-linux]
  99.  
  100. My ruby-gtk2:
  101.  
  102. Package: ruby-gtk2
  103. New: yes
  104. State: installed
  105. Automatically installed: no
  106. Version: 1.0.0-1
  107. Priority: optional
  108. Section: universe/ruby
  109. Maintainer: Ubuntu Developers <[email protected]>
  110. Uncompressed Size: 3,318 k
  111. Depends: libc6 (>= 2.4), libcairo2 (>= 1.2.4), libgdk-pixbuf2.0-0 (>= 2.22.0), libglib2.0-0 (>= 2.24.0), libgtk2.0-0 (>= 2.20.0), libpango1.0-0 (>= 1.14.0), libruby1.8 (>= 1.8.7.352), libruby1.9.1 (>= 1.9.2.290), libx11-6, ruby-atk (= 1.0.0-1), ruby-pango (= 1.0.0-1),
  112. ruby-gdk-pixbuf2 (= 1.0.0-1)
  113. Conflicts: libgda-ruby1.8, libgda-ruby1.8, libgtk-trayicon-ruby1.8, libgtk-trayicon-ruby1.8, ruby-gtk2
  114. Breaks: libgtk2-ruby (< 0.90.9-1~), libgtk2-ruby (< 0.90.9-1~), libgtk2-ruby1.8 (< 0.90.9-1~), libgtk2-ruby1.8 (< 0.90.9-1~)
  115. Replaces: libgtk-trayicon-ruby1.8, libgtk-trayicon-ruby1.8, libgtk2-ruby (< 0.90.9-1~), libgtk2-ruby (< 0.90.9-1~), libgtk2-ruby1.8 (< 0.90.9-1~), libgtk2-ruby1.8 (< 0.90.9-1~)
  116. Provides: libgtk2-ruby, libgtk2-ruby1.8
  117. Description: GTK+ bindings for the Ruby language
  118. GTK+ is a library for creating graphical user interfaces. This package contains libraries for using GTK+ with the Ruby programming language.
  119. Homepage: http://ruby-gnome2.sourceforge.jp/
  120.  
  121. My ruby-poppler:
  122.  
  123. Package: ruby-poppler
  124. New: yes
  125. State: installed
  126. Automatically installed: no
  127. Version: 1.0.0-1
  128. Priority: optional
  129. Section: universe/ruby
  130. Maintainer: Ubuntu Developers <[email protected]>
  131. Uncompressed Size: 246 k
  132. Depends: libc6 (>= 2.2.5), libglib2.0-0 (>= 2.12.0), libgtk2.0-0 (>= 2.8.0), libpoppler-glib6 (>= 0.16), libruby1.8 (>= 1.8.7.352), libruby1.9.1 (>= 1.9.2.290)
  133. Conflicts: ruby-poppler
  134. Description: Ruby bindinds for the libpoppler-glib library
  135. Poppler is a PDF rendering library based on xpdf PDF viewer. This package contains ruby bindings for Poppler.
  136. Homepage: http://ruby-gnome2.sourceforge.jp/
  137.  
  138. Any insight about this and how it could be solved?
  139.  
  140. Yours sincerely
  141. ChloeD
  142.  
  143.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement