5 ms·
[ninja author] I did some thinking about this problem and eventually revisited with what I think is a pretty neat solution. I wrote about it here: https://neug
by evmar 6mo ago
[ninja author] I did some thinking about this problem and eventually revisited with what I think is a pretty neat solution. I wrote about it here: https://neugierig.org/software/blog/2022/03/n2.html https://neugierig.org/software/blog/2022/03/n2.html
- actionfromafar 6mo agoImagine if filesystems had exposed the file hash next to its mtime.
- oftenwrong 6mo agoI might be missing your sarcasm, but this is a common approach for large scale builds. Virtual filesystems are used to provide a pre-computed tree hash as a xattr. In a more typical case, you can read the git tree hash.
- actionfromafar 6mo agoNot sure it was meant as sarcasm really. I just think so many build (and other) problems could have been avoided it a file hash was available on every file by default.
- sagarm 6mo agoThat hash would be expensive to maintain, and the end result would still be racy since the file could be modified after the hash was read .
- actionfromafar 6mo agoIn the current POSIX paradigm yes, it would be expensive. But if the hash was defined as the hash of fixed blocks, it wouldn't be expensive. The raciness depends, a lot, on the semantics we would define. (In the context of a build system, it's no different than that the file could get a new mtime after we read the mtime.)