Bug#437978: Problem Found

2007-11-03 Thread Berg, Michael
I spent some time going through /var/lib/dpkg/info/monotone-server.postinst
and noticed that all user:group and permissions settings on lines
124-148 were getting done except for the if-block on lines 126-140.
The if-block that isn't getting done is
==
if [ -z `id -u monotone 2/dev/null` ]; then
   ...
==

After purging the installed monotone-server package, the monotone user
and group where still present on the system -- so when I would reinstall
 monotone-server, none of the user:group or permissions settings in that
if-block were being done on the newly created directories.

The monotone user and group were still present because of the section in
/var/lib/dpkg/info/monotone-server.postrm starting at line 80 with the
description:
==
# if deluser/delgroup exist, remove the server user and group.
# do not do this if /var/lib/monotone still exists (so that it
# will still have a named user owning it).
==

I use a key name for the monotone server that is different from the
auto-generated one, so there was still that key file in
/var/lib/monotone/keys, so /var/lib/monotone was still present and
prevented the monotone user and group from being removed, messing up
directory permissions on a reinstall.

Once I manually removed the user and group, installing monotone-server
sets the user:group and permissions correctly.


As one potential solution, would it work to move the chown and chmod
lines to just after the `id -u monotone 2/dev/null` if-block down to
with all the other chown and chmod lines being done on a new install?

That way the monotone user and group being present would only effect the
adduser command and not the settings for the newly created directories.

Potential patch is attached.


- Michael Berg

--- monotone-server.postinst	2007-11-03 23:49:54.0 -0600
+++ monotone-server.postinst.fixed	2007-11-03 23:51:31.0 -0600
@@ -127,18 +127,18 @@
 	   adduser --system --group --home $MTN_HOME \
 	   --no-create-home --disabled-password --quiet\
 	   --gecos Monotone monotone
-	   
-	   chown monotone:monotone $MTN_HOME
-   chown monotone:monotone $MTN_CONFDIR
-   chown monotone:monotone $MTN_KEYDIR
-   chown monotone:monotone /var/log/monotone
-   chown monotone:monotone /var/run/monotone
-
-   chmod 0750 $MTN_HOME
-   chmod 0750 $MTN_CONFDIR
-   chmod 0750 $MTN_KEYDIR
fi
 
+   chown monotone:monotone $MTN_HOME
+   chown monotone:monotone $MTN_CONFDIR
+   chown monotone:monotone $MTN_KEYDIR
+   chown monotone:monotone /var/log/monotone
+   chown monotone:monotone /var/run/monotone
+
+   chmod 0750 $MTN_HOME
+   chmod 0750 $MTN_CONFDIR
+   chmod 0750 $MTN_KEYDIR
+
chown monotone:monotone /etc/monotone/write-permissions
chown monotone:monotone /etc/monotone/read-permissions
chown monotone:monotone /etc/monotone/hooks.lua


Bug#437978: Problem Found

2007-11-03 Thread Zack Weinberg
On Nov 3, 2007 10:56 PM, Berg, Michael [EMAIL PROTECTED] wrote:
 I spent some time going through /var/lib/dpkg/info/monotone-server.postinst
 and noticed that all user:group and permissions settings on lines
 124-148 were getting done except for the if-block on lines 126-140.

Thanks for doing this, and for the nice clear explanation of what is going on.

 As one potential solution, would it work to move the chown and chmod
 lines to just after the `id -u monotone 2/dev/null` if-block down to
 with all the other chown and chmod lines being done on a new install?

Yes, I think that's the right fix.  I'll include your patch in 0.37-2.

zw



-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of unsubscribe. Trouble? Contact [EMAIL PROTECTED]