From patchwork Tue Mar 7 07:29:32 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Doug Smythies X-Patchwork-Id: 9608253 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 609D26046A for ; Tue, 7 Mar 2017 08:36:51 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 51FA92846A for ; Tue, 7 Mar 2017 08:36:51 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 45A7B284C9; Tue, 7 Mar 2017 08:36:51 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.5 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_SPAM autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E38492846A for ; Tue, 7 Mar 2017 08:36:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751258AbdCGIgu (ORCPT ); Tue, 7 Mar 2017 03:36:50 -0500 Received: from mail-pf0-f196.google.com ([209.85.192.196]:33248 "EHLO mail-pf0-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750744AbdCGIgt (ORCPT ); Tue, 7 Mar 2017 03:36:49 -0500 Received: by mail-pf0-f196.google.com with SMTP id v190so9509045pfb.0; Tue, 07 Mar 2017 00:35:56 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=SVmbc7q38Mr13hQwKywvfpBniFcj4UYn7tfMUCDt1Ao=; b=nRbMZt4x1uPCMHbpecFTu4ID4g074rNx8XKQ6fwfKkdTfL5asw1+1slnOzUkFK7v8t wyInuJvkIZfhsU8w8Mxetui7/iA7jRd92xTtF5oyoqFhAkhlMVvQ/qomBz8/B/4KUvFL uCvclxraWRS90SpVDfagqKIe1XyxWGRYlNUbYuAhq51uihVNPJkOLvkdJ/exoXDXR/0Y TxXjmI0ruuzLx2sd1Na1xICf30wQRN8lpAyt2UJZXygVfdwJlEl6cdXo7a75yUq3aHbq ilQoNWXnEwOXfVmmfuB6A54GbVtDwbZJcvmFK17+dWX6k89OB6z4O3XMVfBjEJAE9F7Z AX3A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=SVmbc7q38Mr13hQwKywvfpBniFcj4UYn7tfMUCDt1Ao=; b=rnKW08Z2Dr3dd3mh8RixPq9/WsRlE9YjKIcj58b9FVrmKLf+I1kDXX8qcK6i7ehN6X RE1KR61ldlRQgLDFj3X5Eb6emtUkIWmoEi2JyyXhgaQjE5a9Dspldo6UVZfWZpyqrach 7++2il6aNjzMogvw8lbMIYbaUPmKt0pPwW6/b5AnreuLLlYilPjph9x9/0yS5T2oJPae vezJF8CStcheMByMCDfO1Dkvvgb9TDWszCBPSOqEaT7kmDQwf5OKmca9BRs7/up4cCDG Qgy5EjX+afe2btUwNKLbFINYUtEwYH8MeOQIIf0Ot+ThLri22vedDJ6a8qvzDYNBhnB1 /T7Q== X-Gm-Message-State: AMke39k5YB38FjNLaSFw7wlm1KL6O1KPOooh1NxQ1goDCsZzNVSRU/YjWpdoqK5Sy+yU1g== X-Received: by 10.99.140.77 with SMTP id q13mr25324411pgn.179.1488871785097; Mon, 06 Mar 2017 23:29:45 -0800 (PST) Received: from s15.smythies.com (mail.smythies.com. [173.180.45.4]) by smtp.gmail.com with ESMTPSA id c28sm43660921pfj.77.2017.03.06.23.29.44 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 06 Mar 2017 23:29:44 -0800 (PST) From: Doug Smythies X-Google-Original-From: Doug Smythies To: srinivas.pandruvada@linux.intel.com, rjw@rjwysocki.net, len.brown@intel.com Cc: dsmythies@telus.net, linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org Subject: [PATCH] tools/power/x86/intel_pstate_tracer: Adjust directory permissions Date: Mon, 6 Mar 2017 23:29:32 -0800 Message-Id: <1488871772-12624-1-git-send-email-dsmythies@telus.net> X-Mailer: git-send-email 2.7.4 Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Depending on what is being done, the intel_pstate_tracer.py script needs to be run as root, or can be run as a regular user. If run the first time as root the results directory will be incorrect for any subsequent run as a regular user. For any run as root the specific testname subdirectory will not allow any subsequent file saves by a regular user. Typically, and for example, the regular user might be attempting to save a .csv file converted to a spreadsheet with added calculations or graphs. Override the default folder permissions. Signed-off-by: Doug Smythies --- tools/power/x86/intel_pstate_tracer/intel_pstate_tracer.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/tools/power/x86/intel_pstate_tracer/intel_pstate_tracer.py b/tools/power/x86/intel_pstate_tracer/intel_pstate_tracer.py index fd706ac..7c855508 100755 --- a/tools/power/x86/intel_pstate_tracer/intel_pstate_tracer.py +++ b/tools/power/x86/intel_pstate_tracer/intel_pstate_tracer.py @@ -517,13 +517,19 @@ else: cpu_mask[i] = 1 if not os.path.exists('results'): + # Setting permissions with the mode option doesn't work on all platforms os.mkdir('results') + # so use chmod to set them. Needed because user may or may not be root. + os.chmod('results', 0777) os.chdir('results') if os.path.exists(testname): print('The test name directory already exists. Please provide a unique test name. Test re-run not supported, yet.') sys.exit() +# Setting permissions with the mode option doesn't work on all platforms os.mkdir(testname) +os.chmod(testname, 0777) +# so use chmod to set them. Needed because user may or may not be root. os.chdir(testname) # Temporary (or perhaps not)