public inbox for goredo-devel@lists.cypherpunks.ru
Atom feed
From: "Jan Niklas Böhm" <mail@jnboehm•com>
To: goredo-devel@lists.cypherpunks.ru
Subject: Suggestion to revert touching files when the hash matches (problem with hardlinks)
Date: Mon, 31 Oct 2022 22:37:41 +0100 [thread overview]
Message-ID: <d42b693e-e09a-05aa-37e7-a177a528a841@jnboehm.com> (raw)
Hello again,
I would like to suggest reverting the change introduces in version
1.23.0: Performance optimization: do not use target’s temporary output
file at all, if its hash equals to already existing target’s one. Just
touch existing target file instead.
Unfortunately, this breaks down as soon as hardlinks are used. Since
hardlinks and ctime do not play well together, this is all done with the
environment variable set to REDO_INODE_TRUST=mtime. Consider the
following example: the do file "a.do" only has one line "echo aaa" and
the file "b.do" is
b.do
---
redo-ifchange a
ln a $3
Calling "redo b" works as expected. But when a is changed such that it
is ood, but does not change its output (e.g. insert a comment), we get
redo b
redo . a (0.002s)
err b (0.006s): $1 was explicitly touched
This is because "a" is touched, which also touches the file "b" and thus
goredo rightfully complains about it. Even if it did not (which happens
in my project because there is more indirection), the mtime is changed
in the file, but the .rec file is not updated correspondingly.
Since I think it will be much more work to resolve all hardlinks and
update the .rec file, I think it is more sensible to instead revert the
behavior of touching the file and instead move $3 to the target location
instead, which would avoid the problem outlined above.
Since both $3 and the final file are in the same directory, the moving
should not be an expensive operation anyways I believe.
Let me know what you think!
Cheers
Nik
next reply other threads:[~2022-10-31 22:06 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-10-31 21:37 Jan Niklas Böhm [this message]
2022-11-01 6:42 ` Suggestion to revert touching files when the hash matches (problem with hardlinks) goredo
2022-11-01 7:50 ` Jan Niklas Böhm
2022-11-01 8:21 ` goredo
2022-11-01 9:02 ` Jan Niklas Böhm
2022-11-01 11:49 ` Spacefrogg
2022-11-01 13:14 ` Jan Niklas Böhm
2022-11-02 13:57 ` Sergey Matveev
2022-11-02 22:42 ` Jan Niklas Böhm
2022-11-03 8:55 ` Sergey Matveev