bug-export.rnc does not ensure that attachments have contents - importer will error on empty attachments

Bug #713264 reported by Gavin Panella
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Launchpad itself
Triaged
High
Unassigned

Bug Description

The bug export file supplied in question 143433 had attachments with
empty contents:

      <attachment>
        <mimetype>application/zip</mimetype>
        <title/>
        <filename>sbnc.zip</filename>
        <type>UNSPECIFIED</type>
--> <contents/>
      </attachment>

Empty files are not permitted by the Librarian so this cannot be
imported. It might also be indicative that the user's bug export
process has not worked correctly.

The schema bug-export.rnc should be, if possible, enhanced to make
sure that contents are supplied.

Tags: easy
Revision history for this message
Robert Collins (lifeless) wrote : Re: [Bug 713264] [NEW] bug-export.rnc does not ensure that attachments have contents

On Sat, Feb 5, 2011 at 7:40 AM, Gavin Panella
<email address hidden> wrote:
> Empty files are not permitted by the Librarian so this cannot be
> imported.

They are permitted now, but I don't think it makes a lot of sense to
import them.

-Rob

Revision history for this message
Gavin Panella (allenap) wrote : Re: bug-export.rnc does not ensure that attachments have contents

Ah, what I saw was the librarian client complaining, rather than the
librarian itself:

Traceback (most recent call last):
  File "/.../lib/lp/bugs/scripts/bugimport.py", line 274, in importBugs
    self.importBug(bugnode)
  File "/.../lib/lp/bugs/scripts/bugimport.py", line 328, in importBug
    self.createAttachments(bug, msg, commentnode)
  File "/.../lib/lp/bugs/scripts/bugimport.py", line 452, in createAttachments
    contentType=mimetype)
  File "/.../lib/canonical/launchpad/database/librarian.py", line 275, in create
    fid = client.addFile(name, size, file, contentType, expires, debugID)
  File "/.../lib/canonical/librarian/client.py", line 130, in addFile
    raise UploadFailed('Invalid length: %d' % size)
UploadFailed: Invalid length: 0

I see that this behaviour can be modified by passing
allow_zero_length=True to FileUploadClient.addFile().

summary: - bug-export.rnc does not ensure that attachments have contents
+ bug-export.rnc does not ensure that attachments have contents - importer
+ will error on empty attachments
tags: added: easy
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.