Skip to content

Commit 1aa2dd1

Browse files
committed
Fix module block output from regen_status.awk.
The awk version of config.status was not correctly outputing the MODULE_BLOCK section.
1 parent 36ae621 commit 1aa2dd1

File tree

3 files changed

+23
-4
lines changed

3 files changed

+23
-4
lines changed

Tools/configure/transpiler/pyconf.awk

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1775,7 +1775,7 @@ function pyconf_output( i) {
17751775
pyconf_cleanup()
17761776
}
17771777

1778-
function _pyconf_build_module_block( i, key, uname, state) {
1778+
function _pyconf_build_module_block( i, key, uname, state, block) {
17791779
# Populate _module_block_lines array instead of concatenating into a string.
17801780
# This avoids building a large concatenated string in AWK memory, which causes
17811781
# memory corruption in mawk when many modules have CFLAGS/LDFLAGS.
@@ -1792,6 +1792,15 @@ function _pyconf_build_module_block( i, key, uname, state) {
17921792
_module_block_lines[++_module_block_n] = key "_LDFLAGS=" SUBST[key "_LDFLAGS"]
17931793
}
17941794
}
1795+
# Also populate SUBST["MODULE_BLOCK"] so config.status / regen_status.awk
1796+
# can regenerate Makefile.pre correctly (it uses plain @VAR@ substitution
1797+
# from serialized SUBST data, not _module_block_lines[]).
1798+
block = ""
1799+
for (i = 1; i <= _module_block_n; i++) {
1800+
if (i > 1) block = block "\n"
1801+
block = block _module_block_lines[i]
1802+
}
1803+
SUBST["MODULE_BLOCK"] = block
17951804
}
17961805

17971806
function _pyconf_resolve_exports( k) {

Tools/configure/transpiler/pysh_to_awk.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3333,7 +3333,9 @@ def transform_program(program: PyshProgram) -> A.Program:
33333333
begin_stmts.append(
33343334
A.ExprStmt(A.FuncCall(_USER_FUNC_PREFIX + func_name, []))
33353335
)
3336-
begin_stmts.append(A.ExprStmt(A.FuncCall("pyconf_output", [])))
3336+
# Note: pyconf_output() is NOT appended here — it is already called
3337+
# inside u_generate_output() (transpiled from conf_output.generate_output
3338+
# which calls pyconf.output()).
33373339
begin_stmts.append(A.Exit(A.NumLit(0)))
33383340
parts.append(A.BeginBlock(A.Block(begin_stmts)))
33393341

configure-new

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1810,7 +1810,7 @@ function pyconf_output( i) {
18101810
pyconf_cleanup()
18111811
}
18121812

1813-
function _pyconf_build_module_block( i, key, uname, state) {
1813+
function _pyconf_build_module_block( i, key, uname, state, block) {
18141814
# Populate _module_block_lines array instead of concatenating into a string.
18151815
# This avoids building a large concatenated string in AWK memory, which causes
18161816
# memory corruption in mawk when many modules have CFLAGS/LDFLAGS.
@@ -1827,6 +1827,15 @@ function _pyconf_build_module_block( i, key, uname, state) {
18271827
_module_block_lines[++_module_block_n] = key "_LDFLAGS=" SUBST[key "_LDFLAGS"]
18281828
}
18291829
}
1830+
# Also populate SUBST["MODULE_BLOCK"] so config.status / regen_status.awk
1831+
# can regenerate Makefile.pre correctly (it uses plain @VAR@ substitution
1832+
# from serialized SUBST data, not _module_block_lines[]).
1833+
block = ""
1834+
for (i = 1; i <= _module_block_n; i++) {
1835+
if (i > 1) block = block "\n"
1836+
block = block _module_block_lines[i]
1837+
}
1838+
SUBST["MODULE_BLOCK"] = block
18301839
}
18311840

18321841
function _pyconf_resolve_exports( k) {
@@ -8679,7 +8688,6 @@ BEGIN {
86798688
u_setup_remaining_modules()
86808689
u_check_jit_stencils()
86818690
u_generate_output()
8682-
pyconf_output()
86838691
exit 0
86848692
}
86858693

0 commit comments

Comments
 (0)