From owner-svn-soc-all@FreeBSD.ORG Wed Aug 14 10:26:26 2013 Return-Path: Delivered-To: svn-soc-all@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id EF491A60 for ; Wed, 14 Aug 2013 10:26:26 +0000 (UTC) (envelope-from mattbw@FreeBSD.org) Received: from socsvn.freebsd.org (socsvn.freebsd.org [IPv6:2001:1900:2254:206a::50:2]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id C32932E6F for ; Wed, 14 Aug 2013 10:26:26 +0000 (UTC) Received: from socsvn.freebsd.org ([127.0.1.124]) by socsvn.freebsd.org (8.14.7/8.14.7) with ESMTP id r7EAQQRV098597 for ; Wed, 14 Aug 2013 10:26:26 GMT (envelope-from mattbw@FreeBSD.org) Received: (from www@localhost) by socsvn.freebsd.org (8.14.7/8.14.6/Submit) id r7EAQQSm098594 for svn-soc-all@FreeBSD.org; Wed, 14 Aug 2013 10:26:26 GMT (envelope-from mattbw@FreeBSD.org) Date: Wed, 14 Aug 2013 10:26:26 GMT Message-Id: <201308141026.r7EAQQSm098594@socsvn.freebsd.org> X-Authentication-Warning: socsvn.freebsd.org: www set sender to mattbw@FreeBSD.org using -f From: mattbw@FreeBSD.org To: svn-soc-all@FreeBSD.org Subject: socsvn commit: r255923 - soc2013/mattbw/backend MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 14 Aug 2013 10:26:27 -0000 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);