From owner-freebsd-bugs@FreeBSD.ORG Sun May 23 09:10:02 2010 Return-Path: Delivered-To: freebsd-bugs@hub.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 978861065675 for ; Sun, 23 May 2010 09:10:02 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (unknown [IPv6:2001:4f8:fff6::28]) by mx1.freebsd.org (Postfix) with ESMTP id 5A17A8FC22 for ; Sun, 23 May 2010 09:10:02 +0000 (UTC) Received: from freefall.freebsd.org (localhost [127.0.0.1]) by freefall.freebsd.org (8.14.4/8.14.4) with ESMTP id o4N9A0g1045943 for ; Sun, 23 May 2010 09:10:00 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.14.4/8.14.4/Submit) id o4N9A0dk045942; Sun, 23 May 2010 09:10:00 GMT (envelope-from gnats) Resent-Date: Sun, 23 May 2010 09:10:00 GMT Resent-Message-Id: <201005230910.o4N9A0dk045942@freefall.freebsd.org> Resent-From: FreeBSD-gnats-submit@FreeBSD.org (GNATS Filer) Resent-To: freebsd-bugs@FreeBSD.org Resent-Reply-To: FreeBSD-gnats-submit@FreeBSD.org, Garrett Cooper Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E08331065672 for ; Sun, 23 May 2010 09:03:34 +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 CF9EA8FC12 for ; Sun, 23 May 2010 09:03:34 +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 o4N93Yeg064905 for ; Sun, 23 May 2010 09:03:34 GMT (envelope-from nobody@www.freebsd.org) Received: (from nobody@localhost) by www.freebsd.org (8.14.3/8.14.3/Submit) id o4N93YV6064904; Sun, 23 May 2010 09:03:34 GMT (envelope-from nobody) Message-Id: <201005230903.o4N93YV6064904@www.freebsd.org> Date: Sun, 23 May 2010 09:03:34 GMT From: Garrett Cooper To: freebsd-gnats-submit@FreeBSD.org X-Send-Pr-Version: www-3.1 Cc: Subject: bin/146859: [patch] [pkg_install] libpkg/msg.c removal and related cleanup X-BeenThere: freebsd-bugs@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 23 May 2010 09:10:02 -0000 >Number: 146859 >Category: bin >Synopsis: [patch] [pkg_install] libpkg/msg.c removal and related cleanup >Confidential: no >Severity: non-critical >Priority: low >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Sun May 23 09:10:00 UTC 2010 >Closed-Date: >Last-Modified: >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: This proposed change: 1. Removes msg.c from libpkg as it was largely unused. 2. Removes the one and only function call made from msg.c (upchuck in 3. Removes some dead prototypes (barf, whinge). 4. Removes -N and -Y from pkg_create as they're complete no-ops in pkg_create, and libpkg. >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: lib/libpkg/global.c =================================================================== --- lib/libpkg/global.c (revision 208438) +++ lib/libpkg/global.c (working copy) @@ -28,5 +28,4 @@ Boolean Quiet = FALSE; Boolean Fake = FALSE; Boolean Force = FALSE; -int AutoAnswer = FALSE; int Verbose = 0; /* Allow multiple levels of verbose. */ Index: lib/libpkg/pen.c =================================================================== --- lib/libpkg/pen.c (revision 208438) +++ lib/libpkg/pen.c (working copy) @@ -126,8 +126,8 @@ } if (!getcwd(cwd, FILENAME_MAX)) { - upchuck("getcwd"); - return NULL; + cleanup(0); + err(EXIT_FAILURE, "getcwd"); } if (chdir(pen) == FAIL) { Index: lib/libpkg/msg.c =================================================================== --- lib/libpkg/msg.c (revision 208438) +++ lib/libpkg/msg.c (working copy) @@ -1,70 +0,0 @@ -/* - * FreeBSD install - a package for the installation and maintainance - * of non-core utilities. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * Jordan K. Hubbard - * 18 July 1993 - * - * Miscellaneous message routines. - * - */ - -#include -__FBSDID("$FreeBSD$"); - -#include "pkg.h" -#include -#include - -/* Die a relatively simple death */ -void -upchuck(const char *message) -{ - cleanup(0); - errx(1, "fatal error during execution: %s", message); -} - -/* - * As a yes/no question, prompting from the varargs string and using - * default if user just hits return. - */ -Boolean -y_or_n(Boolean def, const char *msg, ...) -{ - va_list args; - int ch = 0; - FILE *tty; - - va_start(args, msg); - /* - * Need to open /dev/tty because file collection may have been - * collected on stdin - */ - tty = fopen(_PATH_TTY, "r"); - if (!tty) { - cleanup(0); - errx(2, "can't open %s!", _PATH_TTY); - } - while (ch != 'Y' && ch != 'N') { - vfprintf(stderr, msg, args); - if (def) - fprintf(stderr, " [yes]? "); - else - fprintf(stderr, " [no]? "); - fflush(stderr); - ch = toupper(fgetc(tty)); - if (ch == '\n') - ch = (def) ? 'Y' : 'N'; - } - fclose(tty) ; - return (ch == 'Y') ? TRUE : FALSE; -} Index: lib/libpkg/pkg.h =================================================================== --- lib/libpkg/pkg.h (revision 208438) +++ lib/libpkg/pkg.h (working copy) @@ -191,12 +191,6 @@ int unpack(const char *, const char *); void format_cmd(char *, int, const char *, const char *, const char *); -/* Msg */ -void upchuck(const char *); -void barf(const char *, ...); -void whinge(const char *, ...); -Boolean y_or_n(Boolean, const char *, ...); - /* Packing list */ PackingList new_plist_entry(void); PackingList last_plist(Package *); Index: usr.sbin/pkg_install/create/pkg_create.1 =================================================================== --- usr.sbin/pkg_install/create/pkg_create.1 (revision 208438) +++ usr.sbin/pkg_install/create/pkg_create.1 (working copy) @@ -31,7 +31,7 @@ .Nd a utility for creating software package distributions .Sh SYNOPSIS .Nm -.Op Fl YNOhjnvyz +.Op Fl Ohjnvyz .Op Fl C Ar conflicts .Op Fl P Ar pkgs .Op Fl p Ar prefix @@ -52,7 +52,7 @@ .Fl f Ar packlist .Ar pkg-filename .Nm -.Op Fl EGYNRhnvxy +.Op Fl EGRhnvxy .Fl b Ar pkg-name .Op Ar pkg-filename .Sh DESCRIPTION @@ -103,10 +103,6 @@ or, if preceded by .Cm - , the argument itself. -.It Fl Y , -yes -Assume a default answer of `Yes' for any questions asked. -.It Fl N , -no -Assume a default answer of `No' for any questions asked. .It Fl O , -plist-only Go into a `packing list Only' mode. This is a custom hack for the Index: usr.sbin/pkg_install/create/main.c =================================================================== --- usr.sbin/pkg_install/create/main.c (revision 208438) +++ usr.sbin/pkg_install/create/main.c (working copy) @@ -48,12 +48,11 @@ static void usage(void); -static char opts[] = "EGYNnORhjvxyzf:p:P:C:c:d:i:I:k:K:r:t:X:D:m:s:S:o:b:"; +static char opts[] = "EGnORhjvxyzf:p:P:C:c:d:i:I:k:K:r:t:X:D:m:s:S:o:b:"; static struct option longopts[] = { { "backup", required_argument, NULL, 'b' }, { "extended", no_argument, NULL, 'E' }, { "help", no_argument, &Help, TRUE }, - { "no", no_argument, NULL, 'N' }, { "no-glob", no_argument, NULL, 'G' }, { "origin", required_argument, NULL, 'o' }, { "plist-only", no_argument, NULL, 'O' }, @@ -62,7 +61,6 @@ { "regex", no_argument, NULL, 'x' }, { "template", required_argument, NULL, 't' }, { "verbose", no_argument, NULL, 'v' }, - { "yes", no_argument, NULL, 'Y' }, { NULL, 0, NULL, 0 }, }; @@ -93,14 +91,6 @@ MatchType = MATCH_EXACT; break; - case 'N': - AutoAnswer = NO; - break; - - case 'Y': - AutoAnswer = YES; - break; - case 'O': PlistOnly = TRUE; break; >Release-Note: >Audit-Trail: >Unformatted: