Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 11 Oct 2004 10:21:22 +0000
From:      Eivind Eklund <eivind@FreeBSD.org>
To:        Dmitry Morozovsky <marck@rinet.ru>
Cc:        brian@awfulhak.org
Subject:   Re: What we keep under /etc (was: cvs commit: src/etc rc rc.shutdown src/etc/rc.d ...)
Message-ID:  <20041011102122.GG1039@FreeBSD.org>
In-Reply-To: <20041011105104.P93998@woozle.rinet.ru>
References:  <20041009114544.080344bd@dev.lan.Awfulhak.org> <20041010031208L.matusita@jp.FreeBSD.org> <20041010103151.GA47927@gothmog.gr> <200410110914.24398.doconnor@gsoft.com.au> <20041011105104.P93998@woozle.rinet.ru>

next in thread | previous in thread | raw e-mail | index | archive | help

--ew6BAiZeqk4r7MaW
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline

On Mon, Oct 11, 2004 at 10:53:45AM +0400, Dmitry Morozovsky wrote:
> On Mon, 11 Oct 2004, Daniel O'Connor wrote:
> 
> DO> On Sun, 10 Oct 2004 20:01, Giorgos Keramidas wrote:
> DO> > The overwriting of some directories in /etc can be made optional and
> DO> > default to off (keeping the current behavior, but allowing faster updates
> DO> > of a part of /etc for those who want it), if that's what's worrying you.
> DO> >
> DO> > We could add an option to mergemaster like -f which would take a list of
> DO> > /etc subdirectories to blindly overwrite, i.e.:
> DO> >
> DO> >  # mergemaster -f "rc.d periodic defaults isdn"
> DO> >
> DO> > To avoid having to type manually the list of directories, this could also
> DO> > be made optional based on an environment variable like
> DO> > MM_OVERWRITE_SUBDIRS, in which case the order of precedence would be:
> DO>
> DO> Or import etcmerge :)
> DO>
> DO> etcmerge isn't perfect, but I think effort would be better expended making it
> DO> more user friendly (I'm thinking specifically of guiding the user through
> DO> things more explicitly)

Any help with this (even just ideas for how you'd like it to work) would
be appreciated.

I have one thing I'd like to add before an import: Support for two-way
merges for the case where there is no reference.  This would make the
first run of etcmerge behave like a run of mergemaster, and would
improve handling of some (weird) situations later.  I've got the code
for this half done, and should only need half an hour to complete it.

> Well, I did test etcmerge yesterday, and finished with partly broken right to
> directories with conflict results, namely /etc/mail, /etc/namedb and /etc/uucp:
> they went to mode 700 after etcmerge install. I have no chance to dig into
> problem deeply though.

Hmmm.  I've not had any reports of brokenness like this before, and the
directories themselves should be copied from the active etc.  Looking
over the code, however, I see that this might only work for empty
directories.

However, I was unable to reproduce the issue by setting my umask to 077
and running etcmerge, so I'm uncertain if this is the issue.

The attached patch is an attempted fix for the issue; can you test it
and see if it fixes your problem?  (I've tested that it works locally
with no determinental effects.)

Eivind.

--ew6BAiZeqk4r7MaW
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=patch

Index: src/etcmerge.sh
===================================================================
RCS file: /home/ncvs/ports/sysutils/etcmerge/src/etcmerge.sh,v
retrieving revision 1.5
diff -u -r1.5 etcmerge.sh
--- src/etcmerge.sh	21 Jan 2004 15:10:35 -0000	1.5
+++ src/etcmerge.sh	11 Oct 2004 10:11:06 -0000
@@ -208,13 +219,13 @@
 #
 cd $WORKDIR
 (cd "${NEWETC}"    && find . -type f -print | sort > ${CLASSDIR}/newetc.files)
-(cd "${NEWETC}"    && find . -type d -links 2 -print | sort > ${CLASSDIR}/newetc.emptydirs)
+(cd "${NEWETC}"    && find . -type d -print | sort > ${CLASSDIR}/newetc.dirs)
 (cd "${NEWETC}"    && find . \! \( -type d -or -type f \) -print | sort > ${CLASSDIR}/newetc.others)
 (cd "${REFETC}"    && find . -type f -print | sort > ${CLASSDIR}/refetc.files)
-(cd "${REFETC}"    && find . -type d -links 2 -print | sort > ${CLASSDIR}/refetc.emptydirs)
+(cd "${REFETC}"    && find . -type d -print | sort > ${CLASSDIR}/refetc.dirs)
 (cd "${REFETC}"    && find . \! \( -type d -or -type f \) -print | sort > ${CLASSDIR}/refetc.others)
 (cd "${ACTIVEETC}" && find . -type f -print | sort > ${CLASSDIR}/activeetc.files)
-(cd "${ACTIVEETC}"    && find . -type d -links 2 -print | sort > ${CLASSDIR}/activeetc.emptydirs)
+(cd "${ACTIVEETC}"    && find . -type d -print | sort > ${CLASSDIR}/activeetc.dirs)
 (cd "${ACTIVEETC}"    && find . \! \( -type d -or -type f \) -print | sort > ${CLASSDIR}/activeetc.others)
 
 #
@@ -237,7 +248,7 @@
 #  7	Present Present Present		Do a 3-way merge, with directory if
 #  						necessary.
 cd ${CLASSDIR}
-for extension in files emptydirs others; do
+for extension in files dirs others; do
     cat refetc.${extension} newetc.${extension} activeetc.${extension} | sort -u > alletc.${extension}
     cat refetc.${extension} newetc.${extension} | sort | uniq -d | cat - activeetc.${extension} | sort | uniq -d > ${CLASSDIR}/7.${extension}
     cat alletc.${extension} refetc.${extension} newetc.${extension}	| sort | uniq -u > ${CLASSDIR}/1.${extension}
@@ -249,7 +260,7 @@
 done
 
 for i in 1 2 3 4 5 6 7; do
-    echo "ETCMERGE: >>>> Class ${i}: $(cat ${CLASSDIR}/$i.files | wc -l) files, $(cat ${CLASSDIR}/$i.emptydirs | wc -l) empty dirs, $(cat ${CLASSDIR}/$i.others | wc -l) others"
+    echo "ETCMERGE: >>>> Class ${i}: $(cat ${CLASSDIR}/$i.files | wc -l) files, $(cat ${CLASSDIR}/$i.dirs | wc -l) dirs, $(cat ${CLASSDIR}/$i.others | wc -l) others"
 done
 
 #
@@ -266,7 +277,7 @@
 # Class 7 - present everywhere.  Create a merged directory tree.
 #
 cd ${MERGEDETC}
-(cd ${ACTIVEETC} && cat ${CLASSDIR}/7.files ${CLASSDIR}/7.emptydirs ${CLASSDIR}/7.others | ${CPIO_ARCHIVE}) | ${CPIO_EXTRACT}
+(cd ${ACTIVEETC} && cat ${CLASSDIR}/7.dirs ${CLASSDIR}/7.files ${CLASSDIR}/7.others | ${CPIO_ARCHIVE}) | ${CPIO_EXTRACT}
 for i in $(cat ${CLASSDIR}/7.files); do
     if ! merge -q $i ${REFETC}/$i ${NEWETC}/$i; then
 	echo ${i} >> ${WORKDIR}/7.conflicts
@@ -282,7 +293,7 @@
 echo "ETCMERGE: >>>> Both files and non-files get copied."
 echo "ETCMERGE: >>>"
 cd ${MERGEDETC}
-(cd ${ACTIVEETC} && cat ${CLASSDIR}/1.files ${CLASSDIR}/1.emptydirs ${CLASSDIR}/1.others | ${CPIO_ARCHIVE}) | ${CPIO_EXTRACT}
+(cd ${ACTIVEETC} && cat ${CLASSDIR}/1.dirs ${CLASSDIR}/1.files ${CLASSDIR}/1.others | ${CPIO_ARCHIVE}) | ${CPIO_EXTRACT}
 
 #
 # Class 2 - only present in new directory.  Copy over.
@@ -292,7 +303,7 @@
 echo "ETCMERGE: >>>> Both files and non-files get copied."
 echo "ETCMERGE: >>>"
 cd ${MERGEDETC}
-(cd ${NEWETC} && cat ${CLASSDIR}/2.files ${CLASSDIR}/2.emptydirs ${CLASSDIR}/2.others | ${CPIO_ARCHIVE}) | ${CPIO_EXTRACT}
+(cd ${NEWETC} && cat ${CLASSDIR}/2.dirs ${CLASSDIR}/2.files ${CLASSDIR}/2.others | ${CPIO_ARCHIVE}) | ${CPIO_EXTRACT}
 
 #
 # Class 3 - present in new and active directory, but not ref.
@@ -307,7 +318,7 @@
 echo "ETCMERGE: >>>> Non-files are fetched from the ACTIVE directory."
 echo "ETCMERGE: >>>"
 cd ${MERGEDETC}
-(cd ${ACTIVEETC} && cat ${CLASSDIR}/3.files ${CLASSDIR}/3.emptydirs ${CLASSDIR}/3.others | ${CPIO_ARCHIVE}) | ${CPIO_EXTRACT}
+(cd ${ACTIVEETC} && cat ${CLASSDIR}/3.dirs ${CLASSDIR}/3.files ${CLASSDIR}/3.others | ${CPIO_ARCHIVE}) | ${CPIO_EXTRACT}
 (cd ${NEWETC} && cat ${CLASSDIR}/3.files | ${CPIO_ARCHIVE}) | ${CPIO_EXTRACT}
 for i in $(cat ${CLASSDIR}/3.files); do
     if ! diff -q ${ACTIVEETC}/$i ${REFETC}/$i > /dev/null; then

--ew6BAiZeqk4r7MaW--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20041011102122.GG1039>