Bruno Haible [2024-07-26 16:27 +0200] wrote:

> Basil L. Contovounesios wrote:
>> The commentary in build-aux/git-version-gen illustrates how the files
>> .version and .tarball-version could be generated:
>> 
>>   $(top_srcdir)/.version:
>>         echo '$(VERSION)' > $@-t
>>         mv $@-t $@
>> ...
>> I'm curious why one recipe writes a temporary file first

[...]
> The real reason is that if the disk is full, the rule would leave an
> empty file on the disk and fail, and even after the user makes room
> on the disk and runs "make" a second time, the empty file would persist
> and cause trouble.
>
>>   dist-hook:
>>         echo '$(VERSION)' > $(distdir)/.tarball-version
>> 
>> whereas the other writes the target directly.
>
> Here it does so because the file is inside a temporary directory. If
> the "make dist" rule fails, the user has to remove the temporary directory
> entirely anyway, and that will also take care of the empty file.

[ Sorry for the noise in reviving this old thread, but I just realised I
  forgot to clarify at the time: ]

Does this imply that writing to a temporary file first is never needed
under distdir?

I'm thinking of the examples in (info "(gnulib) gitlog-to-changelog")
for instance, which generate $(distdir)/ChangeLog in two steps.

Thanks,
-- 
Basil

Reply via email to