Skip to content

Commit ea140e1

Browse files
committed
Avoid chmod on files that don't exist.
1 parent 115b9a0 commit ea140e1

File tree

2 files changed

+14
-2
lines changed

2 files changed

+14
-2
lines changed

Tools/configure/transpiler/pyconf.awk

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1802,6 +1802,11 @@ function _pyconf_process_config_files( i, inf, outf, outdir, saved_abs_srcdir
18021802
inf = outf ".in"
18031803
if (inf == "")
18041804
continue
1805+
# Skip if template does not exist (mirrors pyconf.py behaviour)
1806+
if (system("test -f " _shell_quote(inf)) != 0) {
1807+
pyconf_warn("config file template not found: " inf)
1808+
continue
1809+
}
18051810
# Compute per-file abs_srcdir/abs_builddir like autoconf does:
18061811
# ac_abs_srcdir = abs_top_srcdir + dir-suffix-of-outfile
18071812
outdir = ""
@@ -1820,7 +1825,8 @@ function _pyconf_process_config_files( i, inf, outf, outdir, saved_abs_srcdir
18201825
SUBST["abs_builddir"] = saved_abs_builddir
18211826
}
18221827
for (i = 1; i <= _pyconf_config_file_x_count; i++) {
1823-
system("chmod +x " _shell_quote(CONFIG_FILES_X[i]))
1828+
if (system("test -f " _shell_quote(CONFIG_FILES_X[i])) == 0)
1829+
system("chmod +x " _shell_quote(CONFIG_FILES_X[i]))
18241830
}
18251831
}
18261832

configure-new

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1813,6 +1813,11 @@ function _pyconf_process_config_files( i, inf, outf, outdir, saved_abs_srcdir
18131813
inf = outf ".in"
18141814
if (inf == "")
18151815
continue
1816+
# Skip if template does not exist (mirrors pyconf.py behaviour)
1817+
if (system("test -f " _shell_quote(inf)) != 0) {
1818+
pyconf_warn("config file template not found: " inf)
1819+
continue
1820+
}
18161821
# Compute per-file abs_srcdir/abs_builddir like autoconf does:
18171822
# ac_abs_srcdir = abs_top_srcdir + dir-suffix-of-outfile
18181823
outdir = ""
@@ -1831,7 +1836,8 @@ function _pyconf_process_config_files( i, inf, outf, outdir, saved_abs_srcdir
18311836
SUBST["abs_builddir"] = saved_abs_builddir
18321837
}
18331838
for (i = 1; i <= _pyconf_config_file_x_count; i++) {
1834-
system("chmod +x " _shell_quote(CONFIG_FILES_X[i]))
1839+
if (system("test -f " _shell_quote(CONFIG_FILES_X[i])) == 0)
1840+
system("chmod +x " _shell_quote(CONFIG_FILES_X[i]))
18351841
}
18361842
}
18371843

0 commit comments

Comments
 (0)