Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit1f1cd9b

Browse files
committed
Avoid overwriting unchanged output files in genbki.pl and Gen_fmgrtab.pl.
If a particular output file already exists with the contents it shouldhave, leave it alone, so that its mod timestamp is not advanced.In builds using --enable-depend, this can avoid the need to recompile .cfiles whose included files didn't actually change. It's not clear whetherit saves much of anything for users of ccache; but the cost of doing thefile comparisons seems to be negligible, so we might as well do it.For developers using the MSVC toolchain, this will create a regression:msvc/Solution.pm will sometimes run genbki.pl or Gen_fmgrtab.plunnecessarily. I'll look into fixing that separately.Discussion:https://postgr.es/m/16925.1525376229@sss.pgh.pa.us
1 parent9bf28f9 commit1f1cd9b

File tree

1 file changed

+20
-3
lines changed

1 file changed

+20
-3
lines changed

‎src/backend/catalog/Catalog.pm

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,9 @@ package Catalog;
1616
use strict;
1717
use warnings;
1818

19+
use File::Compare;
20+
21+
1922
# Parses a catalog header file into a data structure describing the schema
2023
# of the catalog.
2124
subParseHeader
@@ -336,15 +339,29 @@ sub AddDefaultValues
336339
}
337340

338341
# Rename temporary files to final names.
339-
# Call this function with the final file name and the .tmp extension
342+
# Call this function with the final file name and the .tmp extension.
343+
#
344+
# If the final file already exists and has identical contents, don't
345+
# overwrite it; this behavior avoids unnecessary recompiles due to
346+
# updating the mod date on unchanged header files.
347+
#
340348
# Note: recommended extension is ".tmp$$", so that parallel make steps
341-
# can't use the same temp files
349+
# can't use the same temp files.
342350
subRenameTempFile
343351
{
344352
my$final_name =shift;
345353
my$extension =shift;
346354
my$temp_name =$final_name .$extension;
347-
rename($temp_name,$final_name) ||die"rename:$temp_name:$!";
355+
356+
if (-f$final_name
357+
&& compare($temp_name,$final_name) == 0)
358+
{
359+
unlink$temp_name ||die"unlink:$temp_name:$!";
360+
}
361+
else
362+
{
363+
rename($temp_name,$final_name) ||die"rename:$temp_name:$!";
364+
}
348365
}
349366

350367
# Find a symbol defined in a particular header file and extract the value.

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp