[SV 17448] Ignore whitespace around $(file ...) names

The other issues related to whitespace reported in this bug are
not addressed by this change.

* src/functions.c (func_file): Strip whitespace from the start and
end of the filename provided to the $(file ...) function.
* tests/scripts/functions/file: Add tests for this.
* tests/test_driver.pl: Use 3-arg version of open().
This commit is contained in:
Paul Smith
2023-01-08 18:06:54 -05:00
parent a275f4e9ab
commit 36f955b0e8
3 changed files with 53 additions and 18 deletions

View File

@@ -23,7 +23,7 @@ define A
a
b
endef
$(file >> file.out,$(A))
$(file >> file.out ,$(A))
x:;@cat file.out
!,
'', "a\nb");
@@ -219,4 +219,14 @@ run_make_test('$(file <)', '',
run_make_test('$(file foo)', '',
"#MAKEFILE#:1: *** file: invalid file operation: foo. Stop.\n", 512);
# SV 17448: check whitespace
create_file('out1', "1\n");
run_make_test(q!
all:;$(info $(file < out1 ))
!,
'', "1\n#MAKE#: 'all' is up to date.");
unlink('out1');
1;