if a directory, rejected by pkgadd, has new/other permissions or user/group
than the installed one, rejmerge should do an update which the current
version refused to do.
How to reproduce:
1. echo >> /var/spool/cron/crontabs/root
2. chown daemon /var/spool/cron/crontabs
3. cd /usr/ports/core/dcron
4. pkgmk -u
pkgadd reports something like that:
pkgadd: rejecting var/spool/cron/crontabs/, keeping existing version
pkgadd: rejecting var/spool/cron/crontabs/root, keeping existing'version
5. run rejmerge
Note:
step 1. above is necessary because pkgadd doesn't add empty directories to
/var/lib/pkg/rejected, which might be considered as bug as well.
Attached patch adds a check of directory permissions to rejmerge.
diff --git a/rejmerge.8.in b/rejmerge.8.in
index cc05c4c..7fc5361 100644
--- a/rejmerge.8.in
+++ b/rejmerge.8.in
@@ -73,6 +73,6 @@ Directory where rejected files are stored.
.SH SEE ALSO
pkgadd(8), pkgrm(8), pkginfo(8), pkgmk(8)
.SH COPYRIGHT
-rejmerge (pkgutils) is Copyright (c) 2000-2005 Per Liden and Copyright (c) 2006-2010 CRUX team (http://crux.nu).
+rejmerge (pkgutils) is Copyright (c) 2000-2005 Per Liden and Copyright (c) 2006-2012 CRUX team (http://crux.nu).
rejmerge (pkgutils) is licensed through the GNU General Public License.
Read the COPYING file for the complete license.
diff --git a/rejmerge.in b/rejmerge.in
index d6b479a..ccc3b3a 100755
--- a/rejmerge.in
+++ b/rejmerge.in
@@ -3,7 +3,7 @@
# rejmerge (pkgutils)
#
# Copyright (c) 2000-2005 Per Liden
-# Copyright (c) 2006-2010 by CRUX team (http://crux.nu)
+# Copyright (c) 2006-2012 by CRUX team (http://crux.nu)
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -284,6 +284,23 @@ main() {
fi
done
+ # Check permissions of directories
+ for DIR in $(find $REJECTED_DIR -depth -type d); do
+
+ local INSTALLED_DIR="${DIR##$REJECTED_DIR}"
+
+ if [ -d "$INSTALLED_DIR" -a -d $DIR ]; then
+
+ local STAT_DIR1=$(stat -c '%A %U %G' "$INSTALLED_DIR")
+ local STAT_DIR2=$(stat -c '%A %U %G' "$DIR")
+
+ if [ "$STAT_DIR1" != "$STAT_DIR2" ]; then
+ REJECTED_FILES_FOUND="yes"
+ permissions_menu "$INSTALLED_DIR" "$DIR"
+ fi
+ fi
+ done
+
# Remove empty directories
for DIR in $(find $REJECTED_DIR -depth -type d); do
if [ "$DIR" != "$REJECTED_DIR" ]; then
Reference: https://crux.nu/bugs/index.php?do=details&task_id=379&project=1&pagenum=2
Attached patch adds a check of directory permissions to rejmerge.