NetBSD Problem Report #7923

Received: (qmail 9071 invoked from network); 6 Jul 1999 03:14:59 -0000
Message-Id: <199907060314.WAA02588@mr-ed.apps2go.com>
Date: Mon, 5 Jul 1999 22:14:58 -0500 (CDT)
From: eric@apps2go.com
Reply-To: eric@apps2go.com
To: gnats-bugs@gnats.netbsd.org
Subject: bin: pkg_create says @display will use more(1), pkg_add doesn't
X-Send-Pr-Version: 3.95

>Number:         7923
>Category:       bin
>Synopsis:       pkg_create says @display will use more, but pkg_add doesn't
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    bin-bug-people
>State:          closed
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Mon Jul 05 20:20:03 +0000 1999
>Closed-Date:    Wed Jul 28 10:43:31 +0000 1999
>Last-Modified:  Wed Jul 28 10:45:44 +0000 1999
>Originator:     Eric Schnoebelen
>Release:        1.4-Release 4 July, 1999
>Organization:
	Software2Go, LLC
>Environment:

System: NetBSD mr-ed 1.4 NetBSD 1.4 (GENERIC) #1: Sat May 8 11:37:01 PDT 1999 ross@netbsd.org:/usr/src/sys/arch/alpha/compile/GENERIC alpha


>Description:
	On the pkg_create(1) man page, the `-D' option (which defines 
	@display the packing list) says that the file specified will be 
	displayed to the user at installation time, using more(1). 

	Specifying a `-D' flag to pkg_create(1), and then using pkg_add(1)
	to install the package has the file displayed with out any
	paging.

>How-To-Repeat:
	Specify a file to be displayed that is larger than a single
	screen.  Watch it scroll away.
>Fix:
--- perform.c.orig	Mon Jul  5 21:58:26 1999
+++ perform.c	Mon Jul  5 22:03:49 1999
@@ -548,17 +548,27 @@
     }

     if ((p = find_plist(&Plist, PLIST_DISPLAY)) != NULL) {
-	FILE *fp;
+	struct stat sbuf;
+	char *Pager;
 	char buf[BUFSIZ];

+	/*
+	 * get the users PAGER environment variable, to use for
+	 * displaying the display file
+	 */
+	Pager = getenv("PAGER");
+	if (Pager == NULL) 
+	    Pager = "/usr/bin/more";
+
+	/* 
+	 * check to make sure the file exists, and if it does,
+	 * fire up PAGER to display it..  Since the rest of the pkg* 
+	 * code is littered with system(3c), we'll add one more here.
+	 */
 	snprintf(buf, sizeof buf, "%s/%s", LogDir, p->name);
-	fp = fopen(buf, "r");
-	if (fp) {
-	    putc('\n', stdout);
-	    while (fgets(buf, sizeof(buf), fp))
-		fputs(buf, stdout);
-	    putc('\n', stdout);
-	    (void) fclose(fp);
+	if (!stat(buf,&sbuf)) {
+	    snprintf(buf, sizeof buf, "%s %s/%s", Pager, LogDir, p->name);
+	    system(buf);
 	} else
 	    warnx("cannot open %s as display file", buf);
     }
>Release-Note:
>Audit-Trail:
State-Changed-From-To: open->closed 
State-Changed-By: tron 
State-Changed-When: Wed Jul 28 03:43:31 PDT 1999 
State-Changed-Why:  
The display file should really not be displayed with more(1). I corrected 
the manual page. 
>Unformatted:


 For the record:
 I'd rather see the manpage not mention more(1) instead of this
 patch applied, as this will make adding more than one package
 (presumably in non-interactive mode) more difficult.

 - Hubert (hubertf)

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.51 2026/08/10 02:28:17 riastradh Exp $
$NetBSD: gnats_config.sh,v 1.10 2026/05/13 22:00:09 riastradh Exp $
Copyright © 1994-2026 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.