1# $NetBSD: job-output-null.mk,v 1.1 2021/04/15 19:02:29 rillig Exp $ 2# 3# Test how null bytes in the output of a command are handled. Make processes 4# them using null-terminated strings, which may cut off some of the output. 5# 6# As of 2021-04-15, make handles null bytes from the child process 7# inconsistently. It's an edge case though since typically the child 8# processes output text. 9 10.MAKEFLAGS: -j1 # force jobs mode 11 12all: .PHONY 13 # The null byte from the command output is kept as-is. 14 # See CollectOutput, which looks like it intended to replace these 15 # null bytes with simple spaces. 16 @printf 'hello\0world%s\n' '' 17 18 # Give the parent process a chance to see the above output, but not 19 # yet the output from the next printf command. 20 @sleep 1 21 22 # All null bytes from the command output are kept as-is. 23 @printf 'hello\0world%s\n' '' '' '' '' '' '' 24 25 @sleep 1 26 27 # The null bytes are replaced with spaces since they are not followed 28 # by a newline. 29 # 30 # The three null bytes in a row test whether this output is 31 # compressed to a single space like in DebugFailedTarget. It isn't. 32 @printf 'hello\0world\0without\0\0\0newline%s' ', ' ', ' '.' 33