Date: Wed, 14 Aug 2013 10:26:26 GMT From: mattbw@FreeBSD.org To: svn-soc-all@FreeBSD.org Subject: socsvn commit: r255923 - soc2013/mattbw/backend Message-ID: <201308141026.r7EAQQSm098594@socsvn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: mattbw Date: Wed Aug 14 10:26:26 2013 New Revision: 255923 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=255923 Log: Regurgitate last error string event at job failure. This is a very "last resort" approach to finding out why pkcon bails out in updates. Unfortunately, I accidentally upgraded properly using pkg and thus cannot test it until I set up a proper testing environment. Next up is GetDepends and GetRequires, which should theoretically be simple query extensions. Modified: soc2013/mattbw/backend/event.c soc2013/mattbw/backend/jobs.c Modified: soc2013/mattbw/backend/event.c ============================================================================== --- soc2013/mattbw/backend/event.c Wed Aug 14 10:22:54 2013 (r255922) +++ soc2013/mattbw/backend/event.c Wed Aug 14 10:26:26 2013 (r255923) @@ -99,8 +99,14 @@ case PKG_EVENT_ERROR: /* * This is sometimes used for nonfatal errors, so we can't - * throw an error code here. + * throw an error code here. What we'll do (mainly for debug + * purposes) is post the error into the backend so we can + * retrieve it if it was fatal. + * + * pk_backend_set_string seems to strdup, so we don't have to. */ + (void)pk_backend_set_string(backend, "job_error", + event->e_pkg_error.msg); break; case PKG_EVENT_ERRNO: case PKG_EVENT_ARCHIVE_COMP_UNSUP: Modified: soc2013/mattbw/backend/jobs.c ============================================================================== --- soc2013/mattbw/backend/jobs.c Wed Aug 14 10:22:54 2013 (r255922) +++ soc2013/mattbw/backend/jobs.c Wed Aug 14 10:26:26 2013 (r255923) @@ -70,7 +70,16 @@ assert(EPKG_OK <= err); assert(err <= EPKG_INSECURE); if (err != EPKG_OK) { - ERR(backend, job_failed, APPLY_ERRORS[err]); + const gchar *error_string; + + /* Did we trap an error in the events handler? */ + error_string = pk_backend_get_string(backend, "job_error"); + if (error_string == NULL) { + error_string = APPLY_ERRORS[err]; + } + assert(error_string != NULL); + + ERR(backend, job_failed, error_string); } return (err == EPKG_OK);
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201308141026.r7EAQQSm098594>