Received: by 2002:a25:e7d8:0:0:0:0:0 with SMTP id e207csp349368ybh; Fri, 6 Mar 2020 23:37:27 -0800 (PST) X-Google-Smtp-Source: ADFU+vty/bQy1PBd+A7IQwoDYPPAd4DEvhFCUIevtIgU1akuwFbBfzQnR5CLCTLogpm4WswadoqK X-Received: by 2002:a05:6830:1089:: with SMTP id y9mr5755207oto.293.1583566647002; Fri, 06 Mar 2020 23:37:27 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1583566646; cv=none; d=google.com; s=arc-20160816; b=mneCmLqRopwTf+83TNWUrzfuPGD+O06VCxbcD//UcQlZPL5JvYLIEyFv1kk+Os5J/v HrUd7mjsHDR8k8dzLICEsFBHJitbHouE7TCPwBXxVQ0BuhIvpH49nmlATZ8bCLPsBEpi dgzrZIsOGx14lmJe1QBPNXem+q5mirAtv/P4i/dvDm1FgtNgd/dHCwfWbzdxnWQJJ4A5 wkEcLTBgDubHz94fcQSGnAxAcp++dq9jNXw4jKNfds6qcSxp/+wdNJDeHMCzJ2+zmKf0 BSeK6n3jcH1QivoG3ac9dFrq9VDAj77NkMQN4tn8olKah8UszIfvUe69K203t127Pa72 8+BQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :robot-unsubscribe:robot-id:message-id:mime-version:references :in-reply-to:cc:subject:to:reply-to:from:date; bh=xEd4H3fDWh0NRjtvFpesqJPhnKSiIBRZDcnm43Xn/gE=; b=YinJDJSjZ6+Bde9hoLwBiBix2xgWRSLix0C9FZCRrHyMTxOJpFnoT5i+j7i4dhKNN6 eCrAM+t7/i3dnJ8ekuMcwqylhAw7XYAMdugwA/rCOZ/4cWhB3FqNr1k365TjPHwCOVp7 Qshe2esDRkP9cS0qV3af+PAsm9EoJE1d9jnj72yD8WhljMHcStjZX/XncuJyQe9buv1O jxQMVRODCiGSND3jwU+1os8TDtaNBtB6Ex+wJu6o+IZIXOVrE8Cu8SbDxMkExIokDXGq T9CwKL7xFDM8GoLXSyjod2Xc3xpWVTTt65InTQckSJOd77zCR77qTXghF+cElIVUhwla Ochg== 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 o2si2843810otj.312.2020.03.06.23.37.14; Fri, 06 Mar 2020 23:37:26 -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 S1726017AbgCGHhB (ORCPT + 99 others); Sat, 7 Mar 2020 02:37:01 -0500 Received: from Galois.linutronix.de ([193.142.43.55]:55226 "EHLO Galois.linutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725815AbgCGHhB (ORCPT ); Sat, 7 Mar 2020 02:37:01 -0500 Received: from [5.158.153.53] (helo=tip-bot2.lab.linutronix.de) by Galois.linutronix.de with esmtpsa (TLS1.2:DHE_RSA_AES_256_CBC_SHA256:256) (Exim 4.80) (envelope-from ) id 1jAU0u-0004Hj-SV; Sat, 07 Mar 2020 08:36:49 +0100 Received: from [127.0.1.1] (localhost [IPv6:::1]) by tip-bot2.lab.linutronix.de (Postfix) with ESMTP id 836ED1C21F3; Sat, 7 Mar 2020 08:36:48 +0100 (CET) Date: Sat, 07 Mar 2020 07:36:48 -0000 From: "tip-bot2 for Tommi Rantala" Reply-to: linux-kernel@vger.kernel.org To: linux-tip-commits@vger.kernel.org Subject: [tip: perf/urgent] perf top: Fix stdio interface input handling with glibc 2.28+ Cc: Tommi Rantala , Arnaldo Carvalho de Melo , Alexander Shishkin , Jiri Olsa , Mark Rutland , Namhyung Kim , Peter Zijlstra , x86 , LKML In-Reply-To: <20200305083714.9381-2-tommi.t.rantala@nokia.com> References: <20200305083714.9381-2-tommi.t.rantala@nokia.com> MIME-Version: 1.0 Message-ID: <158356660826.28353.13798195042914131443.tip-bot2@tip-bot2> X-Mailer: tip-git-log-daemon Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit X-Linutronix-Spam-Score: -1.0 X-Linutronix-Spam-Level: - X-Linutronix-Spam-Status: No , -1.0 points, 5.0 required, ALL_TRUSTED=-1,SHORTCIRCUIT=-0.0001 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The following commit has been merged into the perf/urgent branch of tip: Commit-ID: 29b4f5f188571c112713c35cc87eefb46efee612 Gitweb: https://git.kernel.org/tip/29b4f5f188571c112713c35cc87eefb46efee612 Author: Tommi Rantala AuthorDate: Thu, 05 Mar 2020 10:37:12 +02:00 Committer: Arnaldo Carvalho de Melo CommitterDate: Fri, 06 Mar 2020 08:30:47 -03:00 perf top: Fix stdio interface input handling with glibc 2.28+ Since glibc 2.28 when running 'perf top --stdio', input handling no longer works, but hitting any key always just prints the "Mapped keys" help text. To fix it, call clearerr() in the display_thread() loop to clear any EOF sticky errors, as instructed in the glibc NEWS file (https://sourceware.org/git/?p=glibc.git;a=blob;f=NEWS): * All stdio functions now treat end-of-file as a sticky condition. If you read from a file until EOF, and then the file is enlarged by another process, you must call clearerr or another function with the same effect (e.g. fseek, rewind) before you can read the additional data. This corrects a longstanding C99 conformance bug. It is most likely to affect programs that use stdio to read interactive input from a terminal. (Bug #1190.) Signed-off-by: Tommi Rantala Tested-by: Arnaldo Carvalho de Melo Cc: Alexander Shishkin Cc: Jiri Olsa Cc: Mark Rutland Cc: Namhyung Kim Cc: Peter Zijlstra Link: http://lore.kernel.org/lkml/20200305083714.9381-2-tommi.t.rantala@nokia.com Signed-off-by: Arnaldo Carvalho de Melo --- tools/perf/builtin-top.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tools/perf/builtin-top.c b/tools/perf/builtin-top.c index f6dd1a6..d2539b7 100644 --- a/tools/perf/builtin-top.c +++ b/tools/perf/builtin-top.c @@ -684,7 +684,9 @@ repeat: delay_msecs = top->delay_secs * MSEC_PER_SEC; set_term_quiet_input(&save); /* trash return*/ - getc(stdin); + clearerr(stdin); + if (poll(&stdin_poll, 1, 0) > 0) + getc(stdin); while (!done) { perf_top__print_sym_table(top);