The problem is in the section of the code (starts at line 124) that
writes the file.

        with outfile:
            try:
                outfile.write(self.data)
            except IOError as exc:
                logging.error("Unable to write data to %s: %s", dest, exc)
                return False
            else:
                outfile.flush()
                os.fsync(outfile.fileno())
                return True

We only catch exceptions if they happen during *writing* the file, but
in this case they were thrown in the "else" section, where we're no
longer expecting them to happen.

Moving all file operations so they're inside the "try" section should
help here, but we need to consider the implications and reasons why this
was in the "else" section in the first place. IMHO clearly if the write
operation failed, we don't need to flush and sync.


** Changed in: checkbox
    Milestone: None => 2014-mar-28

** Changed in: plainbox-provider-checkbox (Ubuntu)
    Milestone: None => ubuntu-14.04

** Changed in: checkbox
       Status: New => Triaged

** Changed in: plainbox-provider-checkbox (Ubuntu)
       Status: New => Triaged

** Changed in: checkbox
   Importance: Undecided => Medium

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/1289206

Title:
  removable_storage_test crashed with OSError in write_file(): [Errno 5]
  Input/output error

To manage notifications about this bug go to:
https://bugs.launchpad.net/checkbox/+bug/1289206/+subscriptions

-- 
ubuntu-bugs mailing list
[email protected]
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to