git: 8660d530f72f - stable/13 - etcupdate: Preserve permissions when installing a resolved file.
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Wed, 13 Jul 2022 18:01:28 UTC
The branch stable/13 has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=8660d530f72f4103add7487db56b941e6297a8cc commit 8660d530f72f4103add7487db56b941e6297a8cc 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:00:50 +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 b686db7d9f9a..e0223123aae2 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 }