Date: Mon, 16 Jun 2003 09:06:54 -0500 (CDT) From: Gil Kloepfer <gil@arlut.utexas.edu> To: FreeBSD-gnats-submit@FreeBSD.org Subject: bin/53375: pkg_info does not display index properly Message-ID: <200306161406.h5GE6sCl083152@csdlap3.arlut.utexas.edu> Resent-Message-ID: <200306161410.h5GEAFKi051360@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
>Number: 53375 >Category: bin >Synopsis: pkg_info does not display index properly >Confidential: no >Severity: serious >Priority: medium >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Mon Jun 16 07:10:15 PDT 2003 >Closed-Date: >Last-Modified: >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: >Unformatted:
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200306161406.h5GE6sCl083152>