Fix PORTAGE_WORKDIR_MODE parsing so that the validated value is stored in mysettings.
authorZac Medico <zmedico@gentoo.org>
Sat, 18 Mar 2006 02:29:21 +0000 (02:29 -0000)
committerZac Medico <zmedico@gentoo.org>
Sat, 18 Mar 2006 02:29:21 +0000 (02:29 -0000)
svn path=/main/trunk/; revision=2930

pym/portage.py

index 0939091a9e2185c3c76f3df1f10b73ece58b0e0e..a6ace930d5d507f94ad06f78a7be20f1a7b2a3fe 100644 (file)
@@ -2645,15 +2645,18 @@ def prepare_build_dirs(myroot, mysettings, cleanup):
 
        workdir_mode = 0700
        try:
-               workdir_mode = int(eval(mysettings["PORTAGE_WORKDIR_MODE"]))
-               if workdir_mode & 07777 != workdir_mode:
+               parsed_mode = int(eval(mysettings["PORTAGE_WORKDIR_MODE"]))
+               if parsed_mode & 07777 != parsed_mode:
                        raise ValueError("Invalid file mode: %s" % mysettings["PORTAGE_WORKDIR_MODE"])
+               else:
+                       workdir_mode = parsed_mode
        except KeyError, e:
                writemsg("!!! PORTAGE_WORKDIR_MODE is unset, using %s." % oct(workdir_mode))
        except (ValueError, SyntaxError), e:
                writemsg("%s\n" % e)
                writemsg("!!! Unable to parse PORTAGE_WORKDIR_MODE='%s', using %s.\n" % \
                (mysettings["PORTAGE_WORKDIR_MODE"], oct(workdir_mode)))
+       mysettings["PORTAGE_WORKDIR_MODE"] = oct(workdir_mode)
        try:
                apply_secpass_permissions(mysettings["WORKDIR"],
                uid=portage_uid, gid=portage_gid, mode=workdir_mode)