aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRon Yorston <rmy@pobox.com>2022-11-04 11:58:41 +0000
committerRon Yorston <rmy@pobox.com>2022-11-04 12:30:58 +0000
commit9cd72d5b32e371b085afc740e8b4c4f2cac152fa (patch)
tree7bc499d5b8028f6bf85ccd0fe6cdadbe063db736
parent5f64589b84a7349316a04cdbe607a5824459b731 (diff)
downloadbusybox-w32-9cd72d5b32e371b085afc740e8b4c4f2cac152fa.tar.gz
busybox-w32-9cd72d5b32e371b085afc740e8b4c4f2cac152fa.tar.bz2
busybox-w32-9cd72d5b32e371b085afc740e8b4c4f2cac152fa.zip
make: fix typo in inference rule handling
A typo in the previous commit caused dyndep() to process inference rules incorrectly. This didn't affect the results of the test suite when extensions were allowed but it caused the test 'Inference rule with explicit rule for prerequisite' to fail in POSIX mode.
-rw-r--r--miscutils/make.c2
-rwxr-xr-xtestsuite/make.tests47
2 files changed, 25 insertions, 24 deletions
diff --git a/miscutils/make.c b/miscutils/make.c
index 86d06e970..1414f869c 100644
--- a/miscutils/make.c
+++ b/miscutils/make.c
@@ -722,7 +722,7 @@ dyndep(struct name *np, struct rule *imprule)
722 continue; 722 continue;
723 if (!ip->n_tim.tv_sec) 723 if (!ip->n_tim.tv_sec)
724 modtime(ip); 724 modtime(ip);
725 if (chain ? ip->n_tim.tv_sec || (ip->n_flag & N_TARGET) : 725 if (!chain ? ip->n_tim.tv_sec || (ip->n_flag & N_TARGET) :
726 dyndep(ip, NULL) != NULL) { 726 dyndep(ip, NULL) != NULL) {
727 // Prerequisite exists or we know how to make it 727 // Prerequisite exists or we know how to make it
728 if (imprule) { 728 if (imprule) {
diff --git a/testsuite/make.tests b/testsuite/make.tests
index 7bb736ade..70c1231b9 100755
--- a/testsuite/make.tests
+++ b/testsuite/make.tests
@@ -59,6 +59,25 @@ x.p:
59' 59'
60cd .. || exit 1; rm -rf make.tempdir 2>/dev/null 60cd .. || exit 1; rm -rf make.tempdir 2>/dev/null
61 61
62# Austin Group defect report 875 clarifies certain aspects of the
63# behaviour of inference rules. Study of this resulted in a number
64# of changes to pdpmake, though this test passed anyway.
65mkdir make.tempdir && cd make.tempdir || exit 1
66touch test.j test.k
67testing "make proper handling of inference rules 1" \
68 "make -f -" \
69 ".j.l\n" "" '
70.SUFFIXES: .j .k .l
71.j.l:
72 @echo .j.l
73.k.l:
74 @echo .k.l
75test.l: test.k
76test.j:
77test.k:
78'
79cd .. || exit 1; rm -rf make.tempdir 2>/dev/null
80
62# A macro created using ::= remembers it's of type immediate-expansion. 81# A macro created using ::= remembers it's of type immediate-expansion.
63# Immediate expansion also occurs when += is used to append to such a macro. 82# Immediate expansion also occurs when += is used to append to such a macro.
64testing "make appending to immediate-expansion macro" \ 83testing "make appending to immediate-expansion macro" \
@@ -397,29 +416,11 @@ target:
397 : hash # hash 416 : hash # hash
398' 417'
399 418
400# Austin Group defect report 875 clarifies certain aspects of the 419# Austin Group defect report 875 (mentioned above) actually used
401# behaviour of inference rules. Study of this resulted in a number 420# suffixes '.a .b .c'. This doesn't matter in POSIX mode but it
402# of changes to pdpmake. Since the issue at hand involves the use 421# caused a failure (now fixed) when chained inference rules were
403# of chained inference rules it doesn't affect POSIX mode. 422# allowed. The '.a.c' and the built-in '.c.a' inference rules
404mkdir make.tempdir && cd make.tempdir || exit 1 423# resulted in a loop.
405touch test.j test.k
406testing "make proper handling of inference rules 1" \
407 "make -f -" \
408 ".j.l\n" "" '
409.SUFFIXES: .j .k .l
410.j.l:
411 @echo .j.l
412.k.l:
413 @echo .k.l
414test.l: test.k
415test.j:
416test.k:
417'
418cd .. || exit 1; rm -rf make.tempdir 2>/dev/null
419
420# The actual test in the above-mentioned defect report was actually
421# more demanding. It used the suffixes '.a .b .c'. This results in
422# the built-in '.c.a' inference rule being introduced into the mix.
423mkdir make.tempdir && cd make.tempdir || exit 1 424mkdir make.tempdir && cd make.tempdir || exit 1
424touch test.a test.b 425touch test.a test.b
425testing "make proper handling of inference rules 2" \ 426testing "make proper handling of inference rules 2" \