summaryrefslogtreecommitdiffstats
path: root/REPORTING-BUGS
blob: 55a6074ccbb715d99b642fa510d3c993121f453d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
[Some of this is taken from Frohwalt Egerer's original linux-kernel FAQ]

     What follows is a suggested procedure for reporting Linux bugs. You
aren't obliged to use the bug reporting format, it is provided as a guide
to the kind of information that can be useful to developers - no more.

     If the failure includes an "OOPS:" type message in your log or on
screen please read "Documentation/oops-tracing.txt" before posting your
bug report. This explains what you should do with the "Oops" information
to make it useful to the recipient.

      Send the output to the maintainer of the kernel area that seems to
be involved with the problem, and cc the relevant mailing list. Don't
worry too much about getting the wrong person. If you are unsure send it
to the person responsible for the code relevant to what you were doing.
If it occurs repeatably try and describe how to recreate it. That is
worth even more than the oops itself.  The list of maintainers and
mailing lists is in the MAINTAINERS file in this directory.  If you
know the file name that causes the problem you can use the following
command in this directory to find some of the maintainers of that file:
     perl scripts/get_maintainer.pl -f <filename>

      If it is a security bug, please copy the Security Contact listed
in the MAINTAINERS file.  They can help coordinate bugfix and disclosure.
See Documentation/SecurityBugs for more information.

      If you are totally stumped as to whom to send the report, send it to
linux-kernel@vger.kernel.org. (For more information on the linux-kernel
mailing list see http://www.tux.org/lkml/).

This is a suggested format for a bug report sent to the Linux kernel mailing
list. Having a standardized bug report form makes it easier for you not to
overlook things, and easier for the developers to find the pieces of
information they're really interested in. Don't feel you have to follow it.

      First run the ver_linux script included as scripts/ver_linux, which
reports the version of some important subsystems.  Run this script with
the command "sh scripts/ver_linux".

Use that information to fill in all fields of the bug report form, and
post it to the mailing list with a subject of "PROBLEM: <one line
summary from [1.]>" for easy identification by the developers.

[1.] One line summary of the problem:
[2.] Full description of the problem/report:
[3.] Keywords (i.e., modules, networking, kernel):
[4.] Kernel information
[4.1.] Kernel version (from /proc/version):
[4.2.] Kernel .config file:
[5.] Most recent kernel version which did not have the bug:
[6.] Output of Oops.. message (if applicable) with symbolic information
     resolved (see Documentation/oops-tracing.txt)
[7.] A small shell script or example program which triggers the
     problem (if possible)
[8.] Environment
[8.1.] Software (add the output of the ver_linux script here)
[8.2.] Processor information (from /proc/cpuinfo):
[8.3.] Module information (from /proc/modules):
[8.4.] Loaded driver and hardware information (/proc/ioports, /proc/iomem)
[8.5.] PCI information ('lspci -vvv' as root)
[8.6.] SCSI information (from /proc/scsi/scsi)
[8.7.] Other information that might be relevant to the problem
       (please look in /proc and include all information that you
       think to be relevant):
[X.] Other notes, patches, fixes, workarounds:


Thank you
eral.Number */ .highlight .s { color: #dd2200; background-color: #fff0f0 } /* Literal.String */ .highlight .na { color: #336699 } /* Name.Attribute */ .highlight .nb { color: #003388 } /* Name.Builtin */ .highlight .nc { color: #bb0066; font-weight: bold } /* Name.Class */ .highlight .no { color: #003366; font-weight: bold } /* Name.Constant */ .highlight .nd { color: #555555 } /* Name.Decorator */ .highlight .ne { color: #bb0066; font-weight: bold } /* Name.Exception */ .highlight .nf { color: #0066bb; font-weight: bold } /* Name.Function */ .highlight .nl { color: #336699; font-style: italic } /* Name.Label */ .highlight .nn { color: #bb0066; font-weight: bold } /* Name.Namespace */ .highlight .py { color: #336699; font-weight: bold } /* Name.Property */ .highlight .nt { color: #bb0066; font-weight: bold } /* Name.Tag */ .highlight .nv { color: #336699 } /* Name.Variable */ .highlight .ow { color: #008800 } /* Operator.Word */ .highlight .w { color: #bbbbbb } /* Text.Whitespace */ .highlight .mb { color: #0000DD; font-weight: bold } /* Literal.Number.Bin */ .highlight .mf { color: #0000DD; font-weight: bold } /* Literal.Number.Float */ .highlight .mh { color: #0000DD; font-weight: bold } /* Literal.Number.Hex */ .highlight .mi { color: #0000DD; font-weight: bold } /* Literal.Number.Integer */ .highlight .mo { color: #0000DD; font-weight: bold } /* Literal.Number.Oct */ .highlight .sa { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Affix */ .highlight .sb { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Backtick */ .highlight .sc { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Char */ .highlight .dl { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Delimiter */ .highlight .sd { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Doc */ .highlight .s2 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Double */ .highlight .se { color: #0044dd; background-color: #fff0f0 } /* Literal.String.Escape */ .highlight .sh { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Heredoc */ .highlight .si { color: #3333bb; background-color: #fff0f0 } /* Literal.String.Interpol */ .highlight .sx { color: #22bb22; background-color: #f0fff0 } /* Literal.String.Other */ .highlight .sr { color: #008800; background-color: #fff0ff } /* Literal.String.Regex */ .highlight .s1 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Single */ .highlight .ss { color: #aa6600; background-color: #fff0f0 } /* Literal.String.Symbol */ .highlight .bp { color: #003388 } /* Name.Builtin.Pseudo */ .highlight .fm { color: #0066bb; font-weight: bold } /* Name.Function.Magic */ .highlight .vc { color: #336699 } /* Name.Variable.Class */ .highlight .vg { color: #dd7700 } /* Name.Variable.Global */ .highlight .vi { color: #3333bb } /* Name.Variable.Instance */ .highlight .vm { color: #336699 } /* Name.Variable.Magic */ .highlight .il { color: #0000DD; font-weight: bold } /* Literal.Number.Integer.Long */ }
# error-reporting-tool - view definitions
#
# Copyright (C) 2013 Intel Corporation
#
# Licensed under the MIT license, see COPYING.MIT for details

# Create your views here.
# vi: tabstop=8 expandtab shiftwidth=4 softtabstop=4

from __future__ import division
from django.shortcuts import get_object_or_404
from django.shortcuts import HttpResponse, render
from django.views.decorators.csrf import csrf_exempt
from django.shortcuts import redirect
from Post.models import BuildFailure
from parser import Parser
from django.conf import settings
from createStatistics import Statistics
from django.core.paginator import Paginator, EmptyPage
from django.core.exceptions import FieldError
from django.http import JsonResponse
from django.db.models import Q
import json
import urllib

class results_mode():
    LATEST = 0
    SPECIAL_SUBMITTER = 1
    SEARCH = 2
    BUILD = 3

# Any items here are added to the context for all pages
def common_context(request):
    #Make the initial mode state -1 to indicate unset for use in the base template
    ret = {
        'mode' : -1,
    }

    if hasattr(settings, "SPECIAL_SUBMITTER"):
        ret['special_submitter'] = settings.SPECIAL_SUBMITTER

    return ret


@csrf_exempt
def addData(request, return_json=False):
    response = ''
    if request.method == 'POST':
        # Backward compatibility with current send-error-report
        # The data is now in the request body in new django as it's
        # understandingand the data is application/json.
        # The json is url encoded so we need to undo this here.
        # [YOCTO #7245]

        data = request.body[len('data='):]
        data = urllib.unquote_plus(data)

        p = Parser(data)
        result = p.parse(request.META['HTTP_HOST'])


        if return_json:
            response = JsonResponse(result)
        else:
            if not result.has_key('error'):
              response = HttpResponse("Your entry can be found here: "+result['build_url'])
            else:
              response = HttpResponse(result['error'])

        if result.has_key('error'):
          response.status_code=500
    else:
        if return_json:
          response = JsonResponse({ 'error' : 'No valid data provided' },status=500)
        else:
          response = HttpResponse("No valid data provided", status=500)

    return response

def apply_filter(context, items, name, value):
    # Look up the field name for filtering
    # e.g. filter_pair = (RECIPE, value)
    filter_pair = None

    for col in context['tablecols']:
      if col['clclass'] == name:
        filter_pair = (col['field'], value)

    if not filter_pair:
        return items

    items = items.filter(filter_pair)
    return items

def default(request):
    if hasattr(settings, "SPECIAL_SUBMITTER"):
        return redirect(search, mode=results_mode.SPECIAL_SUBMITTER)
    else:
        return redirect(search, mode=results_mode.LATEST)

def search(request, mode=results_mode.LATEST, build_id=None):
    # Default page limit
    limit = 25

    items = BuildFailure.objects.all()

    if request.GET.has_key("limit"):
        try:
            n_limit = int(request.GET['limit'])
            if n_limit > 0:
                limit = n_limit
        except ValueError:
            # just use the Default page limit
            pass

    request.session['limit'] = limit

    # Default page = 1
    page = request.GET.get('page', 1)

    # Default order_by -BUILD__DATE
    order_by = request.GET.get("order_by", '-BUILD__DATE')

    context = {
        'results_mode' : results_mode,
        'mode' : mode,
        'build_id' : build_id,
        'tablecols' : [
        {'name': 'Submitted on',
         'clclass' : 'submitted_on',
         'field' : 'BUILD__DATE',
         'disable_toggle' : True,
        },
        {'name': 'Recipe',
         'clclass' : 'recipe',
         'field' : 'RECIPE',
         'disable_toggle' : True,
        },
        {'name': 'Recipe version',
         'clclass': 'recipe_version',
         'field' : 'RECIPE_VERSION',
        },
        {'name': 'Task',
         'clclass': 'task',
         'field' : 'TASK',
         'disable_toggle' : True,
        },
        {'name': 'Machine',
         'clclass': 'machine',
         'field': 'BUILD__MACHINE',
         'disable_toggle' : True,
        },
        {'name': 'Distro',
         'clclass': 'distro',
         'field': 'BUILD__DISTRO',
         'disable_toggle' : True,
        },
        {'name': 'Build system',
         'clclass': 'build_sys',
         'field': 'BUILD__BUILD_SYS',
        },
        {'name': 'Target system',
         'clclass': 'target_sys',
         'field': 'BUILD__TARGET_SYS',
        },
        {'name': 'Host distro',
         'clclass': 'nativelsbstring',
         'field': 'BUILD__NATIVELSBSTRING',
        },
        {'name': 'Branch',
         'clclass': 'branch',
         'field': 'BUILD__BRANCH',
        },
        {'name': 'Commit',
         'clclass': 'commit',
         'field': 'BUILD__COMMIT',
        },
        {'name': 'Submitter',
         'clclass': 'submitter',
         'field': 'BUILD__NAME',
        }],
    }

    if request.GET.has_key("filter") and request.GET.has_key("type"):
        items = apply_filter(context, items, request.GET['type'], request.GET['filter'])

    if mode == results_mode.SPECIAL_SUBMITTER and hasattr(settings,"SPECIAL_SUBMITTER"):
        #Special submitter mode see settings.py to enable
        name = settings.SPECIAL_SUBMITTER['name']
        items = items.filter(BUILD__NAME__istartswith=name)

    elif mode == results_mode.SEARCH and request.GET.has_key("query"):
        query = request.GET["query"]

        items = items.filter(
                             Q(BUILD__NAME__icontains=query) |
                             Q(BUILD__DISTRO__icontains=query) |
                             Q(BUILD__MACHINE__icontains=query) |
                             Q(RECIPE=query) |
                             Q(BUILD__NATIVELSBSTRING=query) |
                             Q(BUILD__COMMIT__icontains=query) |
                             Q(BUILD__BRANCH__icontains=query) |
                             Q(TASK__icontains=query) |
                             Q(ERROR_DETAILS__icontains=query))

    elif mode == results_mode.BUILD and build_id:
        items = items.filter(BUILD=build_id)

    # Do some special filtering to reduce the QuerySet to a manageable size
    # reversing or ordering the whole queryset is very expensive so we use
    # a range instead and then feed that to the paginator.
    elif mode == results_mode.LATEST and not request.GET.has_key('filter'):
        total = items.count()
        # Get an extra two pages worth to populate the paginator
        try:
            total_from = total - limit*(int(page)+2)
        except:
            total_from = total - limit

        items = items.filter(id__range=(total_from,total))

    # Make sure we get django to do an inner join on our foreign key rather
    # than a query for each item
    items = items.select_related("BUILD").order_by(order_by)

    build_failures = Paginator(items, limit)

    try:
        build_failures = build_failures.page(page)
    except:
        build_failures = build_failures.page(build_failures.num_pages)

    context['build_failures'] = build_failures

    # We don't know if the order_by will be valid right up until the sql
    # query is executed during render so we have to catch an invalid order_by
    # here
    try:
        return render(request, "latest-errors.html", context)
    except FieldError:
        items = items.order_by()
        return render(request, "latest-errors.html", context)





def details(request, fail_id):

    build_failure = BuildFailure.objects.filter(id=fail_id)
    build_failure = build_failure.select_related("BUILD")

    context = {'details' : build_failure }

    return render(request, "error-details.html", context)

@csrf_exempt
def chart(request, template_name, key):
    data=""
    s = Statistics()
    alldata = s.chart_statistics(key)
    if (alldata == {}):
        return HttpResponse("")

    data = json.dumps([{ 'values': list(alldata)}])
    # Replace MACHINE with x and dcount with value
    # We do this in the string as it's more efficient
    data = data.replace(key, "x")
    data = data.replace("dcount", "y")

    context = { 'data' : data,
               'chart_id': key,
              }

    return render(request,
                  "discretebarchart.html",
                  context)