From: Doug Smythies <doug.smythies@gmail.com>
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 [thread overview]
Message-ID: <1488871772-12624-1-git-send-email-dsmythies@telus.net> (raw)
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 <dsmythies@telus.net>
---
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)
--
2.7.4
reply other threads:[~2017-03-07 8:36 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1488871772-12624-1-git-send-email-dsmythies@telus.net \
--to=doug.smythies@gmail.com \
--cc=dsmythies@telus.net \
--cc=len.brown@intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=rjw@rjwysocki.net \
--cc=srinivas.pandruvada@linux.intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).