Vratislav Podzimek (3): Spelling corrections (#865993) Parse component name correctly (#866526) Handle tracebacks with no stack (#866441)
meh/dump.py | 54 +++++++++++++++++++++++++++++++++-------------- ui/exception-dialog.glade | 4 ++-- 2 files changed, 40 insertions(+), 18 deletions(-)
Signed-off-by: Vratislav Podzimek vpodzime@redhat.com --- ui/exception-dialog.glade | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/ui/exception-dialog.glade b/ui/exception-dialog.glade index 6973045..9ae497b 100644 --- a/ui/exception-dialog.glade +++ b/ui/exception-dialog.glade @@ -39,7 +39,7 @@ <object class="GtkLabel" id="titleLabel"> <property name="visible">True</property> <property name="can_focus">False</property> - <property name="label" translatable="yes">An unknown error has occured</property> + <property name="label" translatable="yes">An unknown error has occurred</property> <attributes> <attribute name="weight" value="bold"/> <attribute name="scale" value="1.1000000000000001"/> @@ -67,7 +67,7 @@ <property name="margin_left">40</property> <property name="margin_right">40</property> <property name="label" translatable="yes">This program has encountered an unknown error. You may -report the bug bellow or quit the program.</property> +report the bug below or quit the program.</property> </object> <packing> <property name="expand">False</property>
Thanks to Jakub Filak jfilak@redhat.com for the original version of this patch.
Signed-off-by: Vratislav Podzimek vpodzime@redhat.com --- meh/dump.py | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-)
diff --git a/meh/dump.py b/meh/dump.py index e9779f0..e8988f1 100644 --- a/meh/dump.py +++ b/meh/dump.py @@ -143,7 +143,17 @@ class ExceptionDump(object): "{0}".format(file_)) package = "{0}-{1}-{2}.{3}".format(header["name"], header["version"], header["release"], header["arch"]) - component = header["sourcerpm"].split("-")[0] + + # cuts the name from the NVR format: foo-blah-2.8.8-2.fc17.src.rpm + name_end = len(header["sourcerpm"]) + try: + name_end = header["sourcerpm"].rindex('-') + name_end = header["sourcerpm"][:name_end].rindex('-') + except ValueError as e: + # expected exception + pass + + component = header["sourcerpm"][:name_end]
return (package, component)
Obviously such tracebacks exist.
Signed-off-by: Vratislav Podzimek vpodzime@redhat.com --- meh/dump.py | 42 +++++++++++++++++++++++++++--------------- 1 file changed, 27 insertions(+), 15 deletions(-)
diff --git a/meh/dump.py b/meh/dump.py index e8988f1..a794fc6 100644 --- a/meh/dump.py +++ b/meh/dump.py @@ -174,6 +174,9 @@ class ExceptionDump(object):
""" packages = set() + if not self.stack: + return packages + for (frame, fn, lineno, func, ctx, idx) in self.stack: try: packages.add(get_package_and_component(fn)[0]) @@ -248,6 +251,9 @@ class ExceptionDump(object): return joinfields(lst, "")
def _format_stack(self): + if not self.stack: + return [] + frames = [] for (frame, fn, lineno, func, ctx, idx) in self.stack: if type(ctx) == type([]): @@ -380,7 +386,8 @@ class ExceptionDump(object): # idSkipList can be populated. However since we're not allowed to # modify the results of locals(), we'll have to make a copy first. localVars = copy.copy(locals()) - localVars.update(self.stack[-1][0].f_locals) + if self.stack: + localVars.update(self.stack[-1][0].f_locals)
# Catch attributes that do not exist at the time we do the exception dump # and ignore them. @@ -392,17 +399,19 @@ class ExceptionDump(object):
# Write local variables to the given file descriptor, ignoring any of # the local skips. - frame = self.stack[-1][0] - ret += "\nLocal variables in innermost frame:\n" - try: - for (key, value) in frame.f_locals.items(): - loweredKey = key.lower() - if len(filter(lambda s: loweredKey.find(s) != -1, self.conf.localSkipList)) > 0: - continue + if self.stack: + frame = self.stack[-1][0] + ret += "\nLocal variables in innermost frame:\n" + try: + for (key, value) in frame.f_locals.items(): + loweredKey = key.lower() + if len(filter(lambda s: loweredKey.find(s) != -1, + self.conf.localSkipList)) > 0: + continue
- ret += "%s: %s\n" % (key, value) - except: - pass + ret += "%s: %s\n" % (key, value) + except: + pass
# And now dump the object's attributes. try: @@ -438,10 +447,13 @@ class ExceptionDump(object): import hashlib s = ""
- for (file, lineno, func, text) in [f[1:5] for f in self.stack]: - if type(text) == type([]): - text = "".join(text) - s += "%s %s %s\n" % (os.path.basename(file), func, text) + if self.stack: + for (file, lineno, func, text) in [f[1:5] for f in self.stack]: + if type(text) == type([]): + text = "".join(text) + s += "%s %s %s\n" % (os.path.basename(file), func, text) + else: + s = "%s %s" % (self.type, self.value)
return hashlib.sha256(s).hexdigest()
anaconda-patches@lists.fedorahosted.org