diff options
author | Paul Smith <psmith@gnu.org> | 2021-03-15 03:28:11 -0400 |
---|---|---|
committer | Paul Smith <psmith@gnu.org> | 2021-03-15 03:28:11 -0400 |
commit | c5319e75f5b64c972a38967a6eb5747838e914fd (patch) | |
tree | f15966e1da0e6d0e05e35358c198dfe99bad5b8c /tests/thelp.pl | |
parent | 510e5ce801d957338be764a794f1463b662a7edc (diff) | |
download | make-git-c5319e75f5b64c972a38967a6eb5747838e914fd.tar.gz |
[SV 58497] Ensure $(file <) newline removal succeeds
Keep a count of bytes read rather than comparing pointers since the
variable_buffer might get reallocated.
Bug and patch by Ken Tossell <ken@tossell.net>
Regression tests by Dmitry Goncharov <dgoncharov@users.sf.net>
Tweaked by Paul Smith <psmith@gnu.org>
* src/function.c (func_file): Use bytes read rather than a pointer.
* tests/scripts/functions/file: Provide various tests for reading
empty files, files with/without newlines, and large files.
Diffstat (limited to 'tests/thelp.pl')
-rwxr-xr-x | tests/thelp.pl | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/tests/thelp.pl b/tests/thelp.pl index d8aaa667..ed8c819e 100755 --- a/tests/thelp.pl +++ b/tests/thelp.pl @@ -8,7 +8,8 @@ # Each step consists of an operator and argument. # # It supports the following operators: -# out <word> : echo <word> to stdout +# out <word> : echo <word> to stdout with a newline +# raw <word> : echo <word> to stdout without adding anything # file <word> : echo <word> to stdout AND create the file <word> # dir <word> : echo <word> to stdout AND create the directory <word> # rm <word> : echo <word> to stdout AND delete the file/directory <word> @@ -34,6 +35,10 @@ sub op { print "$nm\n"; return 1; } + if ($op eq 'raw') { + print "$nm"; + return 1; + } # Show the output before creating the file if ($op eq 'file') { |