#!/bin/sh -e
# Author: Brian Murray <brian@canonical.com>
# Copyright (C) 2009 Canonical, Ltd.
# License: GPLv3

# short read in buffer_copy is a message that can be found in apport-package bug reports
# In Lucid these will no longer be reported but this comment will help clean up existing ones
# Additonally tag the bug 'short-read' so we can find them later in case something is awry

loc=$(dirname "$0")

for b in "$@"; do
    comment="Thank you for taking the time to report this bug and helping to make Ubuntu better.  It seems that there was an error on your system when trying to install a particular package.  Please execute the following command, as it will clear your package cache, in a terminal:

sudo apt-get clean

Then try performing the update again.  This will likely resolve your issue, but the failure can be caused by filesystem or memory corruption.  So please also run a fsck on your filesystem(s) and a memory test.  If this does resolve your bug please set its status to Invalid.  Thanks in advance!"

    "$loc"/update-bug --status "Incomplete" --comment "$comment" --tag "short-read" $b || {
        echo "ERROR with LP: #$b" >&2
    }
done

