From patchwork Sun Apr 16 15:17:14 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Doug Smythies X-Patchwork-Id: 9683019 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 5928660138 for ; Sun, 16 Apr 2017 15:17:32 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 494CE20410 for ; Sun, 16 Apr 2017 15:17:32 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 3CAE322701; Sun, 16 Apr 2017 15:17:32 +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 C70F420410 for ; Sun, 16 Apr 2017 15:17:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756180AbdDPPR3 (ORCPT ); Sun, 16 Apr 2017 11:17:29 -0400 Received: from mail-pf0-f196.google.com ([209.85.192.196]:34842 "EHLO mail-pf0-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755830AbdDPPR2 (ORCPT ); Sun, 16 Apr 2017 11:17:28 -0400 Received: by mail-pf0-f196.google.com with SMTP id a188so21221555pfa.2; Sun, 16 Apr 2017 08:17:28 -0700 (PDT) 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=hluPcqq/3yQTDSHThTFT4IP5CUA1dGYhmY4Px8lDOyduQEYYYyloB0n5iNPj2h+srn GrI3WtcAHPIYrbHmKYmdSe7dVeVP3F5PvuccAvpP9RbAvxlvYD4Xe7TZxkQuj7+Z5/3l wO0c/Hqha+sGIAlrvjmsouuzxlt4/gIsTX3Q1TjNcudBR8T7Hfsy/i5YRENL3m0DyD5f P3eT2U/AMVAKKrbnFlqTGXvikv5XNf2EAhE1Ft3N2OzvTC5gklsrtVb9z2L/JjS9wndH JD3pcKDMJv3eI77RC5BEeeotOLz7Fz7GFHCtPjJvrFwF0DM6KeP9LHYiL0iCNJ+SGYtW ESTw== 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=lU/ZgCqFG3tAfANgqZFo1bok35ToFCGHC34DqbGSuBLAxty55grVs5xNmX1uxfuoCT JryOyQMZS/QTzT+K/CnNAIZ7jRVHkx45+JQiKwAdna+cYJzmnhLVnneT08ZjQJ9MuaIc kGtyn30AIKQzZKcZxccmpifQmmarsHm91IZQCZ/ExMFTXrhtlx+0I3v9X9vO5l+VG/rX rCqqfcUDeTYeC9sczkUPe4ek65VgPV3aLWK5ICLoUeUzBe159imBg2eG019Vk8mC0JEX +g/EArAAd8NHr45IIu0/Odt5xuXdY5Jhm2zPy9DoIwc9Zi/fjtqSJm5rAv/aq9sYYQ9h YyHw== X-Gm-Message-State: AN3rC/5JJlYgXOHA2JiHf32IdhxYzxQcfnxdGRAmRw/mxAsIdkESBPU2 1InrgFmggrY++A== X-Received: by 10.99.123.20 with SMTP id w20mr7346110pgc.223.1492355847736; Sun, 16 Apr 2017 08:17:27 -0700 (PDT) Received: from s15.smythies.com (mail.smythies.com. [173.180.45.4]) by smtp.gmail.com with ESMTPSA id c7sm13119662pgn.24.2017.04.16.08.17.26 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sun, 16 Apr 2017 08:17:27 -0700 (PDT) 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: [RESEND PATCH] tools/power/x86/intel_pstate_tracer: Adjust directory permissions Date: Sun, 16 Apr 2017 08:17:14 -0700 Message-Id: <1492355834-7793-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)