bug#81413: [PATCH] install: skip chown/chmod when -C finds nothing to change
Mateusz Nosek <[email protected]> Thu, 16 Jul 2026 20:16:37 +0200
| Newsgroups | gmane.comp.gnu.core-utils.bugs |
|---|---|
| Message-ID | <CAKJSxDS2CW47FmySGb33iuR5XZ6u-h0nU0U=8AjAvosU_VtxPg@mail.gmail.com> |
Thanks a lot for merging! Mateusz On Thu, Jul 16, 2026 at 1:31=E2=80=AFPM P=C3=A1draig Brady <[email protected]= m> wrote: > > On 15/07/2026 22:56, Mateusz Nosek wrote: > > Hi P=C3=A1draig, > > > > Good point, thanks. v2 leaves setdefaultfilecon() inside > > change_attributes(). Updated patch attached. > > > > I began to wonder if need_copy() should also do a more rigorous check > > for the "selinux_enabled && use_default_selinux_context" case, to see > > if the destination already has the default context. But that's > > slightly out of scope of this patch, so just FYI. > > > > Thanks, > > Mateusz > > > > On Wed, Jul 15, 2026 at 1:18=E2=80=AFPM P=C3=A1draig Brady <P@draigbrad= y.com> wrote: > >> > >> On 14/07/2026 23:30, Mateusz Nosek wrote: > >>> Hi, > >>> > >>> I attach a patch for the "install" utility: "install -C" was still > >>> calling chown/chmod on the destination even when need_copy() had > >>> already determined it matches (mode, owner, group, content), which > >>> could needlessly fail, e.g. on an immutable file. > >>> > >>> This is my first patch to coreutils, so apologies for any mistakes in > >>> the submission process -- happy to fix anything you point out. > >> This makes sense I think. > >> > >> You moved setdefaultfilecon() out of this consideration. > >> I'd be inclined to leave it where it was and treat the same way, > >> because the comparison also compares selinux context, > >> and also if the file is already present it probably has an appropriate= context anyway. > I've pushed that with a NEWS entry. > I also pushed the attached as a follow up > to make cleanup of chattr +i files in tests more robust. > > Marking this as done. > > thanks! > Padraig