Bug#677650: Here's a patch that APPEARS to work

sacrificial-spam-address at horizon.com sacrificial-spam-address at horizon.com
Fri Dec 7 05:03:30 UTC 2012


I don't know Ruby AT ALL, but I did a bit of googling and this appears
to make unhide.rb work with 1.9:

--- unhide.rb.orig	2012-12-06 23:53:57.000000000 -0500
+++ unhide.rb	2012-12-06 23:52:51.000000000 -0500
@@ -29,7 +29,11 @@
 # Support for libc functions not covered by the standard Ruby
 # libraries
 module LibC
-  extend DL::Importable
+  if RUBY_VERSION =~ /^1\.8/
+    extend DL::Importable
+  else
+    extend DL::Importer
+  end
   dlload "libc.so.6"
 
   # PID scanning functions
@@ -147,7 +151,7 @@
                     $ps_pids[pid]
                   }],
 
-                 ["/proc", proc { |pid|
+                 ["/proc", lambda { |pid|
                     # Is there a /proc entry for this pid?
                     unless File.directory?("/proc/#{pid}")
                       break

The first hunk changes from DL::Importable to DL::Importer on versions
above 1.8.  Since the only method actually used is extern(), and
the only change in 1.9 is addition optional flags, that's
all the change yo need.

Patch stolen from
https://github.com/mwotton/Hubris/commit/84515473e079e36f799b8210b424d61b7248798a

The second hunk deals with what appears to be a core change between
1.8 and 1.9.  In 1.8, proc was an alias for lambda.  In 1.9, there's a
difference: lambda creates a new function scope (which things like break
and return can jump to), while proc does not (so break and return try
to return from the caller's scope)

Explained at:

http://www.skorks.com/2010/05/ruby-procs-and-lambdas-and-the-difference-between-them/#difference
http://stackoverflow.com/questions/626/when-to-use-lambda-when-to-use-proc-new
http://railspikes.com/2008/9/8/lambda-in-ruby-1-9

The other methods don't use break or return, so there's no need to
change them.  (I presume proc has somewhat less overhead.)



More information about the forensics-devel mailing list