Received: by 10.223.176.5 with SMTP id f5csp36717wra; Thu, 8 Feb 2018 16:01:23 -0800 (PST) X-Google-Smtp-Source: AH8x225uMuioh6QPkRWdLdnhc65WxtUe3EmEyoMPRqKOGYdLcqRoQTap/VaFRH+RTbx1MoxutpOH X-Received: by 10.98.25.207 with SMTP id 198mr775885pfz.83.1518134483097; Thu, 08 Feb 2018 16:01:23 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1518134483; cv=none; d=google.com; s=arc-20160816; b=QO+kW58Ix25EIj2aGVI7n31SmzpaPOIABzFjDQLGHH7nG4obCPy6WRhKmy6CxBtOYm NjeS1Zdu1EftAgDF0uhkxCtqFb8mA89/QMW5iGG4oowhtSPkzY3EtfJ4/tCXh1xq4hel TPnWJEXA16Y+Pdgj4gKjH7NX//6ahVZeEAmxxJrXYs4tls+YSfbp11KravC7bP90jk0K Svc4YD4SU7F/EI6jLrqDlEOBx6U9j3HLQ7D2k8j7CDYUilQt6WcDtEXZwXttP1wYEjNM u2zi5pp79gLwVbQ3H/5KsYBpgCakmv0m0DMKNPPPMUY01POd1w8J9QvjueMHy8szPkwD iUMQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:arc-authentication-results; bh=ERoW/LoC8fOaRzaUh8Vm9rRUerr56NktfU4uEm3k+vw=; b=jcQQKVquo0z9i9TKkYy17LWhqBQT8IPlppemO5nWzE1jO+4udS0gPR8avsyLRI2JJB iVS8FdN6z8Q+ltzEVpRD9iBaVo/Yvns144kNR8I4jhWa1xLoYrGZvIojqy5Ig5vWT5d0 oRUnPFxfU4avYDHcZ2xiQ6bm8gew+uie406tjvdNRmmuTAcsakAWxfn/k2ceOLEcdOoF CHdU5sOId5HNM1qTDCXXqG8UBDj5mGW7xO+y6tIqJTHOnFksgXouzeSDkUSrmLOCadQU 6gWWIggezcbFPBFmZ9j0bM8U+YLTpKcc4JiG30zhGDHfaMwnCI/oR48UAEIluVa3nIQV ixTQ== 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 63si596003pgi.596.2018.02.08.16.01.07; Thu, 08 Feb 2018 16:01:22 -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 S1752201AbeBIAAR (ORCPT + 99 others); Thu, 8 Feb 2018 19:00:17 -0500 Received: from mail-qt0-f193.google.com ([209.85.216.193]:34110 "EHLO mail-qt0-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751998AbeBIAAP (ORCPT ); Thu, 8 Feb 2018 19:00:15 -0500 Received: by mail-qt0-f193.google.com with SMTP id d14so8517050qtg.1 for ; Thu, 08 Feb 2018 16:00:15 -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:references :mime-version:content-disposition:in-reply-to:user-agent; bh=ERoW/LoC8fOaRzaUh8Vm9rRUerr56NktfU4uEm3k+vw=; b=WyOI5+ocHhn366VP3znKHDaRTo5pgpxrKna/+N7uxPZFdP3NcEn45+N93VPbSn0Xyv mW6rP1e9cZS6a8+6aHUYD1TzrG7Zigei5c1pmgG2KLyy2IhDn8rNbsgglrggHrz11X4h HhIhN3XKsWZEqJmq5DkXHPXxCngBIf334jrHRGiXp87w/XSCdXgRudYQgEH88jHJbgF1 7igGwWQpD296GrRt69/FX5eIeDVlu7/lIyiQdZKVMD4kgmbD0sohD+5wv0g8fpjQNd2f VXRh7xu2RTMuNFVAvHwL17F7SPCoEtRz00504uQJqKs1+RyCFN94d+SFh+RjcBamLntL BbCw== X-Gm-Message-State: APf1xPD7XzCX4rawkrREQQY/cBim49LctbsFuyPS6p6/nygRJi/gLV75 tlubCi/inTVnmQwIBNiACQpqAQ== X-Received: by 10.200.26.210 with SMTP id h18mr1534012qtk.223.1518134414974; Thu, 08 Feb 2018 16:00:14 -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 k2sm892771qtk.60.2018.02.08.16.00.14 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 08 Feb 2018 16:00:14 -0800 (PST) Date: Thu, 8 Feb 2018 19:00:10 -0500 From: Arvind Sankar To: Arnaldo Carvalho de Melo Cc: Josh Poimboeuf , linux-kernel@vger.kernel.org, Greg Kroah-Hartman , Peter Zijlstra , Ingo Molnar Subject: Re: [PATCH] tools: libsubcmd: Drop the less hack that was inherited from Git. Message-ID: <20180209000009.GA54330@rani.riverdale> References: <20180124003831.GA34667@rani.riverdale> <20180124205411.lpzcpqnuw3nlyg4n@treble> <20180125081652.GA23548@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20180125081652.GA23548@kernel.org> 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 --- - Merge with commit ad343a98 (tools/lib/subcmd/pager.c: do not alias select() params) by Sergey tools/lib/subcmd/pager.c | 20 -------------------- tools/lib/subcmd/run-command.c | 2 -- tools/lib/subcmd/run-command.h | 1 - 3 files changed, 23 deletions(-) diff --git a/tools/lib/subcmd/pager.c b/tools/lib/subcmd/pager.c index 9997a8805a82..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,24 +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_set exception; - - FD_ZERO(&in); - FD_ZERO(&exception); - FD_SET(0, &in); - FD_SET(0, &exception); - select(1, &in, NULL, &exception, NULL); - - setenv("LESS", "FRSX", 0); -} - static const char *pager_argv[] = { "sh", "-c", NULL, NULL }; static struct child_process pager_process; @@ -87,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