Received: by 10.223.176.46 with SMTP id f43csp1232642wra; Wed, 24 Jan 2018 12:54:57 -0800 (PST) X-Google-Smtp-Source: AH8x226Z9okJHtL8mtupfj+s90uWwBkh54JhjYOB0lNn6whAmN2BYsJnL/Fd94dANwlZbs6v8/96 X-Received: by 10.98.65.193 with SMTP id g62mr13963787pfd.60.1516827297163; Wed, 24 Jan 2018 12:54:57 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1516827297; cv=none; d=google.com; s=arc-20160816; b=jLrvuKjip9ufgHqirZIuvoGyBDlfGpSNTRRRfY8fIN7PcrFq2Nh5tdItni8Q+4MdQm /RY7nMmQ8OjLiRyADxnRxU3xmBeYD1CzdHHtL8J+Mtlc2nUfVZpARUBYTVPqr7zvK2WL v+Nj5tlPCe26qay9YLrXTpn3vV7clrTUbTVFLOMnCISoPP2bklE8NZu9I9VUJzFW4RVO eqguW+XVnQlrp9/3AWum76NagSVsSMqTu0UEV3xuury7pxEDCz2rudpqUrPSfBAnY3IH Xyrt+QvenlX6lsB1Z2GCgBTUE6kcz36HcHff23K77ij9nu+6HlL/kAXgQ2cObH8KDFXE OAiw== 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=JuDxv6QsfLjSMvTS53osqHOy/TkO66QGRA9/oxJBknw=; b=svV8IX3dGvuM4f7iCcM5wWYKg4IkUkUDDj3dQoxL1CO6BmGEJpcLb/NsJFKmgvNgX7 svahRcaq/oXWuZbS4DWoMae3M6mVNdAykHclsVz4bdUV4pPdeE6xb24YpIfRMgsupcMr euG633VTRosN8IuKmGsNzOW/nB3jLzNBHM5hyCKtJlW/XmGFhLcMo7YwZ5llwePW/GPF TAOh+4zBiFyzh0W0MyYpQV8fXeW/vMXcWFvH6GE1Ohu8EQJFy2AWiq1f/wQotL3YZoKs fsqvXWilQsKXG64CEpkm3rT/5QXzBVMBfvPGOX9Jvni756SyQjZuQ0LWzKU4pvLGJwss wpUg== 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id e18si566690pgo.365.2018.01.24.12.54.42; Wed, 24 Jan 2018 12:54:57 -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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932608AbeAXUyN (ORCPT + 99 others); Wed, 24 Jan 2018 15:54:13 -0500 Received: from mx1.redhat.com ([209.132.183.28]:49466 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932114AbeAXUyM (ORCPT ); Wed, 24 Jan 2018 15:54:12 -0500 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 896D3C00F717; Wed, 24 Jan 2018 20:54:12 +0000 (UTC) Received: from treble (ovpn-124-179.rdu2.redhat.com [10.10.124.179]) by smtp.corp.redhat.com (Postfix) with SMTP id ABF2160A9D; Wed, 24 Jan 2018 20:54:11 +0000 (UTC) Date: Wed, 24 Jan 2018 14:54:11 -0600 From: Josh Poimboeuf To: Arvind Sankar Cc: linux-kernel@vger.kernel.org, Greg Kroah-Hartman , Peter Zijlstra , Ingo Molnar , Arnaldo Carvalho de Melo Subject: Re: [PATCH] tools: libsubcmd: Drop the less hack that was inherited from Git. Message-ID: <20180124205411.lpzcpqnuw3nlyg4n@treble> References: <20180124003831.GA34667@rani.riverdale> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20180124003831.GA34667@rani.riverdale> User-Agent: Mutt/1.6.0.1 (2016-04-01) X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.31]); Wed, 24 Jan 2018 20:54:12 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Jan 23, 2018 at 07:38:37PM -0500, Arvind Sankar wrote: > 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 Looks good to me. Acked-by: Josh Poimboeuf Libsubcmd is used by perf and objtool, so adding the perf maintainers to CC. Arnaldo, do you want to pick this one up? > --- > 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 > -- Josh