From nobody Thu Mar 09 05:53:55 2023 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4PXJJz4Mqdz3wCWX; Thu, 9 Mar 2023 05:53:55 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4PXJJz3YYDz4354; Thu, 9 Mar 2023 05:53:55 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1678341235; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=pkSkOYuo43cDIIiy6S0f9j0e/KeWr9FFFDln9Hg50qQ=; b=rXYcZwbCrHshJZEJiOnyLIm4ejtafozgamr3Q/b46Vb77Nm4IyMcnxR9wjQjHFFTMEgqBr PGti6eDcMzjx6B16hsL64WScJTfLpcG5YarjBBkVoApzFV4x2lVMdzmdtuFf4tvexsSZC4 ZkoOOajUWB0csr+WwR8LkV4SojVtnX77HrHSRK4FmI+sMwM7PEbcVn4llyqSIfKBk4Vb13 1AZP9qls+g+qir35bRvuKAZSl7UkvkuLrHIO+muZuTHTKw7Y0TtZ5eAd78u0v6IEAU5fyt e5BX8ENSBfKZKhOLX2vZPDUFD5c4GKoBwiIyvqhYK0hYaN/VqS2qOsMR8/GzXw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1678341235; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=pkSkOYuo43cDIIiy6S0f9j0e/KeWr9FFFDln9Hg50qQ=; b=J3LUpFLHRlpFTrXvrcEFONEgI6aOKToqmjkKqijCJiVXfDn49JWcyoh6h9FT4OSOFcp+QJ bFMxZlYOHzLJ4LhCHARrcWU0dQo47XmS/iR5zgsykyw/WPYyTRhXpwAKQ271B5kqMEIQVw Rhq/76nChDimPoi79MlUHLcG0bzkMd3O0uN4Nin6Une7BccevFvYQW5XqbhIEKao+OVE4G GzYNECN9kawFios5wtOXUvI3Hsn762Bw+pwG7ePqGiDXLdrsyHpeu5V/5a9K8iw5NxbfeN 4iF1o286kr0hlvE2+amt9whXS4uSWcFb9g4vPVli55AwyICqQoGr9czPTtNprw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1678341235; a=rsa-sha256; cv=none; b=jBBGsShbBRwiRNoikXwp/fmvsnlZhtFVo4gJsZCQ3bBS9nYL6qJFW4eqwVuOtk4v2pCD7+ ojow/yG+MFAmJ6l3axthBdwnds6Zl5o7jp9DNsRu59lh+9OJrYeNTuGvQSwtF14OzfEOVb ec2RHK4KDDmayPb4k7rBkGEAMNtF2P84WmU+WTYWKXU+/KRm5ueKRAL1BoqJWSbsOMScwJ q5P4ZiW9JEJMgYDq12ib9MMdvfQ9a5yCPFknWJkdnL0+wGBi4j1OK6XlXcVWmC9smIA6sj BVVW4DBdoTMtsA1aIswpoGmRnkFyRWVBKrpOyNmVmDpMI99EiZWUI1168zt6OA== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4PXJJz2bdJzwQy; Thu, 9 Mar 2023 05:53:55 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 3295rtav077382; Thu, 9 Mar 2023 05:53:55 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 3295rtKE077381; Thu, 9 Mar 2023 05:53:55 GMT (envelope-from git) Date: Thu, 9 Mar 2023 05:53:55 GMT Message-Id: <202303090553.3295rtKE077381@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kyle Evans Subject: git: c816aea7abcf - main - Revert "grep: remove tautological condition" List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kevans X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: c816aea7abcf7a6e9471907dcb7ee3d7969a0ab3 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by kevans: URL: https://cgit.FreeBSD.org/src/commit/?id=c816aea7abcf7a6e9471907dcb7ee3d7969a0ab3 commit c816aea7abcf7a6e9471907dcb7ee3d7969a0ab3 Author: Kyle Evans AuthorDate: 2023-03-09 05:52:23 +0000 Commit: Kyle Evans CommitDate: 2023-03-09 05:52:23 +0000 Revert "grep: remove tautological condition" This reverts commit f6d6c66889001208aee7b0c46efe1c8ddffda57c. Gremlins snuck into my tree and injected some WIP. --- usr.bin/grep/file.c | 3 ++- usr.sbin/pkg/config.c | 55 --------------------------------------------------- usr.sbin/pkg/config.h | 1 - usr.sbin/pkg/pkg.c | 5 ----- 4 files changed, 2 insertions(+), 62 deletions(-) diff --git a/usr.bin/grep/file.c b/usr.bin/grep/file.c index 787e8fbe03bb..8577572c2887 100644 --- a/usr.bin/grep/file.c +++ b/usr.bin/grep/file.c @@ -186,7 +186,8 @@ grep_open(const char *path) if (filebehave == FILE_MMAP) { struct stat st; - if (fstat(f->fd, &st) == -1 || !S_ISREG(st.st_mode)) + if ((fstat(f->fd, &st) == -1) || (st.st_size > OFF_MAX) || + (!S_ISREG(st.st_mode))) filebehave = FILE_STDIO; else { int flags = MAP_PRIVATE | MAP_NOCORE | MAP_NOSYNC; diff --git a/usr.sbin/pkg/config.c b/usr.sbin/pkg/config.c index 6902cfe41b7c..08e206b93511 100644 --- a/usr.sbin/pkg/config.c +++ b/usr.sbin/pkg/config.c @@ -567,58 +567,3 @@ config_finish(void) { for (i = 0; i < CONFIG_SIZE; i++) free(c[i].value); } - - -static int -config_value(const char *key) -{ - const struct config_entry *cp; - - for (size_t i = 0; i < nitems(c); i++) { - cp = &c[i]; - - if (strcmp(cp->key, key) == 0) { - switch (cp->type) { - case PKG_CONFIG_STRING: { - const char *val; - - (void)config_string(i, &val); - printf("%s\n", val); - break; - } - case PKG_CONFIG_BOOL: { - bool val; - - (void)config_bool(i, &val); - printf("%s\n", val ? "yes" : "no"); - break; - } - } - - return (0); - } - } - - return (ENOENT); -} - -int -config_show(int argc, char *argv[]) -{ - int error; - - if (argc != 1) { - fprintf(stderr, "Usage: pkg -N config \n"); - return (1); - } - - config_init(NULL); - error = config_value(argv[0]); - config_finish(); - - if (error == ENOENT) { - fprintf(stderr, "pkg: No such configuration options: %s\n", - argv[0]); - } - return (error); -} diff --git a/usr.sbin/pkg/config.h b/usr.sbin/pkg/config.h index 8cb878291a7e..87efd3c29e94 100644 --- a/usr.sbin/pkg/config.h +++ b/usr.sbin/pkg/config.h @@ -62,7 +62,6 @@ typedef enum { int config_init(const char *); void config_finish(void); -int config_show(int, char *[]); int config_string(pkg_config_key, const char **); int config_bool(pkg_config_key, bool *); diff --git a/usr.sbin/pkg/pkg.c b/usr.sbin/pkg/pkg.c index 3d4119d85bf8..7b574dc42db2 100644 --- a/usr.sbin/pkg/pkg.c +++ b/usr.sbin/pkg/pkg.c @@ -1195,11 +1195,6 @@ main(int argc, char *argv[]) else if (strcmp(command, "bootstrap") == 0) { bootstrap_only = true; } - else if (strcmp(command, "config") == 0 && - activation_test) { - exit(config_show(argc - optind, - argv + optind)); - } } // bootstrap doesn't accept other arguments else if (bootstrap_only) {