Introduce a new utility, preserve, which can be used to wrap any command that produces a single output file to ensure that the file is untouched unless the output has genuinely changed.
Details
Details
- Reviewers
- None
Diff Detail
Diff Detail
- Repository
- rG FreeBSD src repository
- Lint
Lint Skipped - Unit
Tests Skipped - Build Status
Buildable 50666 Build 47557: arc lint + arc unit
Event Timeline
usr.bin/preserve/preserve.c | ||
---|---|---|
86 | Good catch. Note that this shouldn't occur though, unless we lost a race. |
Comment Actions
I have wanted a utility that does exactly this. install -C does something similar, but has other stuff I don’t want. So far I just end up scripting cmp(1) to do the check.
Would it make sense to add a -o flag to cmp(1) to provide this behavior there? It would write file1 to file2 if the contents differ.