Received: by 10.223.176.46 with SMTP id f43csp85872wra; Tue, 23 Jan 2018 16:40:07 -0800 (PST) X-Google-Smtp-Source: AH8x227KNsCYEsoU75nUhLRAijAyz7fDBqrNO22ZfGKyg6K/zFlZhUprm+57fr7pf0XS5w13cKcG X-Received: by 10.101.83.195 with SMTP id z3mr9633325pgr.133.1516754407082; Tue, 23 Jan 2018 16:40:07 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1516754407; cv=none; d=google.com; s=arc-20160816; b=Xhm03Ium0HNajnHBW700Tqftg/bHleT1aZjzm0KgT51QuwDUlEvaQ5KDu9JUrh/SKs MT2+eJXVgWkgPN6FlH/fN61PTLzI+nacw0NIEBhEQdQhi3hYNTNvpbroLJSrF7aRQyUZ 5rwQ+kKVP6vCvrFXCSG0I4EL5MO2+hqADFnko138vn0zw4SiePJ3nfU17iq8dfzkVsNT RA0W2RY75rSC+wKkdnYANuIZ0bIGIBRnn35BqIy0r6evK+eToK1y+BMr4i5IqbLPRgcV 73kolwqjPGwgLot1vKb+G/1rvB5kT9i9SyTObW2gecbutMtHB133bZjMLt4q3X9MyXJV sq2Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:content-disposition :mime-version:message-id:subject:cc:to:from:date :arc-authentication-results; bh=0T78cxOaHYn+62eyuZBQLarxOE8UOReRSkP3o26pSUE=; b=eW83VkQIReiPN7NWrpNY3JOEyGaIvCrF+9n4fFF4q0pIh2iSX0/qljqiL7u1SqWPFk 3JE4+vDFmxk4aoAm+O9M1K95u5iHpOySAQ+w8dsE61bBn7c5RXRi/CYv5Ii5GUQ24L5b s2LvLE7siar+hnMonEXEwDFzQgSRGLuoDRFVhcmP9EuJBMiWLQGUv3n4Hwwc93Ux0vhp Xt9MvbAyw5iHjGZMpFn6ueg1kA25Q9FtpSVEepw0Tfd5QSarhDaR7TWmBDk5iCH8iLpx JOkCuzT+U7lRhbaBN1JLRVHWBS7B/jTAl2j+yCtXTLvxkvwZEEhVcR11lmjrgkgkMz6E otmQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id a23-v6si4136535pls.382.2018.01.23.16.39.52; Tue, 23 Jan 2018 16:40:07 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752785AbeAXAio (ORCPT + 99 others); Tue, 23 Jan 2018 19:38:44 -0500 Received: from mail-qt0-f194.google.com ([209.85.216.194]:34196 "EHLO mail-qt0-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752692AbeAXAin (ORCPT ); Tue, 23 Jan 2018 19:38:43 -0500 Received: by mail-qt0-f194.google.com with SMTP id a27so6318833qtd.1 for ; Tue, 23 Jan 2018 16:38:42 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:mime-version :content-disposition:user-agent; bh=0T78cxOaHYn+62eyuZBQLarxOE8UOReRSkP3o26pSUE=; b=ZsUxnj0vH3pvrG+kIio/qiJoOGSDPMJ9s23R4BdXQVIzrvB4j2fsmsdTgA+st0+++R CVBXUrs7XMzYOeQEcxJk4vzdOZRcMlSbkKVvsNK+cUperF3Fhc+vaaNdeiRzZmB9fHKP NPZkFnFMbwuYyBq6x8jaUMZu9xJOSSCPRWPf9snauLcwwU/xm5hJHfaGjdycbWjwOupu jmxVz4XXWPCvmYvXbc/3v3jOo79BY0O3WpZ5ReiCLFmq4tV4SZFAHppxPRlnc9iU8tI9 KPMd7XKOfoDXtIaluL4+LwuZJVqrmY4VkT4nh8835il2wSKgnV1Gtse479Ftlxe7VM8h XOMQ== X-Gm-Message-State: AKwxytePeHvBZFo8cYgFW4v1TgrHg1M3YycdhFvxOoGP8xwYhffXbQR2 5vFMr+D7Pp1jUExRx5Ib95dGWllS X-Received: by 10.237.63.14 with SMTP id p14mr6463323qtf.225.1516754322184; Tue, 23 Jan 2018 16:38:42 -0800 (PST) Received: from rani.riverdale (pool-100-8-221-136.nwrknj.fios.verizon.net. [100.8.221.136]) by smtp.gmail.com with ESMTPSA id j19sm1295570qtc.1.2018.01.23.16.38.41 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 23 Jan 2018 16:38:42 -0800 (PST) Date: Tue, 23 Jan 2018 19:38:37 -0500 From: Arvind Sankar To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , Josh Poimboeuf Subject: [PATCH] tools: libsubcmd: Drop the less hack that was inherited from Git. Message-ID: <20180124003831.GA34667@rani.riverdale> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline User-Agent: Mutt/1.7.2 (2016-11-26) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org We inherited this hack with the original code from the Git project. The select call is invalid as the two fd_set pointers should not be aliased. We could fix it, but the Git project removed this hack in 2012 in commit e8320f3 (pager: drop "wait for output to run less" hack). The bug it worked around was apparently fixed in less back in June 2007. So remove the hack from here as well. Signed-off-by: Arvind Sankar --- tools/lib/subcmd/pager.c | 17 ----------------- tools/lib/subcmd/run-command.c | 2 -- tools/lib/subcmd/run-command.h | 1 - 3 files changed, 20 deletions(-) diff --git a/tools/lib/subcmd/pager.c b/tools/lib/subcmd/pager.c index 5ba754d17952..94d61d9b511f 100644 --- a/tools/lib/subcmd/pager.c +++ b/tools/lib/subcmd/pager.c @@ -1,5 +1,4 @@ // SPDX-License-Identifier: GPL-2.0 -#include #include #include #include @@ -23,21 +22,6 @@ void pager_init(const char *pager_env) subcmd_config.pager_env = pager_env; } -static void pager_preexec(void) -{ - /* - * Work around bug in "less" by not starting it until we - * have real input - */ - fd_set in; - - FD_ZERO(&in); - FD_SET(0, &in); - select(1, &in, NULL, &in, NULL); - - setenv("LESS", "FRSX", 0); -} - static const char *pager_argv[] = { "sh", "-c", NULL, NULL }; static struct child_process pager_process; @@ -84,7 +68,6 @@ void setup_pager(void) pager_argv[2] = pager; pager_process.argv = pager_argv; pager_process.in = -1; - pager_process.preexec_cb = pager_preexec; if (start_command(&pager_process)) return; diff --git a/tools/lib/subcmd/run-command.c b/tools/lib/subcmd/run-command.c index 5cdac2162532..9e9dca717ed7 100644 --- a/tools/lib/subcmd/run-command.c +++ b/tools/lib/subcmd/run-command.c @@ -120,8 +120,6 @@ int start_command(struct child_process *cmd) unsetenv(*cmd->env); } } - if (cmd->preexec_cb) - cmd->preexec_cb(); if (cmd->exec_cmd) { execv_cmd(cmd->argv); } else { diff --git a/tools/lib/subcmd/run-command.h b/tools/lib/subcmd/run-command.h index 17d969c6add3..6256268802b5 100644 --- a/tools/lib/subcmd/run-command.h +++ b/tools/lib/subcmd/run-command.h @@ -46,7 +46,6 @@ struct child_process { unsigned no_stderr:1; unsigned exec_cmd:1; /* if this is to be external sub-command */ unsigned stdout_to_stderr:1; - void (*preexec_cb)(void); }; int start_command(struct child_process *); -- 2.13.6