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] There is one stale comment: s/identity of the FILE/identify of the NAME/ I see you used getfileconat_raw() in need_copy(). Might lgetfileconat_raw() be safer?
It would be nice to add a test for it, but it seems that selabel_lookup_raw returns ENOENT for newly created directories in my checkout, so the subsequent lsetfilecon_raw call will not be executed. I was able to check it by installing files into my home directory, though. Obviously, I do not want to do that in the test suite...
Yes a test is awkward. Maybe we could install from a fifo, sync, replace, check. But yes getting it to not skip most of the time would be tricky. I'd be ok to leave for now. Thanks for updating gnulib to add the raw entry points. Padraig.
