diff --git a/installer/InstallBuilder/linuxdpkg.py b/installer/InstallBuilder/linuxdpkg.py index aca402e..c95fe98 100644 --- a/installer/InstallBuilder/linuxdpkg.py +++ b/installer/InstallBuilder/linuxdpkg.py @@ -87,7 +87,7 @@ def GenerateScripts(self): for l in self.sections["Links"]: filePath = self.stagingDir + l.stagedLocation - retval = os.system('sudo chown --no-dereference %s:%s %s' \ + retval = os.system('sudo chown --no-dereference %s:%s "%s"' \ % (l.owner, l.group, filePath)) if retval != 0: print("Error: Unable to chown " + l.stagedLocation) diff --git a/installer/InstallBuilder/scxutil.py b/installer/InstallBuilder/scxutil.py index ac230db..243ead2 100644 --- a/installer/InstallBuilder/scxutil.py +++ b/installer/InstallBuilder/scxutil.py @@ -82,7 +82,7 @@ def Touch(path): def ChOwn(path,uid,gid): # Must use 'os.system' rather than os.chown because 'root' will be passed # (and we use 'sudo' to allow things like uid=root) - retval = os.system('sudo chown %s:%s %s' % (uid,gid,path)) + retval = os.system('sudo chown %s:%s "%s"' % (uid,gid,path)) if retval != 0: print("Unable to chown %s." % path) exit(1) @@ -94,7 +94,7 @@ def ChOwn(path,uid,gid): # def ChMod(path,mode): # Muse use 'os.system' rather than os.chmod because we may need 'sudo' ... - retval = os.system('sudo chmod %s %s' % (mode, path)) + retval = os.system('sudo chmod %s "%s"' % (mode, path)) if retval != 0: print("Unable to chmod %s." % path) exit(1) diff --git a/installer/InstallBuilder/unittests/filename_with_space.data b/installer/InstallBuilder/unittests/filename_with_space.data new file mode 100644 index 0000000..0ba80b9 --- /dev/null +++ b/installer/InstallBuilder/unittests/filename_with_space.data @@ -0,0 +1,3 @@ +%Files +/tmp/space in file.txt; space in file.txt; 777; root; root + diff --git a/installer/InstallBuilder/unittests/ib_unittests.py b/installer/InstallBuilder/unittests/ib_unittests.py index a1b539a..3ffeec8 100644 --- a/installer/InstallBuilder/unittests/ib_unittests.py +++ b/installer/InstallBuilder/unittests/ib_unittests.py @@ -221,6 +221,12 @@ def Test_LargeConditionalPath(): print("PASS") +# This test validates that we can build a package with a filename with spaces +def Test_FilenameWithSpace(): + print("TEST: " + inspect.currentframe().f_code.co_name) + RunInstallBuilder("base_dummy.data filename_with_space.data") + + print("PASS") # MAIN Variables = dict() @@ -270,3 +276,4 @@ def Test_LargeConditionalPath(): Test_SectionsInNumericOrder() Test_VariableOverride() Test_LargeConditionalPath() +Test_FilenameWithSpace() diff --git a/installer/InstallBuilder/unittests/space in file.txt b/installer/InstallBuilder/unittests/space in file.txt new file mode 100644 index 0000000..5de6459 --- /dev/null +++ b/installer/InstallBuilder/unittests/space in file.txt @@ -0,0 +1 @@ +space in file text