On Thu, Feb 05, 2026 at 02:57:47AM +0100, Gero Treuner wrote: > Hi Kevin and all, > > On Wed, Feb 04, 2026 at 01:04:20PM +0800, Kevin J. McCarthy wrote: > > I'm sure I don't need to ask for feedback, but this is a tradeoff of a > > couple stat calls for correct behavior in some less common situations. > > Thoughts? > > Functionally I agree with the change. But the repeated function calls > have a look of inefficiency, although I'm aware that this is nit. > > Out of curiosity I rewrote it to iterate over the three subdirectory > names and compared the difference in size of the binaries. In this > case it apparently is dominated by (debug) symbols and not hitting a > threshold for reduced size of a fully stripped binary on my system. > > So having done this anyway, I propose an optimization utilizing the > uniform length of the names. (Further compacting the code saves more > space but degrades readability of the logic.)
Why not use fstatat() instead of splicing path names together as strings? That also has the advantage of ensuring that the tests for 'cur', 'new', and 'tmp', are actually done on the same directory, (because if the parent directory is a symlink, mount point, etc, it could potentially change between each of these tests).
