Closed lfigueira closed 11 years ago
are you sure this problem is caused by citeproc-ruby? it looks like you're running this inside rails – could you give me a little more context? (by the way, you should update to 3.2.11 for security reasons!)
basically, i think we should be able to use citeproc-ruby 0.0.x with 1.9.3 (it's 1.8 that would cause problems) – so we should try figuring out what the issue is. if it is too complicated, i'd advise you to wait for the next citeproc release; unfortunately i can't say when i'll find the time to finish the rewrite, but you can always help, too :-)
Hi,
you're quite right - looks like it's something related to Rails - CiteProc works fine when I simply run the ruby console instead of the rails'. Any idea of what I should be searching for? I'm kind of lost here...
(Anyway, I guess I should close this issue, no? Thanks for the help!)
Luis
can you trace the error back to where it originates inside citeproc-ruby? it's a bit weird that you get an error in active record since you're just processing the reference. i'm assuming it has something to do with active support hash extensions.
for example, you could use the debugger to set a breakpoint inside active record's attribute_assignment and do a stack trace from there.
Hi,
I tested the gem on both pristine Rails and Redmine, and it's not an issue with Rails, so it must be something on this new version of Redmine, after all.
While trying to figure out what was happening, this is what I have on the stack right before the call to stringify_keys
:
1.9.3-p125 :017 > CiteProc.process book
[64, 73] in /Users/luisf/.rvm/gems/ruby-1.9.3-p125/gems/activerecord-3.2.11/lib/active_record/attribute_assignment.rb
64 # user.name # => "Josh"
65 # user.is_admin? # => true
66 def assign_attributes(new_attributes, options = {})
67 return if new_attributes.blank?
68 debugger
=> 69 attributes = new_attributes.stringify_keys
70 multi_parameter_attributes = []
71 nested_parameter_attributes = []
72 @mass_assignment_options = options
73
/Users/luisf/.rvm/gems/ruby-1.9.3-p125/gems/activerecord-3.2.11/lib/active_record/attribute_assignment.rb:69 attributes = new_attributes.stringify_keys
(rdb:1) where
#0 ActiveRecord::AttributeAssignment.assign_attributes(new_attributes#CSL::Nodes::Group,...)
at line /Users/luisf/.rvm/gems/ruby-1.9.3-p125/gems/activerecord-3.2.11/lib/active_record/attribute_assignment.rb:69
#1 ActiveRecord::Base.initialize
at line /Users/luisf/.rvm/gems/ruby-1.9.3-p125/gems/activerecord-3.2.11/lib/active_record/base.rb:497
#2 CSL::Nodes.parse
at line /Users/luisf/.rvm/gems/ruby-1.9.3-p125/gems/citeproc-ruby-0.0.6/lib/csl/nodes.rb:24
#3 Nokogiri::XML::NodeSet.each
at line /Users/luisf/.rvm/gems/ruby-1.9.3-p125/gems/nokogiri-1.5.6/lib/nokogiri/xml/node_set.rb:0
#4 Nokogiri::XML::NodeSet.each
at line /Users/luisf/.rvm/gems/ruby-1.9.3-p125/gems/nokogiri-1.5.6/lib/nokogiri/xml/node_set.rb:238
#5 CSL::Nodes::Node.parse(node#Nokogiri::XML::Element)
at line /Users/luisf/.rvm/gems/ruby-1.9.3-p125/gems/citeproc-ruby-0.0.6/lib/csl/nodes.rb:106
#6 CSL::Nodes::Node.initialize
at line /Users/luisf/.rvm/gems/ruby-1.9.3-p125/gems/citeproc-ruby-0.0.6/lib/csl/nodes.rb:85
#7 CSL::Nodes.parse
at line /Users/luisf/.rvm/gems/ruby-1.9.3-p125/gems/citeproc-ruby-0.0.6/lib/csl/nodes.rb:24
#8 Nokogiri::XML::NodeSet.each
at line /Users/luisf/.rvm/gems/ruby-1.9.3-p125/gems/nokogiri-1.5.6/lib/nokogiri/xml/node_set.rb:0
#9 Nokogiri::XML::NodeSet.each
at line /Users/luisf/.rvm/gems/ruby-1.9.3-p125/gems/nokogiri-1.5.6/lib/nokogiri/xml/node_set.rb:238
#10 CSL::Nodes::Node.parse(node#Nokogiri::XML::Element)
at line /Users/luisf/.rvm/gems/ruby-1.9.3-p125/gems/citeproc-ruby-0.0.6/lib/csl/nodes.rb:106
#11 CSL::Nodes::Node.initialize
at line /Users/luisf/.rvm/gems/ruby-1.9.3-p125/gems/citeproc-ruby-0.0.6/lib/csl/nodes.rb:85
#12 CSL::Nodes.parse
at line /Users/luisf/.rvm/gems/ruby-1.9.3-p125/gems/citeproc-ruby-0.0.6/lib/csl/nodes.rb:24
#13 Nokogiri::XML::NodeSet.each
at line /Users/luisf/.rvm/gems/ruby-1.9.3-p125/gems/nokogiri-1.5.6/lib/nokogiri/xml/node_set.rb:0
#14 Nokogiri::XML::NodeSet.each
at line /Users/luisf/.rvm/gems/ruby-1.9.3-p125/gems/nokogiri-1.5.6/lib/nokogiri/xml/node_set.rb:238
#15 CSL::Nodes::Node.parse(node#Nokogiri::XML::Element)
at line /Users/luisf/.rvm/gems/ruby-1.9.3-p125/gems/citeproc-ruby-0.0.6/lib/csl/nodes.rb:106
#16 CSL::Nodes::Node.initialize
at line /Users/luisf/.rvm/gems/ruby-1.9.3-p125/gems/citeproc-ruby-0.0.6/lib/csl/nodes.rb:85
#17 CSL::Nodes.parse
at line /Users/luisf/.rvm/gems/ruby-1.9.3-p125/gems/citeproc-ruby-0.0.6/lib/csl/nodes.rb:24
#18 Nokogiri::XML::NodeSet.each
at line /Users/luisf/.rvm/gems/ruby-1.9.3-p125/gems/nokogiri-1.5.6/lib/nokogiri/xml/node_set.rb:0
#19 Nokogiri::XML::NodeSet.each
at line /Users/luisf/.rvm/gems/ruby-1.9.3-p125/gems/nokogiri-1.5.6/lib/nokogiri/xml/node_set.rb:238
#20 CSL::Nodes::Node.parse(node#Nokogiri::XML::Element)
at line /Users/luisf/.rvm/gems/ruby-1.9.3-p125/gems/citeproc-ruby-0.0.6/lib/csl/nodes.rb:106
#21 CSL::Nodes::Node.initialize
at line /Users/luisf/.rvm/gems/ruby-1.9.3-p125/gems/citeproc-ruby-0.0.6/lib/csl/nodes.rb:85
#22 CSL::Nodes.parse
at line /Users/luisf/.rvm/gems/ruby-1.9.3-p125/gems/citeproc-ruby-0.0.6/lib/csl/nodes.rb:24
#23 Nokogiri::XML::NodeSet.each
at line /Users/luisf/.rvm/gems/ruby-1.9.3-p125/gems/nokogiri-1.5.6/lib/nokogiri/xml/node_set.rb:0
#24 Nokogiri::XML::NodeSet.each
at line /Users/luisf/.rvm/gems/ruby-1.9.3-p125/gems/nokogiri-1.5.6/lib/nokogiri/xml/node_set.rb:238
#25 CSL::Nodes::Node.parse(node#Nokogiri::XML::Element)
at line /Users/luisf/.rvm/gems/ruby-1.9.3-p125/gems/citeproc-ruby-0.0.6/lib/csl/nodes.rb:106
#26 CSL::Nodes::Node.initialize
at line /Users/luisf/.rvm/gems/ruby-1.9.3-p125/gems/citeproc-ruby-0.0.6/lib/csl/nodes.rb:85
#27 CSL::Nodes.parse
at line /Users/luisf/.rvm/gems/ruby-1.9.3-p125/gems/citeproc-ruby-0.0.6/lib/csl/nodes.rb:24
#28 Nokogiri::XML::NodeSet.each
at line /Users/luisf/.rvm/gems/ruby-1.9.3-p125/gems/nokogiri-1.5.6/lib/nokogiri/xml/node_set.rb:0
#29 Nokogiri::XML::NodeSet.each
at line /Users/luisf/.rvm/gems/ruby-1.9.3-p125/gems/nokogiri-1.5.6/lib/nokogiri/xml/node_set.rb:238
#30 CSL::Nodes::Node.parse(node#Nokogiri::XML::Element)
at line /Users/luisf/.rvm/gems/ruby-1.9.3-p125/gems/citeproc-ruby-0.0.6/lib/csl/nodes.rb:106
#31 CSL::Nodes::Node.initialize
at line /Users/luisf/.rvm/gems/ruby-1.9.3-p125/gems/citeproc-ruby-0.0.6/lib/csl/nodes.rb:85
#32 CSL::Nodes.parse
at line /Users/luisf/.rvm/gems/ruby-1.9.3-p125/gems/citeproc-ruby-0.0.6/lib/csl/nodes.rb:24
#33 Nokogiri::XML::NodeSet.each
at line /Users/luisf/.rvm/gems/ruby-1.9.3-p125/gems/nokogiri-1.5.6/lib/nokogiri/xml/node_set.rb:0
#34 Nokogiri::XML::NodeSet.each
at line /Users/luisf/.rvm/gems/ruby-1.9.3-p125/gems/nokogiri-1.5.6/lib/nokogiri/xml/node_set.rb:238
#35 CSL::Nodes::Node.parse(node#Nokogiri::XML::Element)
at line /Users/luisf/.rvm/gems/ruby-1.9.3-p125/gems/citeproc-ruby-0.0.6/lib/csl/nodes.rb:106
#36 CSL::Nodes::Node.initialize
at line /Users/luisf/.rvm/gems/ruby-1.9.3-p125/gems/citeproc-ruby-0.0.6/lib/csl/nodes.rb:85
#37 Nokogiri::XML::NodeSet.each
at line /Users/luisf/.rvm/gems/ruby-1.9.3-p125/gems/nokogiri-1.5.6/lib/nokogiri/xml/node_set.rb:0
#38 Nokogiri::XML::NodeSet.each
at line /Users/luisf/.rvm/gems/ruby-1.9.3-p125/gems/nokogiri-1.5.6/lib/nokogiri/xml/node_set.rb:238
#39 CSL::Style.open(style#String)
at line /Users/luisf/.rvm/gems/ruby-1.9.3-p125/gems/citeproc-ruby-0.0.6/lib/csl/style.rb:36
#40 CSL::Style.initialize
at line /Users/luisf/.rvm/gems/ruby-1.9.3-p125/gems/citeproc-ruby-0.0.6/lib/csl/style.rb:20
#41 CSL.default_style
at line /Users/luisf/.rvm/gems/ruby-1.9.3-p125/gems/citeproc-ruby-0.0.6/lib/citeproc.rb:95
#42 CiteProc::Processor.initialize
at line /Users/luisf/.rvm/gems/ruby-1.9.3-p125/gems/citeproc-ruby-0.0.6/lib/citeproc/processor.rb:19
#43 CiteProc::Processor.process(items#Hash)
at line /Users/luisf/.rvm/gems/ruby-1.9.3-p125/gems/citeproc-ruby-0.0.6/lib/citeproc/processor.rb:18
#44 CiteProc.process
at line /Users/luisf/.rvm/gems/ruby-1.9.3-p125/gems/citeproc-ruby-0.0.6/lib/citeproc.rb:82
#45 IRB::WorkSpace.evaluate(context#IRB::Context, statements#String)
at line /Users/luisf/.rvm/rubies/ruby-1.9.3-p125/lib/ruby/1.9.1/irb/workspace.rb:17
#46 IRB::WorkSpace.evaluate(context#IRB::Context, statements#String)
at line /Users/luisf/.rvm/rubies/ruby-1.9.3-p125/lib/ruby/1.9.1/irb/workspace.rb:80
#47 IRB::Context.evaluate(line#String, line_no#Fixnum)
at line /Users/luisf/.rvm/rubies/ruby-1.9.3-p125/lib/ruby/1.9.1/irb/context.rb:254
#48 IRB::Irb.signal_status(status#Symbol)
at line /Users/luisf/.rvm/rubies/ruby-1.9.3-p125/lib/ruby/1.9.1/irb.rb:159
#49 at line /Users/luisf/.rvm/rubies/ruby-1.9.3-p125/lib/ruby/1.9.1/irb/ruby-lex.rb:156```
I also dug a bit inside citeproc-ruby-0.0.6/lib/csl/nodes.rb:24
: if I print the variable klass
just before the constructor is called, it always prints something on the form CSL::Nodes::Something
, but the last klass to be printed before the breakpoint is simply Comment
(without CSL::Nodes). The contents of my args variable are as follows:
[{"delimiter"=>" ", "node"=>"CSL::Nodes::Group"}, #<Nokogiri::XML::Comment:0x3fe3f149d5f8 "change to label variable=\"section\" as that becomes available ">]
Do you have any idea what I should be searching for? Thanks!
Good job! That's certainly the problem right there; in the new citeproc-ruby we're filtering out XML comments specifically, which, IIRC we did not do in 0.0.6. The question, is why you only run into problems when Redmine is loaded, though. Perhaps it has to do with the version of Nokogiri? Can you check whether or not you're using the same version with and without Redmine?
As a quick work around, you might also try to simply remove the comment from the CSL style.
Hi @inukshuk
(Sorry for the silence, but I got my attention drawn to other projects.)
I've just been checking the versions of nokogiri on the IRC and on the Rails console, and in both I'm using version 1.6.0.
What would the side effects of removing the comment from the CSL style be? I imagine that that it would just ignore the comments, right?
I doubt that there would be any side effects at all from removing the XML comments in the style. Cite processors are not supposed to parse them at all (as I said, in the new citeproc-ruby we're even actively stripping them away).
It works now - many thanks. I will be closing this issue (I should have already done this, given the title is erroneous).
I'm still curious on why this happened... Anyway - many thanks!
Hi,
I've been (very happily) using the citeproc-ruby gem, together with bibtex-ruby, for the last year, until I needed to update my Ruby version to 1.9.3... When I try to process an entry, I get the following:
I know that in the documentation you explicitly say that the version 0.0.x of this gem is not supposed to work on Ruby 1.9.3; I've already tried to run the new citeproc and citeproc-js gems, also with no success (I had issues installing the johnston gem).
I'd be very interested in continuing to use this gem with Ruby 1.9.3 - what are my options (if any)?
Many thanks!
Luis