From owner-svn-ports-all@freebsd.org Tue Dec 5 16:22:03 2017 Return-Path: Delivered-To: svn-ports-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 12DC7E6F9A4; Tue, 5 Dec 2017 16:22:03 +0000 (UTC) (envelope-from bapt@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id D40B717B9; Tue, 5 Dec 2017 16:22:02 +0000 (UTC) (envelope-from bapt@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id vB5GM2Fp087735; Tue, 5 Dec 2017 16:22:02 GMT (envelope-from bapt@FreeBSD.org) Received: (from bapt@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id vB5GM14g087733; Tue, 5 Dec 2017 16:22:01 GMT (envelope-from bapt@FreeBSD.org) Message-Id: <201712051622.vB5GM14g087733@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bapt set sender to bapt@FreeBSD.org using -f From: Baptiste Daroussin Date: Tue, 5 Dec 2017 16:22:01 +0000 (UTC) To: ports-committers@freebsd.org, svn-ports-all@freebsd.org, svn-ports-head@freebsd.org Subject: svn commit: r455589 - in head/ports-mgmt/pkg: . files X-SVN-Group: ports-head X-SVN-Commit-Author: bapt X-SVN-Commit-Paths: in head/ports-mgmt/pkg: . files X-SVN-Commit-Revision: 455589 X-SVN-Commit-Repository: ports MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-ports-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the ports tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 05 Dec 2017 16:22:03 -0000 Author: bapt Date: Tue Dec 5 16:22:01 2017 New Revision: 455589 URL: https://svnweb.freebsd.org/changeset/ports/455589 Log: Fix segfault in pkg version against the ports tree PR: 224023 Reported by: jrm, kib, Trond.Endrestol@ximalas.info Tested by: jrm (an early version of the patch) Added: head/ports-mgmt/pkg/files/patch-src_version.c (contents, props changed) Modified: head/ports-mgmt/pkg/Makefile Modified: head/ports-mgmt/pkg/Makefile ============================================================================== --- head/ports-mgmt/pkg/Makefile Tue Dec 5 16:20:56 2017 (r455588) +++ head/ports-mgmt/pkg/Makefile Tue Dec 5 16:22:01 2017 (r455589) @@ -2,6 +2,7 @@ PORTNAME= pkg DISTVERSION= 1.10.3 +PORTREVISION= 1 _PKG_VERSION= ${DISTVERSION} CATEGORIES= ports-mgmt MASTER_SITES= \ Added: head/ports-mgmt/pkg/files/patch-src_version.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/ports-mgmt/pkg/files/patch-src_version.c Tue Dec 5 16:22:01 2017 (r455589) @@ -0,0 +1,28 @@ +diff --git src/version.c src/version.c +index d265776b..92c18060 100644 +--- src/version.c ++++ src/version.c +@@ -601,6 +601,8 @@ exec_buf(UT_string *res, char **argv) { + if (errno != EINTR) + return (-1); + } ++ if (WEXITSTATUS(pstat) != 0) ++ return (-1); + + return (utstring_len(res)); + } +@@ -716,11 +718,13 @@ port_version(UT_string *cmd, const char *portsdir, const char *origin, + argv[3] = "flavors-package-names"; + argv[4] = NULL; + +- if (exec_buf(cmd, argv) != 0) { ++ if (exec_buf(cmd, argv) > 0) { + output = utstring_body(cmd); + while ((walk = strsep(&output, "\n")) != NULL) { + name = walk; + walk = strrchr(walk, '-'); ++ if (walk == NULL) ++ continue; + walk[0] = '\0'; + walk++; + if (strcmp(name, pkgname) == 0) {