Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 13 Jul 2022 18:01:35 GMT
From:      John Baldwin <jhb@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org
Subject:   git: 101639e97886 - stable/12 - etcupdate: Preserve permissions when installing a resolved file.
Message-ID:  <202207131801.26DI1Zg7059296@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch stable/12 has been updated by jhb:

URL: https://cgit.FreeBSD.org/src/commit/?id=101639e978868b996dca4309800133eb93605e85

commit 101639e978868b996dca4309800133eb93605e85
Author:     John Baldwin <jhb@FreeBSD.org>
AuthorDate: 2022-05-25 21:20:40 +0000
Commit:     John Baldwin <jhb@FreeBSD.org>
CommitDate: 2022-07-13 18:01:08 +0000

    etcupdate: Preserve permissions when installing a resolved file.
    
    Similar to the change in 1a04446f088c79cc2cf85fd86e60ebcc228d3075, use
    cat to overwrite the contents of the existing file rather than cp so
    that metadata of the existing file such as permissions and ownership
    is preserved.
    
    PR:             255514
    Reported by:    uqs
    
    (cherry picked from commit f8287caae48246e34d6a7af5446df3c36127b7f0)
---
 usr.sbin/etcupdate/etcupdate.sh | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/usr.sbin/etcupdate/etcupdate.sh b/usr.sbin/etcupdate/etcupdate.sh
index 3715dea7e95c..c2efcd565fa1 100755
--- a/usr.sbin/etcupdate/etcupdate.sh
+++ b/usr.sbin/etcupdate/etcupdate.sh
@@ -673,8 +673,9 @@ install_resolved()
 		return 1
 	fi
 
-	log "cp -Rp ${CONFLICTS}$1 ${DESTDIR}$1"
-	cp -Rp ${CONFLICTS}$1 ${DESTDIR}$1 >&3 2>&1
+	# Use cat rather than cp to preserve metadata
+	log "cat ${CONFLICTS}$1 > ${DESTDIR}$1"
+	cat ${CONFLICTS}$1 > ${DESTDIR}$1 2>&3
 	post_install_file $1
 	return 0
 }



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