cas | 9 ++++++++-
cas.conf | 5 +++++
lib/cas/core.py | 6 ++++--
3 files changed, 17 insertions(+), 3 deletions(-)
New commits:
commit c581b7f84420ef252f06e7c279be5a704aa9a6c0
Author: adam stokes <uzr(a)jak.rebo>
Date: Mon Sep 28 11:27:47 2009 -0400
- add buffersize option
diff --git a/cas b/cas
index f69b68b..f4e3f9d 100755
--- a/cas
+++ b/cas
@@ -38,6 +38,8 @@ if sys.version_info[:2] < (2,3):
raise SystemExit("Python >= 2.3 required")
# Configuration parsing of /etc/cas.conf
+# TODO: rework config read to place all items
+# into a key,value pair automatically
config = ConfigParser.ConfigParser()
config.read("/etc/cas.conf")
WORKDIRECTORY = config.get("settings","workDirectory")
@@ -54,6 +56,11 @@ CRASH_32=None
if config.has_option("advanced", "crash_32"):
CRASH_32=config.get("advanced", "crash_32")
+# Do we have a buffersize
+BUFFERSIZE=None
+if config.has_option("advanced", "buffersize"):
+ BUFFERSIZE=config.get("advanced", "buffersize")
+
class CoreHandler(object):
def __init__(self, filename, dst, logger):
self.filename = filename
@@ -115,7 +122,7 @@ class TimestampHandler(object):
# dig through the buildstamp database and attempt to match it with the
# one found in the core
try:
- coreTimestamp = self.tool.timestamp(self.corefile)
+ coreTimestamp = self.tool.timestamp(self.corefile, BUFFERSIZE)
except CoreException, err:
raise SystemExit(self.casLog.debug(err))
# query timestamp table, return tuple debuginfoRPM, and path to
diff --git a/cas.conf b/cas.conf
index 8df8ac8..1928139 100644
--- a/cas.conf
+++ b/cas.conf
@@ -54,3 +54,8 @@ autoPurge=no
# rpm --relocate /usr/bin=/usr/local/i386 -ivh crash*i386.rpm
# crash_32=/usr/local/i386/crash
+
+# Define a buffersize to be set when reading a core file
+# Valid options are {number, None, or blank}
+# If set to None or blank default will be ~515M
+# buffersize = None
diff --git a/lib/cas/core.py b/lib/cas/core.py
index f4558d5..010ad6f 100644
--- a/lib/cas/core.py
+++ b/lib/cas/core.py
@@ -93,7 +93,7 @@ class CoreBase(object):
return True
return False
- def timestamp(self, path):
+ def timestamp(self, path, blksize):
""" captures fingerprint from core
"""
match='Linux\sversion.*20\d{1,2}|#1\s.*20\d{1,2}'
@@ -102,7 +102,9 @@ class CoreBase(object):
except IOError:
return False
fd.seek(0)
- b = os.read(fd.fileno(),54000000)
+ if not blksize or blksize == "":
+ blksize = 540000000
+ b = os.read(fd.fileno(),blksize)
out = self.util.regexSearch(match, b)
if out:
return out