Browse Source

Fixed an annoying bug with home dir

Essentially, using `sudo -u [user] -E` caused the full
environment to be copied over, including the home dir
of the current user. The problem is that `[user]` cannot
write to the home directory of the launching user.

Adding the -H flag causes the home directory to be
forcibly reset to the user specified with -u.
msmith-techempower 10 years ago
parent
commit
ed80baaeef
1 changed files with 2 additions and 1 deletions
  1. 2 1
      toolset/benchmark/framework_test.py

+ 2 - 1
toolset/benchmark/framework_test.py

@@ -197,12 +197,13 @@ class FrameworkTest:
     # This requires superuser privs, so `sudo` is necessary.
     #   -u [username] The username
     #   -E Preserves the current environment variables
+    #   -H Forces the home var (~) to be reset to the user specified
     # Note: check_call is a blocking call, so any startup scripts
     # run by the framework that need to continue (read: server has
     # started and needs to remain that way), then they should be
     # executed in the background.
     try:
-      retcode = subprocess.check_call('sudo -u %s -E ./%s.sh' % 
+      retcode = subprocess.check_call('sudo -u %s -E -H ./%s.sh' % 
         (self.benchmarker.runner_user, self.setup_file), 
         cwd=self.directory, shell=True, stderr=err, stdout=out)
       if retcode == None: