Date: Thu, 8 Sep 2016 15:53:49 +0000 (UTC) From: Eric van Gyzen <vangyzen@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r305620 - head/usr.sbin/etcupdate Message-ID: <201609081553.u88Frnnn006304@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
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"
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201609081553.u88Frnnn006304>