-
Notifications
You must be signed in to change notification settings - Fork 496
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
bash: '\n' after command substitution in $PS1 causes error #1839
Comments
If I revert the following hunks, the issue disappears: MSYS2-packages/bash/0005-bash-4.3-msys2-fix-lineendings.patch Lines 86 to 93 in 8a97a6c
MSYS2-packages/bash/0005-bash-4.3-msys2-fix-lineendings.patch Lines 182 to 189 in 8a97a6c
MSYS2-packages/bash/0005-bash-4.3-msys2-fix-lineendings.patch Lines 197 to 200 in 8a97a6c
|
I have same issue too. |
I recently switched from Cygwin to MSYS2 and I have the same problem, and this problem seems to be only on MSYS2, I don't experience it on any of the remaining platforms. Hope this issue can be fixed soon. |
I add |
@lazka Who is responsible for the Bash package? |
Workarounds and more info on Stack Overflow: |
As I wrote in #4477, the issue also occurs in Cygwin bash when the igncr option is set. |
Fixes msys2#1839 `0005-bash-4.3-msys2-fix-lineendings.patch` adds CRLF support. However, `0001-bash-4.4-cygwin.patch` already added `igncr` option to Bash to support CRLF. I confirmed that the Cygwin version of Bash has also the same issue with msys2#1839 when the `igncr` option is set. After debugging, I found that there is an issue in `rewind_input_string()` in `parser.y` that it doesn't take the CR into account. This PR adds the following changes: * Modify `rewind_input_string()` to take the CR into account. (It might be better to apply a similar change to the Cygwin version of Bash.) * Remove all the changes from `y.tab.c`. This file should be automatically generated from `parser.y`.
Fixes msys2#1839 `0005-bash-4.3-msys2-fix-lineendings.patch` adds CRLF support. However, `0001-bash-4.4-cygwin.patch` already added `igncr` option to Bash to support CRLF. I confirmed that the Cygwin version of Bash has also the same issue with msys2#1839 when the `igncr` option is set. After debugging, I found that there is an issue in `rewind_input_string()` in `parser.y` that it doesn't take the CR into account. This PR adds the following changes: * Modify `rewind_input_string()` to take the CR into account. (It might be better to apply a similar change to the Cygwin version of Bash.) * Remove all the changes from `y.tab.c`. This file should be automatically generated from `parser.y`. * Set `LC_ALL=C.UTF-8` when running `make check` for running on non-English locales. * Add two tests: `run-ps1lf` and `run-crlf`. Note: This patch contains a line with CRLF. So, .gitattributes is also updated to keep the CRLF.
When I use
\n
after command substitution in$PS1
, it causes syntax error:It should not cause the error.
If I remove the
\n
after$(date)
, it works fine:Using backquotes instead of
$()
also works fine:Setting
PS1='$(date)\n\$ '
works fine on Cygwin, so this seems an MSYS2 specific issue.See also: https://stackoverflow.com/questions/21517281/ps1-command-substitution-fails-when-containing-newlines-on-msys-bash
The text was updated successfully, but these errors were encountered: