svn commit: r305620 - head/usr.sbin/etcupdate
Eric van Gyzen
vangyzen at FreeBSD.org
Thu Sep 8 15:53:51 UTC 2016
Author: vangyzen
Date: Thu Sep 8 15:53:49 2016
New Revision: 305620
URL: https://svnweb.freebsd.org/changeset/base/305620
Log:
etcupdate: preserve the metadata of the destination file
When using diff3 to perform a three-way merge, etcupdate lost the destination
file's metadata. The metadata from the temporary file were used instead.
This was unpleasant for rc.d scripts, which require execute permission.
Use "cat >" to overwrite the destination file's contents while preserving its
metadata.
Reviewed by: bapt
Sponsored by: Dell Technologies
Differential Revision: https://reviews.freebsd.org/D7817
Modified:
head/usr.sbin/etcupdate/etcupdate.sh
Modified: head/usr.sbin/etcupdate/etcupdate.sh
==============================================================================
--- head/usr.sbin/etcupdate/etcupdate.sh Thu Sep 8 15:27:42 2016 (r305619)
+++ head/usr.sbin/etcupdate/etcupdate.sh Thu Sep 8 15:53:49 2016 (r305620)
@@ -824,7 +824,9 @@ merge_file()
if [ -z "$dryrun" ]; then
temp=$(mktemp -t etcupdate)
diff3 -E -m ${DESTDIR}$1 ${OLDTREE}$1 ${NEWTREE}$1 > ${temp}
- mv -f ${temp} ${DESTDIR}$1
+ # Use "cat >" to preserve metadata.
+ cat ${temp} > ${DESTDIR}$1
+ rm -f ${temp}
fi
post_install_file $1
echo " M $1"
More information about the svn-src-all
mailing list