7 Bug-Reported-by: D630 <d630@posteo.net>
8 Bug-Reference-ID: <cf8523d58ac75b9ffba9519faa175618@posteo.de>
9 Bug-Reference-URL: https://lists.gnu.org/archive/html/bug-bash/2022-10/msg00092.html
13 Command substitutions need to preserve newlines instead of replacing them
14 with semicolons, especially in the presence of multiple here-documents.
16 Patch (apply with `patch -p0'):
18 *** ../bash-5.2-patched/print_cmd.c 2022-07-26 09:16:39.000000000 -0400
19 --- print_cmd.c 2022-10-17 10:41:06.000000000 -0400
24 char c = command->value.Connection->connector;
27 s[0] = printing_comsub ? c : ';';
30 + was_newline = deferred_heredocs == 0 && was_heredoc == 0 && c == '\n';
31 if (deferred_heredocs == 0)
36 if (inside_function_def)
38 + else if (printing_comsub && c == '\n' && was_newline == 0)
39 + cprintf ("\n"); /* preserve newlines in comsubs but don't double them */
48 dispose_command (cmdcopy);
55 ! was_heredoc = 0; /* not printing any here-documents now */
58 dispose_command (cmdcopy);
65 result = the_printed_command;
74 result = the_printed_command;
75 *** ../bash-5.2/patchlevel.h 2020-06-22 14:51:03.000000000 -0400
76 --- patchlevel.h 2020-10-01 11:01:28.000000000 -0400
79 looks for to find the patch level (for the sccs version string). */
81 ! #define PATCHLEVEL 2
83 #endif /* _PATCHLEVEL_H_ */
85 looks for to find the patch level (for the sccs version string). */
87 ! #define PATCHLEVEL 3
89 #endif /* _PATCHLEVEL_H_ */