From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.5 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_PASS,USER_AGENT_MUTT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id AFF88C43381 for ; Thu, 21 Feb 2019 22:23:33 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 77D292083E for ; Thu, 21 Feb 2019 22:23:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726630AbfBUWXc (ORCPT ); Thu, 21 Feb 2019 17:23:32 -0500 Received: from mga18.intel.com ([134.134.136.126]:25162 "EHLO mga18.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725891AbfBUWXb (ORCPT ); Thu, 21 Feb 2019 17:23:31 -0500 X-Amp-Result: UNSCANNABLE X-Amp-File-Uploaded: False Received: from fmsmga007.fm.intel.com ([10.253.24.52]) by orsmga106.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 21 Feb 2019 14:23:31 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.58,397,1544515200"; d="scan'208";a="124258143" Received: from tassilo.jf.intel.com (HELO tassilo.localdomain) ([10.7.201.137]) by fmsmga007.fm.intel.com with ESMTP; 21 Feb 2019 14:23:30 -0800 Received: by tassilo.localdomain (Postfix, from userid 1000) id A3AF5300F3B; Thu, 21 Feb 2019 14:23:30 -0800 (PST) Date: Thu, 21 Feb 2019 14:23:30 -0800 From: Andi Kleen To: Jiri Olsa Cc: Arnaldo Carvalho de Melo , lkml , Ingo Molnar , Namhyung Kim , Alexander Shishkin , Peter Zijlstra , Adrian Hunter , Stephane Eranian , Alexey Budankov Subject: Re: [PATCH 04/17] perf data: Fail check_backup in case of error Message-ID: <20190221222330.GD16922@tassilo.jf.intel.com> References: <20190221094145.9151-1-jolsa@kernel.org> <20190221094145.9151-5-jolsa@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190221094145.9151-5-jolsa@kernel.org> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Feb 21, 2019 at 10:41:32AM +0100, Jiri Olsa wrote: > And display the error message from removing > the old data file: > > $ perf record ls > Can't remove old data: Permission denied (perf.data.old) > Perf session creation failed. > > Not sure how to make fail the rename (after we successfully > remove the destination file/dir) to show the message, > anyway let's have it there. The use of rm_rf is really scary. So I simple command line typo could turn this into rm -rf / ? Please add some sanity checks to not remove multiple levels, and only remove files which look like they are generated by perf. -Andi