Bug 8472

Summary: [1.8] Downloading artifacts fails with error page
Product: [Build System, Metadata & Runtime] Toaster Reporter: Mihail Stanciu <stanciux.mihail>
Component: toasterAssignee: Elliot Smith <elliot.smith>
Status: RESOLVED FIXED QA Contact: Mihail Stanciu <stanciux.mihail>
Severity: normal    
Priority: Medium CC: belen.barros.pena, jessica.zhang, stanciux.mihail
Version: 1.8.1   
Target Milestone: 1.8.2   
Hardware: x86   
OS: Multiple   
See Also: https://bugzilla.yoctoproject.org/show_bug.cgi?id=8369
Whiteboard:
OS type for building Yocto: --- Type of Regression: Regression (Used to work)
Verified: Documentation change: No (bug/feature does not impact docs)

Description Mihail Stanciu 2015-10-09 13:01:15 UTC
Tested on 1.8.1: b74ea963cefffad9fbd91d4eb9b240f6a8c86cd0
OS: Ubuntu 15.04, Fedora 22

Steps:
1. Open toaster.
2. Create project & build an image (core-image-minimal)
3. Once image finishes, go to build summary page and try to download any artifact resulted from the build, or the build log.

Expected:
Download begins.

Observed:
Toaster throws up an error page.

Error log:
Environment:


Request Method: GET
Request URL: http://localhost:8000/toastergui/build/2/artifact/imagefile/id/5

Django Version: 1.6
Python Version: 2.7.9
Installed Applications:
('django.contrib.auth',
 'django.contrib.contenttypes',
 'django.contrib.messages',
 'django.contrib.sessions',
 'django.contrib.admin',
 'django.contrib.staticfiles',
 'django.contrib.humanize',
 'orm',
 'toastermain',
 'south',
 'bldcontrol',
 'bldviewer',
 'toastergui')
Installed Middleware:
('django.middleware.common.CommonMiddleware',
 'django.contrib.sessions.middleware.SessionMiddleware',
 'django.middleware.csrf.CsrfViewMiddleware',
 'django.contrib.auth.middleware.AuthenticationMiddleware',
 'django.contrib.messages.middleware.MessageMiddleware')


Traceback:
File "/usr/local/lib/python2.7/dist-packages/django/core/handlers/base.py" in get_response
  114.                     response = wrapped_callback(request, *callback_args, **callback_kwargs)
File "/home/dave/FP_1.8.1/poky/bitbake/lib/toaster/toastergui/views.py" in build_artifact
  3196.             return _get_be_artifact(request, build_id, artifact_type, artifact_id)
File "/home/dave/FP_1.8.1/poky/bitbake/lib/toaster/toastergui/views.py" in _get_be_artifact
  3212.                 content_type = b.buildrequest.environment.get_artifact_type(file_name)
File "/home/dave/FP_1.8.1/poky/bitbake/lib/toaster/bldcontrol/models.py" in get_artifact_type
  59.                     m = magic.Magic(magic.MAGIC_MIME)
File "/usr/local/lib/python2.7/dist-packages/magic/identify.py" in __init__
  66.         pathstr = b':'.join(iter_encode(paths)) if paths else None
File "/usr/local/lib/python2.7/dist-packages/magic/compatability.py" in iter_encode
  40.     for item in iterable:

Exception Type: TypeError at /toastergui/build/2/artifact/imagefile/id/5
Exception Value: 'int' object is not iterable
Comment 1 Elliot Smith 2015-10-09 13:30:32 UTC
Please test on toaster-next, as this bug should be fixed there, but the commits have not yet made it to master (see bug 8369).
Comment 2 Elliot Smith 2015-10-09 13:31:43 UTC
This error message is the same as the one in bug 8369 and has the same root cause.

*** This bug has been marked as a duplicate of bug 8369 ***
Comment 3 Mihail Stanciu 2015-10-09 14:13:57 UTC
Reopening. Waiting for confirmation if fix will be back-ported.
Comment 4 Elliot Smith 2015-10-13 08:43:10 UTC
The necessary patches are dd957fe0f261db6481882fee0413f459425000c2 and ce9011a9dea4d4f8040170c28031cfbcadfbfd81 on poky master, if we decide to backport them.
Comment 5 Elliot Smith 2015-10-15 09:35:25 UTC
I've had a quick look, and think it should be fairly trivial to backport this to 1.8.
Comment 6 Stephen K Jolley 2015-11-18 16:44:56 UTC
This has been REOPENED
Comment 7 Elliot Smith 2015-12-01 16:28:35 UTC
My branch is here:

poky-contrib, elliot/toaster/backport_mimetype_fixes-8472

This contains a single commit on top of a checkout of the fido branch.

However, I am unable to get a working version of Toaster 1.8 to test it.

Would someone be willing to test this for me, please? Maybe Mihail?
Comment 8 Elliot Smith 2015-12-02 10:29:59 UTC
I've now managed to test this, and will submit the patch.
Comment 9 Elliot Smith 2015-12-17 17:38:23 UTC
Submitted to Toaster mailing list for review

https://lists.yoctoproject.org/pipermail/toaster/2015-December/003452.html