• printf(1) on BSD/OS 4.1 does not play nice with NUL characters
⇒ use print builtin, everything else works; reported by RT • extend the testsuite, ensure print can do NUL correctly
This commit is contained in:
		
							
								
								
									
										17
									
								
								check.t
									
									
									
									
									
								
							
							
						
						
									
										17
									
								
								check.t
									
									
									
									
									
								
							| @@ -1,4 +1,4 @@ | |||||||
| # $MirOS: src/bin/mksh/check.t,v 1.516 2012/03/03 21:30:54 tg Exp $ | # $MirOS: src/bin/mksh/check.t,v 1.517 2012/03/20 16:48:12 tg Exp $ | ||||||
| # $OpenBSD: bksl-nl.t,v 1.2 2001/01/28 23:04:56 niklas Exp $ | # $OpenBSD: bksl-nl.t,v 1.2 2001/01/28 23:04:56 niklas Exp $ | ||||||
| # $OpenBSD: history.t,v 1.5 2001/01/28 23:04:56 niklas Exp $ | # $OpenBSD: history.t,v 1.5 2001/01/28 23:04:56 niklas Exp $ | ||||||
| # $OpenBSD: read.t,v 1.3 2003/03/10 03:48:16 david Exp $ | # $OpenBSD: read.t,v 1.3 2003/03/10 03:48:16 david Exp $ | ||||||
| @@ -3937,7 +3937,7 @@ description: | |||||||
| 	Check read with delimiters | 	Check read with delimiters | ||||||
| stdin: | stdin: | ||||||
| 	emit() { | 	emit() { | ||||||
| 		printf 'foo bar\tbaz\nblah \0blub\tblech\nmyok meck \0' | 		print -n 'foo bar\tbaz\nblah \0blub\tblech\nmyok meck \0' | ||||||
| 	} | 	} | ||||||
| 	emit | while IFS= read -d "" foo; do print -r -- "<$foo>"; done | 	emit | while IFS= read -d "" foo; do print -r -- "<$foo>"; done | ||||||
| 	emit | while read -d "" foo; do print -r -- "<$foo>"; done | 	emit | while read -d "" foo; do print -r -- "<$foo>"; done | ||||||
| @@ -7112,16 +7112,13 @@ expected-stdout: | |||||||
| --- | --- | ||||||
| name: print-nul-chars | name: print-nul-chars | ||||||
| description: | description: | ||||||
| 	Check handling of NUL characters for print and read | 	Check handling of NUL characters for print and COMSUB | ||||||
| 	note: second line should output “4 3” but we cannot |  | ||||||
| 	handle NUL characters in strings yet |  | ||||||
| stdin: | stdin: | ||||||
| 	print $(($(print '<\0>' | wc -c))) |  | ||||||
| 	x=$(print '<\0>') | 	x=$(print '<\0>') | ||||||
| 	print $(($(print "$x" | wc -c))) ${#x} | 	print $(($(print '<\0>' | wc -c))) $(($(print "$x" | wc -c))) \ | ||||||
| expected-stdout: | 	    ${#x} "$x" '<\0>' | ||||||
| 	4 | expected-stdout-pattern: | ||||||
| 	3 2 | 	/^4 3 2 <> <\0>$/ | ||||||
| --- | --- | ||||||
| name: print-escapes | name: print-escapes | ||||||
| description: | description: | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user