Received: by 2002:a05:6a10:17d3:0:0:0:0 with SMTP id hz19csp1626064pxb; Mon, 12 Apr 2021 02:46:23 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwk3s8V8pcM8H5KMVdsRdmwG2ugk+tPI/5jAFrdF3TK1LbQZ1k9G0FFVaH+B3HhDP/v6CXa X-Received: by 2002:a17:90a:3b4c:: with SMTP id t12mr12068452pjf.142.1618220783548; Mon, 12 Apr 2021 02:46:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1618220783; cv=none; d=google.com; s=arc-20160816; b=pBzu4PVRswtoRrtBtK4HjNnT+2f6nJ9Q6DPAgTbbntsYrp8azcKhbED7xZjP+YowpG u/8Nh+gjQc6FpSX6foQQx/xB0VBeOdxS7H8zeKxt/jslMsOKk+yVKdVFv0kXHzDzzRku eJfYUUg/U2B9Fz1IWh+s3XZI1A6yF7BNseR4mxWZ6id9cTIRVz9ZQ9TcOYeWcH3q/PsA e5VQESOO9x+49G2ZppqMgwbAIWAiItybl+yVoIAwdaYuLMlhPYe9AJzjUJToWI1yn073 Jr7CpmvgBDcm06vV/jxFfkEl5Q8sEo178eXCVi6tPOxc+E6dc8FvxpTTXqQAORexKJid stSA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=ErYAvZwf4BeutaDqFye6qEfDbyWVPVCAdYhPNuE3CdM=; b=cC2Rd0el98bFIKVZT75bkHG94XlB+Z22M33l4R1PXYojtxNIZCdI4nMan0Ad/xPxif /TMZ4hGyEEgRCiKwVWSCg+hkmaWfZKbewo4HF+YaxXVVKyweHVBWxP7WMccgE5+VGF1g JJRaVNV21maJVMidfAqSb/qorTe42oQCHgj3wYNDOmI70J77/pCQwb9iFfl/xVQub9+p 6XoZ3m2gplYz0Kf3IHcyv8kx1T/0hd1HszComtvOWURoZNrsPX6e1JGORkOGu6jyNeKv aDV828Dub2lqeyxSPDFdtn+l1GmIaButhADg9+rbZlZQm5yQzb2E8iaRbiCryVsIpbxI ANMg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="ehEv/o4O"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id n3si14300512pgt.383.2021.04.12.02.46.11; Mon, 12 Apr 2021 02:46:23 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="ehEv/o4O"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242583AbhDLJkl (ORCPT + 99 others); Mon, 12 Apr 2021 05:40:41 -0400 Received: from mail.kernel.org ([198.145.29.99]:35848 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240971AbhDLJLR (ORCPT ); Mon, 12 Apr 2021 05:11:17 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 0E2B6613C3; Mon, 12 Apr 2021 09:07:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1618218455; bh=0M6bUyhgdNHpt68OuYjW4TnIh3Hjh4bN64JdvKs3lzE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ehEv/o4OFRJiTst7baBbNfFzX8otFs2FE7kg6CUkpEdAYd1lId6ne/Emz69yKLJLa k0TgqXlwMIEyRQU1ZC7TUAmXmDhQa0q98zW04MC6V3mX7RLs9RcaLuiKHlj8jBtWDR bQUAZUQ2NnX50TK5eWjMPQgd1WugHFk+xIZciQco= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Adrian Hunter , Jiri Olsa , Andrew Vagin , Arnaldo Carvalho de Melo , Sasha Levin Subject: [PATCH 5.11 170/210] perf inject: Fix repipe usage Date: Mon, 12 Apr 2021 10:41:15 +0200 Message-Id: <20210412084021.687066121@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210412084016.009884719@linuxfoundation.org> References: <20210412084016.009884719@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Adrian Hunter [ Upstream commit 026334a3bb6a3919b42aba9fc11843db2b77fd41 ] Since commit 14d3d54052539a1e ("perf session: Try to read pipe data from file") 'perf inject' has started printing "PERFILE2h" when not processing pipes. The commit exposed perf to the possiblity that the input is not a pipe but the 'repipe' parameter gets used. That causes the printing because perf inject sets 'repipe' to true always. The 'repipe' parameter of perf_session__new() is used by 2 functions: - perf_file_header__read_pipe() - trace_report() In both cases, the functions copy data to STDOUT_FILENO when 'repipe' is true. Fix by setting 'repipe' to true only if the output is a pipe. Fixes: e558a5bd8b74aff4 ("perf inject: Work with files") Signed-off-by: Adrian Hunter Acked-by: Jiri Olsa Cc: Andrew Vagin Link: http://lore.kernel.org/lkml/20210401103605.9000-1-adrian.hunter@intel.com Signed-off-by: Arnaldo Carvalho de Melo Signed-off-by: Sasha Levin --- tools/perf/builtin-inject.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/perf/builtin-inject.c b/tools/perf/builtin-inject.c index 43937f4b399a..c0be51b95713 100644 --- a/tools/perf/builtin-inject.c +++ b/tools/perf/builtin-inject.c @@ -906,7 +906,7 @@ int cmd_inject(int argc, const char **argv) } data.path = inject.input_name; - inject.session = perf_session__new(&data, true, &inject.tool); + inject.session = perf_session__new(&data, inject.output.is_pipe, &inject.tool); if (IS_ERR(inject.session)) return PTR_ERR(inject.session); -- 2.30.2