From nobody@FreeBSD.org  Sun May 23 08:44:43 2010
Return-Path: <nobody@FreeBSD.org>
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id CC8081065674
	for <freebsd-gnats-submit@FreeBSD.org>; Sun, 23 May 2010 08:44:43 +0000 (UTC)
	(envelope-from nobody@FreeBSD.org)
Received: from www.freebsd.org (www.freebsd.org [IPv6:2001:4f8:fff6::21])
	by mx1.freebsd.org (Postfix) with ESMTP id A22AB8FC08
	for <freebsd-gnats-submit@FreeBSD.org>; Sun, 23 May 2010 08:44:43 +0000 (UTC)
Received: from www.freebsd.org (localhost [127.0.0.1])
	by www.freebsd.org (8.14.3/8.14.3) with ESMTP id o4N8ihRZ049829
	for <freebsd-gnats-submit@FreeBSD.org>; Sun, 23 May 2010 08:44:43 GMT
	(envelope-from nobody@www.freebsd.org)
Received: (from nobody@localhost)
	by www.freebsd.org (8.14.3/8.14.3/Submit) id o4N8ihbc049828;
	Sun, 23 May 2010 08:44:43 GMT
	(envelope-from nobody)
Message-Id: <201005230844.o4N8ihbc049828@www.freebsd.org>
Date: Sun, 23 May 2010 08:44:43 GMT
From: Garrett Cooper <yaneurabeya@gmail.com>
To: freebsd-gnats-submit@FreeBSD.org
Subject: [patch] [pkg_install] fix missing error call in uname check added to pkg_version in r206043
X-Send-Pr-Version: www-3.1
X-GNATS-Notify:

>Number:         146857
>Category:       bin
>Synopsis:       [patch] pkg_create(8): fix missing error call in uname check added to pkg_version in r206043
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    bapt
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Sun May 23 08:50:01 UTC 2010
>Closed-Date:    Tue Oct 02 17:08:00 UTC 2012
>Last-Modified:  Sun Feb 03 22:28:47 UTC 2013
>Originator:     Garrett Cooper
>Release:        9-CURRENT
>Organization:
Cisco Systems, Inc.
>Environment:
FreeBSD bayonetta.local 9.0-CURRENT FreeBSD 9.0-CURRENT #0 r206173M: Mon Apr 26 22:45:06 PDT 2010     root@bayonetta.local:/usr/obj/usr/src/sys/BAYONETTA.ata  amd64
>Description:
One of the error checks wasn't properly integrated into r206043 as part of bin/145101 (it was in the 2nd patch, not the first one).

This patch also reorders the headers so that it makes the actual dependencies for libpkg more apparent and fixes indentation according to jkh's `coding style' in one spot.
>How-To-Repeat:
These are error conditions that won't occur 99.9% of the time (unless uname(2) fails), but will occur given proper circumstances.
>Fix:
See attached patch.

Patch attached with submission follows:

Index: perform.c
===================================================================
--- perform.c	(revision 208438)
+++ perform.c	(working copy)
@@ -21,12 +21,15 @@
 #include <sys/cdefs.h>
 __FBSDID("$FreeBSD$");
 
-#include <pkg.h>
-#include "version.h"
+#include <sys/param.h>
+#include <stdio.h>
 #include <err.h>
 #include <fetch.h>
 #include <signal.h>
 
+#include <pkg.h>
+#include "version.h"
+
 FILE *IndexFile;
 char IndexPath[PATH_MAX] = "";
 struct index_head Index = SLIST_HEAD_INITIALIZER(Index);
@@ -56,10 +59,11 @@
     struct utsname u;
 
     if (uname(&u) == -1) {
-	warn("%s(): failed to determine uname information", __func__);
+	warn("%s: failed to determine uname information", __func__);
 	return 1;
     } else if ((rel_major_ver = (int) strtol(u.release, NULL, 10)) <= 0) {
-
+	warnx("%s: bad release version specified: %s", __func__, u.release);
+	return 1;
     }
 
     /*
@@ -82,10 +86,10 @@
 	pat[1] = NULL;
 	MatchType = RegexExtended ? MATCH_EREGEX : MATCH_REGEX;
 	patterns = pat;
-     } else {
+    } else {
 	MatchType = MATCH_ALL;
 	patterns = NULL;
-     }
+    }
 
     if (LookUpOrigin != NULL)
 	pkgs = matchbyorigin(LookUpOrigin, &err_cnt);


>Release-Note:
>Audit-Trail:
Responsible-Changed-From-To: freebsd-bugs->portmgr 
Responsible-Changed-By: eadler 
Responsible-Changed-When: Mon Jan 2 15:28:32 UTC 2012 
Responsible-Changed-Why:  
hand this over to portmgr 

http://www.freebsd.org/cgi/query-pr.cgi?pr=146857 
State-Changed-From-To: open->patched 
State-Changed-By: bapt 
State-Changed-When: Tue Sep 18 22:12:57 UTC 2012 
State-Changed-Why:  
awaiting MFC 


Responsible-Changed-From-To: portmgr->bapt 
Responsible-Changed-By: bapt 
Responsible-Changed-When: Tue Sep 18 22:12:57 UTC 2012 
Responsible-Changed-Why:  
awaiting MFC 

http://www.freebsd.org/cgi/query-pr.cgi?pr=146857 
State-Changed-From-To: patched->closed 
State-Changed-By: bapt 
State-Changed-When: Tue Oct 2 17:08:00 UTC 2012 
State-Changed-Why:  
MFCed, thanks! 

http://www.freebsd.org/cgi/query-pr.cgi?pr=146857 
>Unformatted:
