public inbox for goredo-devel@lists.cypherpunks.ru
Atom feed
* Suggestion to revert touching files when the hash matches (problem with hardlinks)
@ 2022-10-31 21:37 Jan Niklas Böhm
  2022-11-01  6:42 ` goredo
  0 siblings, 1 reply; 10+ messages in thread
From: Jan Niklas Böhm @ 2022-10-31 21:37 UTC (permalink / raw)
  To: goredo-devel

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

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2022-11-03  8:55 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-10-31 21:37 Suggestion to revert touching files when the hash matches (problem with hardlinks) Jan Niklas Böhm
2022-11-01  6:42 ` 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