From 678a71ea2d044f19f75e3f45c930c5e3b707e3dc Mon Sep 17 00:00:00 2001 From: Stephen Gildea Date: Fri, 20 Dec 2019 09:15:13 -0800 Subject: backup-by-copying-when-privileged-mismatch applies to file gid, too. * lisp/files.el (backup-by-copying-when-privileged-mismatch): In addition to checking the file uid, a second test is added: if the file gid is not greater than backup-by-copying-when-privileged-mismatch, backup-by-copying-when-mismatch will also be forced on. * doc/emacs/files.texi, doc/lispref/backups.texi: Updated documentation. Also fixed a typo in the Emacs reference manual, changing "higher" to "no greater" so that the limit is no longer documented reversed. --- lisp/files.el | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) (limited to 'lisp/files.el') diff --git a/lisp/files.el b/lisp/files.el index a384e7136e8..96f1e8d47e7 100644 --- a/lisp/files.el +++ b/lisp/files.el @@ -134,10 +134,11 @@ This variable is relevant only if `backup-by-copying' is nil." (defcustom backup-by-copying-when-privileged-mismatch 200 "Non-nil means create backups by copying to preserve a privileged owner. Renaming may still be used (subject to control of other variables) -when it would not result in changing the owner of the file or if the owner -has a user id greater than the value of this variable. This is useful -when low-numbered uid's are used for special system users (such as root) -that must maintain ownership of certain files. +when it would not result in changing the owner of the file or if the +user id and group id of the file are both greater than the value of +this variable. This is useful when low-numbered uid's and gid's are +used for special system users (such as root) that must maintain +ownership of certain files. This variable is relevant only if `backup-by-copying' and `backup-by-copying-when-mismatch' are nil." :type '(choice (const nil) integer) @@ -4634,8 +4635,10 @@ BACKUPNAME is the backup file name, which is the old file renamed." (let ((attr (file-attributes real-file-name 'integer))) - (<= (file-attribute-user-id attr) - copy-when-priv-mismatch)))) + (or (<= (file-attribute-user-id attr) + copy-when-priv-mismatch) + (<= (file-attribute-group-id attr) + copy-when-priv-mismatch))))) (not (file-ownership-preserved-p real-file-name t))))) setmodes) -- cgit v1.2.1