ash: expand: Fix trailing newlines processing in backquote expanding
Upstream commit:
    Date: Mon, 29 Apr 2019 19:13:37 +0500
    expand: Fix trailing newlines processing in backquote expanding
    According to POSIX.1-2008 we should remove newlines only at the end of
    the substitution. Newlines-only substitions causes dash to remove
    newlines before beggining of the substitution. The following code:
        cat <<END
        1
        $(echo "")
        2
        END
    prints "1<newline>2" instead of expected "1<newline><newline>2".
    This patch fixes trailing newlines processing in backquote expanding.
    Signed-off-by: Nikolai Merinov <n.merinov@inango-systems.com>
    Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
			
			
This commit is contained in:
		
							
								
								
									
										5
									
								
								shell/hush_test/hush-psubst/tick_in_heredoc.right
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										5
									
								
								shell/hush_test/hush-psubst/tick_in_heredoc.right
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,5 @@ | ||||
| 1 | ||||
|  | ||||
| 2 | ||||
|  | ||||
| 3 | ||||
							
								
								
									
										7
									
								
								shell/hush_test/hush-psubst/tick_in_heredoc.tests
									
									
									
									
									
										Executable file
									
								
							
							
						
						
									
										7
									
								
								shell/hush_test/hush-psubst/tick_in_heredoc.tests
									
									
									
									
									
										Executable file
									
								
							| @@ -0,0 +1,7 @@ | ||||
| cat <<END | ||||
| 1 | ||||
| $(echo "") | ||||
| 2 | ||||
| `echo ""` | ||||
| 3 | ||||
| END | ||||
		Reference in New Issue
	
	Block a user