Hi Laura,
Thank you for the patch.
The implementation seems OK to me, but I am not sure if the logic is OK. Perhaps someone more experienced in triaging kernel bugs can verify the component transitions.
Anyway, could you please add a pair of examples to the examples/ directory and add the examples to the following tests:
tests/runtests/oops-processing/runtest.sh
tests/runtests/journal-oops-processing/runtest.sh
Regards,
Jakub
On Tuesday 19 of May 2015 15:53:13 Laura Abbott wrote:
> The kernel is a big project and certain parts of it
> may need to be tracked under different components.
> Fixup results related to those parts and assign a
> different component.
>
> Signed-off-by: Laura Abbott <labbott@fedoraproject.org>
> ---
> This may have other side effects but the goal I'm trying to accomplish
> is get stacktraces related to the graphics drivers assigned to a more
> appropriate component. Here in abrt seemed to be the easiest place to
> adjust it vs. trying to do it in libreport or anywhere else. I'm
> open to suggestions of a better place to put this.
> ---
> .gitignore | 1 +
> abrt.spec.in | 1 +
> configure.ac | 1 +
> src/plugins/Makefile.am | 3 +
> .../abrt-action-check-oops-for-alt-component.in | 86
> ++++++++++++++++++++++ src/plugins/koops_event.conf |
> 3 +
> src/plugins/vmcore_event.conf | 1 +
> 7 files changed, 96 insertions(+)
> create mode 100644 src/plugins/abrt-action-check-oops-for-alt-component.in
>
> diff --git a/.gitignore b/.gitignore
> index 66410cb..f5a93e4 100644
> --- a/.gitignore
> +++ b/.gitignore
> @@ -30,6 +30,7 @@ src/plugins/abrt-action-analyze-python
> src/plugins/abrt-action-analyze-vmcore
> src/plugins/abrt-action-analyze-xorg
> src/plugins/abrt-action-check-oops-for-hw-error
> +src/plugins/abrt-action-check-oops-for-alt-component
> src/plugins/abrt-action-generate-backtrace
> src/plugins/abrt-action-install-debuginfo-to-abrt-cache
> src/plugins/abrt-action-perform-ccpp-analysis
> diff --git a/abrt.spec.in b/abrt.spec.in
> index 0726080..1c41310 100644
> --- a/abrt.spec.in
> +++ b/abrt.spec.in
> @@ -959,6 +959,7 @@ gtk-update-icon-cache %{_datadir}/icons/hicolor
> &>/dev/null || : %endif
> %{_sbindir}/abrt-harvest-vmcore
> %{_bindir}/abrt-action-analyze-vmcore
> +%{_bindir}/abrt-action-check-oops-for-alt-component
> %{_bindir}/abrt-action-check-oops-for-hw-error
> %{_mandir}/man1/abrt-harvest-vmcore.1*
> %{_mandir}/man5/abrt-vmcore.conf.5*
> diff --git a/configure.ac b/configure.ac
> index 6962d2c..802d73e 100644
> --- a/configure.ac
> +++ b/configure.ac
> @@ -416,6 +416,7 @@ AC_CONFIG_FILES([
> src/plugins/abrt-action-install-debuginfo
> src/plugins/abrt-action-analyze-vmcore
> src/plugins/abrt-action-check-oops-for-hw-error
> + src/plugins/abrt-action-check-oops-for-alt-component
> src/python-problem/Makefile
> src/python-problem/doc/Makefile
> src/python-problem/tests/Makefile
> diff --git a/src/plugins/Makefile.am b/src/plugins/Makefile.am
> index d90bb76..aa426ff 100644
> --- a/src/plugins/Makefile.am
> +++ b/src/plugins/Makefile.am
> @@ -74,6 +74,7 @@ PYTHON_FILES = \
> abrt-action-list-dsos \
> abrt-action-analyze-core \
> abrt-action-analyze-vulnerability \
> + abrt-action-check-oops-for-alt-component.in \
> abrt-action-check-oops-for-hw-error.in \
> abrt-action-perform-ccpp-analysis.in \
> abrt-action-notify
> @@ -101,6 +102,7 @@ EXTRA_DIST = \
> if BUILD_ADDON_VMCORE
> bin_SCRIPTS += \
> abrt-action-analyze-vmcore \
> + abrt-action-check-oops-for-alt-component \
> abrt-action-check-oops-for-hw-error
>
> dist_events_DATA += \
> @@ -115,6 +117,7 @@ PYTHON_FILES += \
> EXTRA_DIST += \
> analyze_VMcore.xml.in \
> abrt-action-analyze-vmcore \
> + abrt-action-check-oops-for-alt-component \
> abrt-action-check-oops-for-hw-error
> endif
>
> diff --git a/src/plugins/abrt-action-check-oops-for-alt-component.in
> b/src/plugins/abrt-action-check-oops-for-alt-component.in new file mode
> 100644
> index 0000000..227dbf8
> --- /dev/null
> +++ b/src/plugins/abrt-action-check-oops-for-alt-component.in
> @@ -0,0 +1,86 @@
> +#!/usr/bin/python -u
> +
> +import sys
> +import os
> +import locale
> +import gettext
> +import hashlib
> +import re
> +
> +GETTEXT_PROGNAME = "abrt"
> +
> +_ = gettext.lgettext
> +
> +tags = [
> +"WARNING:",
> +"[ER]IP[^:]",
> +" \[<[a-f0-9]{8,16}>\]"
> +]
> +
> +checks = [
> + ("i915", "xorg-x11-drv-intel"),
> + ("nouveau", "xorg-x11-drv-nouveau"),
> + ("drm", "xorg-x11-drv-intel"),
> +]
> +
> +def check_tag(line):
> + for tag in tags:
> + if re.match(tag, line) is not None:
> + for (mod, component) in checks:
> + if re.search(mod, line) is not None:
> + return component
> + return None
> +
> +def get_new_component(filename):
> + try:
> + f = open(filename, "r")
> + except IOError as e:
> + #print e
> + return None
> + for line in f:
> + c = check_tag(line)
> + if c is not None:
> + f.close()
> + return c
> + f.close()
> + return None
> +
> +def open_or_die(filename, mode):
> + try:
> + f = open(filename, mode)
> + except IOError as e:
> + sys.stderr.write(str(e) + "\n")
> + sys.exit(1)
> + return f
> +
> +
> +if __name__ == "__main__":
> + try:
> + locale.setlocale(locale.LC_ALL, "")
> + except locale.Error:
> + os.environ['LC_ALL'] = 'C'
> + locale.setlocale(locale.LC_ALL, "")
> +
> + # Defeat "AttributeError: 'module' object has no attribute
> 'nl_langinfo'" + try:
> + gettext.bind_textdomain_codeset(GETTEXT_PROGNAME,
> + locale.nl_langinfo(locale.CODESET))
> + except AttributeError:
> + pass
> +
> + gettext.bindtextdomain(GETTEXT_PROGNAME, '/usr/share/locale')
> + gettext.textdomain(GETTEXT_PROGNAME)
> +
> + #
> + # Certain drivers are in the kernel but need to be tracked separtely
> + # in other components. This fixes those components.
> + #
> +
> + new_component = get_new_component("backtrace")
> + print "new component {0}".format(new_component)
> + if new_component is None:
> + sys.exit(0)
> +
> + f = open_or_die("component", "w")
> + f.write(new_component)
> + f.close()
> diff --git a/src/plugins/koops_event.conf b/src/plugins/koops_event.conf
> index 577f62b..6766eb5 100644
> --- a/src/plugins/koops_event.conf
> +++ b/src/plugins/koops_event.conf
> @@ -9,6 +9,9 @@ EVENT=post-create type=Kerneloops
> abrt-action-check-oops-for-hw-error || true
> } &&
> {
> + abrt-action-check-oops-for-alt-component || true
> + } &&
> + {
> # run abrt-action-analyze-oops only if check-hw-error didn't create
> the # required files
> if test ! -f uuid -a ! -f duphash; then
> diff --git a/src/plugins/vmcore_event.conf b/src/plugins/vmcore_event.conf
> index 43fa7f0..6870332 100644
> --- a/src/plugins/vmcore_event.conf
> +++ b/src/plugins/vmcore_event.conf
> @@ -29,6 +29,7 @@ EVENT=post-create type=vmcore
> # Do not fail the event (->do not delete problem dir)
> # if check-oops-for-hw-error exits nonzero:
> { abrt-action-check-oops-for-hw-error || true; }
> + { abrt-action-check-oops-for-alt-component || true; }
>
> # analyze
> EVENT=analyze_VMcore type=vmcore