diff options
author | Ron Yorston <rmy@pobox.com> | 2022-11-13 15:13:55 +0000 |
---|---|---|
committer | Ron Yorston <rmy@pobox.com> | 2022-11-13 15:13:55 +0000 |
commit | f97b2b0875027d51fe272a6e94049d387f8b680d (patch) | |
tree | 1a15598bd4cbb1e2f2ed22bd591476607a1cc61a | |
parent | e633f7cb2abe0068e1980d3818b1ad01f6392e8e (diff) | |
download | busybox-w32-f97b2b0875027d51fe272a6e94049d387f8b680d.tar.gz busybox-w32-f97b2b0875027d51fe272a6e94049d387f8b680d.tar.bz2 busybox-w32-f97b2b0875027d51fe272a6e94049d387f8b680d.zip |
make: use correct test for valid macro name
The test for valid macro names in POSIX mode was incorrect: it
shouldn't have allowed '-'.
-rw-r--r-- | miscutils/make.c | 2 | ||||
-rwxr-xr-x | testsuite/make.tests | 13 |
2 files changed, 14 insertions, 1 deletions
diff --git a/miscutils/make.c b/miscutils/make.c index 42fac7f77..7b54bfe95 100644 --- a/miscutils/make.c +++ b/miscutils/make.c | |||
@@ -520,7 +520,7 @@ is_valid_macro(const char *name) | |||
520 | for (s = name; *s; ++s) { | 520 | for (s = name; *s; ++s) { |
521 | // In POSIX mode only a limited set of characters are guaranteed | 521 | // In POSIX mode only a limited set of characters are guaranteed |
522 | // to be allowed in macro names. | 522 | // to be allowed in macro names. |
523 | if (posix && !isfname(*s)) | 523 | if (posix && !ispname(*s)) |
524 | return FALSE; | 524 | return FALSE; |
525 | // As an extension allow anything that can get through the | 525 | // As an extension allow anything that can get through the |
526 | // input parser, apart from the following. | 526 | // input parser, apart from the following. |
diff --git a/testsuite/make.tests b/testsuite/make.tests index 70c1231b9..8a0f1a7d2 100755 --- a/testsuite/make.tests +++ b/testsuite/make.tests | |||
@@ -339,6 +339,19 @@ target: | |||
339 | b} | 339 | b} |
340 | ' | 340 | ' |
341 | 341 | ||
342 | # POSIX 202X permits additional characters in macro and target names | ||
343 | testing "make allow - and / in target names, - in macro names" \ | ||
344 | "make -f -" \ | ||
345 | "/hello\nhel-lo\nmac-ro\n" "" ' | ||
346 | target: ./hello hel-lo | ||
347 | @echo $(mac-ro) | ||
348 | ./hello: | ||
349 | @echo /hello | ||
350 | hel-lo: | ||
351 | @echo hel-lo | ||
352 | mac-ro = mac-ro | ||
353 | ' | ||
354 | |||
342 | testing "make double-colon rule" \ | 355 | testing "make double-colon rule" \ |
343 | "make -f -" "target1\ntarget2\n" "" ' | 356 | "make -f -" "target1\ntarget2\n" "" ' |
344 | target:: | 357 | target:: |