Pádraig Brady <[email protected]> writes: > On 12/11/2026 05:56, Collin Funk wrote: >> Regarding the version in which the bug was introduced, this code looks >> like it was introduced with the rest of the SELinux code in 6.9.90, >> which is marked as a beta release. However, it looks like it wasn't >> actually used until 6.12, specifically commit eba365275 (install: >> reenable matchpathcon-related code, 2008-05-31). > > Right, that looks like the real introduction. > > The NEWS doesn't mention the implication. > I'd say something simpler along the lines of, > > 'install' now avoids races when setting the default SELinux context > if leading path components for an install file are replaced with symlinks. > [bug introduced in coreutils-6.12]
Yes, I tried to, but it got too wordy... That looks much better. > There is one stale comment: > s/identity of the FILE/identify of the NAME/ Right. I also updated the comment describing need_copy so it does not reference the removed DEST_NAME argument. > I see you used getfileconat_raw() in need_copy(). > Might lgetfileconat_raw() be safer? Nice catch. We use fstat (..., AT_SYMLINK_NOFOLLOW) before and check that it is a regular file, so yes. I wonder if we should also use O_NOFOLLOW when we openat the destination file descriptor afterwards. Anyways, as discussed previously --compare isn't really meant to avoid all races. The most we can do is shorten the window [1]. So nothing to lose sleep over. I pushed it without that O_NOFOLLOW change. Collin [1] https://lists.gnu.org/archive/html/coreutils/2026-08/msg00085.html
