From gil@arlut.utexas.edu  Mon Jun 16 07:06:56 2003
Return-Path: <gil@arlut.utexas.edu>
Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125])
	by hub.freebsd.org (Postfix) with ESMTP id B01BE37B401
	for <FreeBSD-gnats-submit@freebsd.org>; Mon, 16 Jun 2003 07:06:56 -0700 (PDT)
Received: from ns2.arlut.utexas.edu (ns2.arlut.utexas.edu [129.116.174.1])
	by mx1.FreeBSD.org (Postfix) with ESMTP id DD7F643FBF
	for <FreeBSD-gnats-submit@freebsd.org>; Mon, 16 Jun 2003 07:06:55 -0700 (PDT)
	(envelope-from gil@arlut.utexas.edu)
Received: from ns5.arlut.utexas.edu (ns5.arlut.utexas.edu [10.4.1.6])
	by ns2.arlut.utexas.edu (8.12.9/8.12.9) with ESMTP id h5GE6tTQ005321
	for <FreeBSD-gnats-submit@freebsd.org>; Mon, 16 Jun 2003 09:06:55 -0500 (CDT)
Received: from csdlap3.arlut.utexas.edu (csdlap3.arlut.utexas.edu [10.3.16.8])
	by ns5.arlut.utexas.edu (8.12.9/8.12.9) with ESMTP id h5GE6sK8063368;
	Mon, 16 Jun 2003 09:06:54 -0500 (CDT)
Received: from csdlap3.arlut.utexas.edu (localhost.arlut.utexas.edu [127.0.0.1])
	by csdlap3.arlut.utexas.edu (8.12.8p1/8.12.9) with ESMTP id h5GE6sri083153;
	Mon, 16 Jun 2003 09:06:54 -0500 (CDT)
Received: (from gil@localhost)
	by csdlap3.arlut.utexas.edu (8.12.8p1/8.12.9/Submit) id h5GE6sCl083152;
	Mon, 16 Jun 2003 09:06:54 -0500 (CDT)
Message-Id: <200306161406.h5GE6sCl083152@csdlap3.arlut.utexas.edu>
Date: Mon, 16 Jun 2003 09:06:54 -0500 (CDT)
From: Gil Kloepfer <gil@arlut.utexas.edu>
Reply-To: Gil Kloepfer <gil@arlut.utexas.edu>
To: FreeBSD-gnats-submit@freebsd.org
Cc:
Subject: pkg_info does not display index properly
X-Send-Pr-Version: 3.113
X-GNATS-Notify:

>Number:         53375
>Category:       bin
>Synopsis:       pkg_info does not display index properly
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    freebsd-bugs
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Mon Jun 16 07:10:15 PDT 2003
>Closed-Date:    Wed Jun 18 00:21:13 PDT 2003
>Last-Modified:  Wed Jun 18 00:21:13 PDT 2003
>Originator:     Gil Kloepfer
>Release:        FreeBSD 4.8-RELEASE i386
>Organization:
UT Applied Research Laboratories
>Environment:

System: FreeBSD csdlap3.arlut.utexas.edu 4.8-RELEASE FreeBSD 4.8-RELEASE #0: Thu Jun 12 17:06:10 CDT 2003 gil@csdlap3.arlut.utexas.edu:/usr/src/sys/compile/ARLINSP8K i386

>Description:
	pkg_info with no args (index) does not print a newline at the
	end of each package.  This causes the entire package list
	to be displayed as one line.

>How-To-Repeat:
	Install the following three packages on a clean system:
		compat3x-i386-4.4.20020925
		javavmwrapper-1.4
		jre-1.1.8

        Then type pkg_info.

>Fix:

	Apply the following patch to /usr/src/usr.sbin/pkg_install/info/show.c:

-- Cut Here -- -- Cut Here -- -- Cut Here -- -- Cut Here -- -- Cut Here --
--- show.c	Mon Jun 16 08:57:41 2003
+++ show.c.ORIG	Tue Aug 20 01:35:08 2002
@@ -54,7 +54,6 @@
 {
     FILE *fp;
     char line[MAXINDEXSIZE+2];
-    int lastc;
 
     if (!Quiet)
         printf("%s%s", InfoPrefix, title);
@@ -64,13 +63,11 @@
         return;
     }
     if(fgets(line, MAXINDEXSIZE+1, fp)) {
-        line[MAXINDEXSIZE+1] = 0;
+	if(line[MAXINDEXSIZE-1] != '\n')
+          line[MAXINDEXSIZE] = '\n';
+	line[MAXINDEXSIZE+1] = 0;
 	fputs(line, stdout);
-        lastc = strlen(line);
-	if(lastc > 0 && line[lastc-1] != '\n')
-           putchar('\n');
-    } else
-        putchar('\n');
+    }
     fclose(fp);
 }
-- Cut Here -- -- Cut Here -- -- Cut Here -- -- Cut Here -- -- Cut Here --

	Note that this patch also fixes the case where no lines can be
	read from the package file (the newline would also be missing).
>Release-Note:
>Audit-Trail:

From: Gil Kloepfer <gil@arlut.utexas.edu>
To: freebsd-gnats-submit@FreeBSD.org
Cc:  
Subject: Re: bin/53375: pkg_info does not display index properly
Date: Tue, 17 Jun 2003 07:19:04 -0500

 Please close this bug.  I just noticed that it was fixed in CVS as of
 version 1.14.2.14.  However, someone probably needs to put it in the
 4.8-RELEASE errata...
State-Changed-From-To: open->closed 
State-Changed-By: maxim 
State-Changed-When: Wed Jun 18 00:20:40 PDT 2003 
State-Changed-Why:  
Closed at the submitter's request: the bug was fixed in -CURRENT and -STABLE. 

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