[Python-bugs-list] [ python-Bugs-600952 ] Installing w/o admin generates key error

noreply@sourceforge.net noreply@sourceforge.net
Tue, 27 Aug 2002 12:51:26 -0700


Bugs item #600952, was opened at 2002-08-27 19:49
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=600952&group_id=5470

Category: Distutils
Group: None
Status: Open
Resolution: None
Priority: 5
Submitted By: Phil Rittenhouse (prittenh)
>Assigned to: Thomas Heller (theller)
Summary: Installing w/o admin generates key error

Initial Comment:
I encountered the following problem when trying to 
install a package I had generated with distutils 
(Python 2.2 on Win2k, logged in as a user without 
adminstrative priveleges):

When the installer was run, it would go through the 
steps nicely, but towards the end, it generated two 
errors:
        "Could not open key
Software\Microsoft\Windows\CurrentVersion\Unins
tall"
        "Could not create key  dsp-py2.1"

At first I thought the problem might be the result 
of installing Python as Administrator, and the 
package as just a user, so I re-installed Python as a 
user, but I still got the same error.  I ran my test on 
Win2K with both Python 2.1 and 2.2, and I always 
got the same result.

I tracked the code generating the error to install.c in
distutils-1.0.2/misc (see below).  I did some 
digging and it appears that to use 
KEY_ALL_ACCESS, the code must be running
with Administrator privileges.   I checked the CVS 
archives to see if KEY_ALL_ACCESS is
still being used, and it is.

I made the following changes to install.c (from 
Distutils 1.0.2), recompiled, and it  works now.
796c796
<                         KEY_CREATE_SUB_KEY,
---
>                         KEY_ALL_ACCESS,
806c806
<                           KEY_WRITE,
---
>                           KEY_ALL_ACCESS,
1177c1177
<                KEY_WRITE,
---
>                KEY_ALL_ACCESS,
1208c1208
<                KEY_WRITE,
---
>                KEY_ALL_ACCESS,


I chose KEY_CREATE_SUB_KEY for the open, since 
that is the only operation that will be performed
on it.   For the new key itself, I chose KEY_WRITE, 
since that was also the minimal operation.  While I
was at it, I changed the code for deleting the 
registry key and value to also use the minimal 
KEY_WRITE.  The last two changes allowed the 
uninstaller to work properly when run as a normal 
user.


----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=600952&group_id=5470