Open k-takata opened 4 years ago
If I revert the following hunks, the issue disappears:
https://github.com/msys2/MSYS2-packages/blob/8a97a6ca34414680f59b2227d3df223c65e90373/bash/0005-bash-4.3-msys2-fix-lineendings.patch#L86-L93 https://github.com/msys2/MSYS2-packages/blob/8a97a6ca34414680f59b2227d3df223c65e90373/bash/0005-bash-4.3-msys2-fix-lineendings.patch#L182-L189 https://github.com/msys2/MSYS2-packages/blob/8a97a6ca34414680f59b2227d3df223c65e90373/bash/0005-bash-4.3-msys2-fix-lineendings.patch#L197-L200
I have same issue too. My bash version is 5.2.15(1)-release (x86_64-pc-msys)
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 \e[0m\]\n
at the line end. It works fine.
This hasn't yet been fixed after four years since the report. Did anyone make an effort to fix this problem? @lazka @Alexpux Who are responsible for the Bash package in MSYS2?
This causes many error reports as follows. This is not a complete list. These are just the reports to a repository that I maintain and some others that can be quickly found by Google search.
$()
Command Substitution Cause Bash Parse Error · Issue #3303 · git-for-windows/gitFor individual personal setting, "the fix" suggested in some of the threads or https://github.com/msys2/MSYS2-packages/issues/1839#issuecomment-1751613961 might work. However, we don't want to include in a larger shared framework such specific workarounds caused by a package unmaintained for ten years unless there is a reason that this cannot be fixed in the origin.
@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. I've sent a patch to the Cygwin mailing list: https://cygwin.com/pipermail/cygwin/2024-May/255980.html
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