Received: by 2002:a05:6a10:17d3:0:0:0:0 with SMTP id hz19csp2101268pxb; Mon, 12 Apr 2021 14:33:00 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz8Tz5ufuZUPXJda1Q3WK3KAV63zUekZa9ydTA10M6AFOXo2oVK43pGdH67Yoc9EXtrEleS X-Received: by 2002:a17:907:2151:: with SMTP id rk17mr18719934ejb.203.1618263180438; Mon, 12 Apr 2021 14:33:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1618263180; cv=none; d=google.com; s=arc-20160816; b=RfJjBUubFQn5UIA/4NGouuAnC+rstAehsTw08fP5USg0BvHHDAAOD0X3Zzmt+gJvF8 fBtj7xpd2nev/+z2VgCQcjGK1ry7XeEw/rmOJEI9WDr6cXX2FaJD0YQpp1raBQ0VpB51 jDKC7hMBBcQCqpxLjIfn5snABxx26rYGyIaWfHX8CzM7yd72Y4LXvUK4aWpjYF/589kF 6W3mdBcqyzBIgTZHGijehE6zNc1J3pZKVEtUuJldXRIo/crMLi4hmEuDixMgbEXkJ1CU ruMez3D/tTPH/mPKtEG6i9mSByGGvIRfaIwSnBOQWLnSbqpebjJbMeV/b5IClYhdqLy7 GYrw== 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=6XT0Pl/naQPHuRkEx0gtrAJTqm05Zo9x27kg1FEI6w0=; b=GbvAMPEbtU7VkMiJKD0MAVsVAoFKzjE5xe6wDM0PwnteiPGM/rDa1SAqbZC2/AEU0N kOm/JYsHg1ZN9Xffhb/cSQSc02u5eZh7K5TbFKWYgPj2gprcqFfnrA+NSjeEsRgZXKLO hJ+9rCru2MedQxINBPRuaG+8Gj6zilW/UtQORpOGrUA61QXx/FyHaD4ULXzLjGJB5BuZ hylKUKFWVJLjkmfjJZ8LNzsg8Hldh0zfEEOHZ6tiFDUXsS319TjGnYt3mrx4Q8Qy5ES/ MMGRGPco+CMMc0v9LrTyJHT7reY8j5+ENIeLsKR4VOMARTuTJlYJZ8PHNi5197mh+Q9/ /inA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=EYCvA82Q; 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 cr12si4940547ejc.735.2021.04.12.14.32.36; Mon, 12 Apr 2021 14:33:00 -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=EYCvA82Q; 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 S240153AbhDLJOW (ORCPT + 99 others); Mon, 12 Apr 2021 05:14:22 -0400 Received: from mail.kernel.org ([198.145.29.99]:49260 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238383AbhDLI5f (ORCPT ); Mon, 12 Apr 2021 04:57:35 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id EE2E4611F0; Mon, 12 Apr 2021 08:56:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1618217799; bh=bn7xk2587tf5u0SIBmuae28JcTsJnThvn5v5KEIqttI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=EYCvA82QQzm9NJSvzL+/uCrBHJXi+L6K9Jw0YAqpFnIAD3IKGz7eDiLM0eOWubU0g mojiQJ1Fz27rV+IEkG+rT+rqnG8B++oBlYjMrWYYDaoyAqgaDQEJYqVG5ZPrUbjdqj TRs1Um4l/0p4HhAIrxwj2ZdHAI5VGlaFDcBZOUis= 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.10 150/188] perf inject: Fix repipe usage Date: Mon, 12 Apr 2021 10:41:04 +0200 Message-Id: <20210412084018.603261337@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210412084013.643370347@linuxfoundation.org> References: <20210412084013.643370347@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 0462dc8db2e3..5320ac1b1285 100644 --- a/tools/perf/builtin-inject.c +++ b/tools/perf/builtin-inject.c @@ -904,7 +904,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