From owner-p4-projects@FreeBSD.ORG Sun Jul 15 22:18:08 2007 Return-Path: X-Original-To: p4-projects@freebsd.org Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id B12B616A409; Sun, 15 Jul 2007 22:18:07 +0000 (UTC) X-Original-To: perforce@FreeBSD.org Delivered-To: perforce@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 6DF8D16A400 for ; Sun, 15 Jul 2007 22:18:07 +0000 (UTC) (envelope-from gcooper@FreeBSD.org) Received: from repoman.freebsd.org (repoman.freebsd.org [69.147.83.41]) by mx1.freebsd.org (Postfix) with ESMTP id 454DB13C4B4 for ; Sun, 15 Jul 2007 22:18:07 +0000 (UTC) (envelope-from gcooper@FreeBSD.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.14.1/8.14.1) with ESMTP id l6FMI7W6063471 for ; Sun, 15 Jul 2007 22:18:07 GMT (envelope-from gcooper@FreeBSD.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.14.1/8.14.1/Submit) id l6FMI7Yq063468 for perforce@freebsd.org; Sun, 15 Jul 2007 22:18:07 GMT (envelope-from gcooper@FreeBSD.org) Date: Sun, 15 Jul 2007 22:18:07 GMT Message-Id: <200707152218.l6FMI7Yq063468@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to gcooper@FreeBSD.org using -f From: Garrett Cooper To: Perforce Change Reviews Cc: Subject: PERFORCE change 123553 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 15 Jul 2007 22:18:08 -0000 http://perforce.freebsd.org/chv.cgi?CH=123553 Change 123553 by gcooper@optimus-revised_pkgtools on 2007/07/15 22:17:41 Important base case I didn't think of before. If the length of the string returned was null, no dice, exit add_plist immediately. This fixes pkg_version. Affected files ... .. //depot/projects/soc2007/revised_fbsd_pkgtools/usr/src/usr.sbin/pkg_install/lib/plist.c#10 edit Differences ... ==== //depot/projects/soc2007/revised_fbsd_pkgtools/usr/src/usr.sbin/pkg_install/lib/plist.c#10 (text+ko) ==== @@ -357,19 +357,18 @@ return PLIST_CONFLICTS; /** FALL-THROUGH **/ - case 'e': /** EXEC **/ if (!strcmp(cmd, "exec")) return PLIST_CMD; + /** FALL-THROUGH **/ - case 'u': /** UN(DO)EXEC **/ if (!strcmp(cmd, "unexec")) return PLIST_UNEXEC; + /** FALL-THROUGH **/ - case 'i': /** IGNORE **/ if (!strcmp(cmd, "ignore")) @@ -377,8 +376,8 @@ /** IGNORE_INST **/ else if(!strcmp(cmd, "ignore_inst")) return PLIST_IGNORE_INST; + /** FALL-THROUGH **/ - case 'd': /** DIRRM **/ if (!strcmp(cmd, "dirrm")) @@ -386,8 +385,8 @@ /** DISPLAY **/ else if(!strcmp(cmd, "display")) return PLIST_DISPLAY; + /** FALL-THROUGH **/ - case 'n': /** NAME **/ if(!strcmp(cmd, "name")) @@ -395,8 +394,8 @@ /** NOINST **/ else if (!strcmp(cmd, "noinst")) return PLIST_NOINST; + /** FALL-THROUGH **/ - case 'm': /** MODE **/ if(!strcmp(cmd, "mode")) @@ -404,8 +403,8 @@ /** MTREE **/ else if(!strcmp(cmd, "mtree")) return PLIST_MTREE; + /** FALL-THROUGH **/ - case 'o': /** OWNER **/ if(!strcmp(cmd, "owner")) @@ -413,28 +412,28 @@ /** OPTION **/ else if (!strcmp(cmd, "option")) return PLIST_OPTION; + /** FALL-THROUGH **/ - case 's': /** SRCDIR **/ if(!strcmp(cmd, "srcdir")) return PLIST_SRC; + /** FALL-THROUGH **/ - case 'g': /** GROUP **/ if (!strcmp(cmd, "group")) return PLIST_CHGRP; + /** FALL-THROUGH **/ - case 'p': /** PKGDEP **/ if (!strcmp(cmd, "pkgdep")) return PLIST_PKGDEP; + /** FALL-THROUGH **/ - /** Apparently the command didn't match .. oops **/ - default: + default: /** Apparently the command didn't match anything above .. oops **/ return FAIL; } @@ -461,10 +460,15 @@ pkg->fmtver_mnr = 2; pkg->origin = NULL; - plines = fileGetContentsByDescriptor(fp, "+CONTENTS"); + plines = fileGetContentsByDescriptor(fp, CONTENTS_FNAME); + + if(0 == strlen(plines)) + return; pline = strtok(plines, "\n"); + assert(pline != NULL); + if(0 == trim_end_whitespace(pline)) errx(-1, "Length of first line was 0. This shouldn't happen");