LoadError: /opt/oracle/instantclient_10_2/libnnz10.so: cannot restore segment prot after reloc: Permission denied - /usr/local/ruby192p0/lib/ruby/gems/1.9.1/gems/ruby-oci8-2.0.3/lib/oci8lib_191.so
rescue in require'require'
from /usr/local/ruby/bin/irb:12:in `'
/libnnz10.so: cannot restore segment prot after
If you encounter an error like above, the problem very well could be the SELinux (Security Enhanced Linux) conf setting. We ran into this issue trying to use ruby-oci8 in our rails application. It was working on one CentOS VM we built, but not on another coworkers. After painstakingly taking things apart, it turns out the difference between the two virtual machine instances was that the ‘getenforce’ command returned ‘Disabled’ on one and ‘Enforcing’ on another.
A quick ‘setenforce 0’ will enable you to test out if this fixes your issue. However be warned that to disable it so that it doesn’t come back after restarting, you must modify the ‘/etc/selinux/config’ to disable it permanently. GL!
Image by kqedquest
Have you ever wanted to add a method to a class that belonged to a plugin? Well the other day while I was working on articlips.com, I found myself in that position. I am using the acts_as_taggable_on plugin and wanted to memoize a call I was making a lot in various outputs:
<%= tag.name.titleize =>
This is one of those problems I could have solved several ways:
- Focus on normalizing the data on input
- Use a helper to accomplish the same goal
- Cache the page/partial output
- Not worry about it at all, as this is probably not worth the performance gains per effort invested (at the moment I’m sure there’s plenty more I can optimize)
However it was more out of curiosity that I pursued solving it the way that I initially set out to do. My first attempt was simply creating a class of the same name in my models folder, but that didn’t have the effect I wanted as (I believe) because the way rails loads classes, it overwrote the class definition instead of adding to it.
At this point I knew there had to be a better way than just modifying the code in the vendor/plugins folder. Turns out the solution is to add the class/file in the initializers folder as that is the correct time to augment the class during rails initialization. In hindsight, pretty obvious. However since I’m not familiar with the underlying mechanisms of rails as much as I’d like to be, I think I’ve generally overlooked the initializers folder.