1624
1624
// do not report out-of-memory failures
1625
if(strstr(errormsg, strerror(ENOMEM)) != NULL) {
1625
if(strstr(errormsg, strerror(ENOMEM)) != NULL ||
1626
strstr(errormsg, "failed to allocate memory") != NULL) {
1626
1627
std::clog << _("No apport report written because the error message indicates a out of memory error") << std::endl;
1630
// do not report dpkg I/O errors
1631
// XXX - this message is localized, but this only matches the English version. This is better than nothing.
1632
if(strstr(errormsg, "short read in buffer_copy (")) {
1633
std::clog << _("No apport report written because the error message indicates a dpkg I/O error") << std::endl;
1631
// do not report bugs regarding inaccessible local files
1632
if(strstr(errormsg, strerror(ENOENT)) != NULL ||
1633
strstr(errormsg, "cannot access archive") != NULL) {
1634
std::clog << _("No apport report written because the error message indicates an issue on the local system") << std::endl;
1638
// do not report errors encountered when decompressing packages
1639
if(strstr(errormsg, "--fsys-tarfile returned error exit status 2") != NULL) {
1640
std::clog << _("No apport report written because the error message indicates an issue on the local system") << std::endl;
1644
// do not report dpkg I/O errors, this is a format string, so we compare
1645
// the prefix and the suffix of the error with the dpkg error message
1646
vector<string> io_errors;
1647
io_errors.push_back(string("failed to read on buffer copy for %s"));
1648
io_errors.push_back(string("failed in write on buffer copy for %s"));
1649
io_errors.push_back(string("short read on buffer copy for %s"));
1651
for (vector<string>::iterator I = io_errors.begin(); I != io_errors.end(); I++)
1653
vector<string> list = VectorizeString(dgettext("dpkg", (*I).c_str()), '%');
1654
if (list.size() > 1) {
1655
// we need to split %s, VectorizeString only allows char so we need
1656
// to kill the "s" manually
1657
if (list[1].size() > 1) {
1658
list[1].erase(0, 1);
1659
if(strstr(errormsg, list[0].c_str()) &&
1660
strstr(errormsg, list[1].c_str())) {
1661
std::clog << _("No apport report written because the error message indicates a dpkg I/O error") << std::endl;
1637
1668
// get the pkgname and reportfile
1723
1754
char buf[1024];
1724
1755
while( fgets(buf, sizeof(buf), log) != NULL)
1725
1756
fprintf(report, " %s", buf);
1757
fprintf(report, " \n");
1762
// attach history log it if we have it
1763
string histfile_name = _config->FindFile("Dir::Log::History");
1764
if (!histfile_name.empty())
1769
fprintf(report, "DpkgHistoryLog:\n");
1770
log = fopen(histfile_name.c_str(),"r");
1773
while( fgets(buf, sizeof(buf), log) != NULL)
1774
fprintf(report, " %s", buf);