Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bash bug] Building BaCon on MSYS2 #167

Open
ghost opened this issue Aug 15, 2023 · 9 comments
Open

[Bash bug] Building BaCon on MSYS2 #167

ghost opened this issue Aug 15, 2023 · 9 comments

Comments

@ghost
Copy link

ghost commented Aug 15, 2023

The problem was found by @sskras: msys2/MSYS2-packages#3960 (comment)

@sskras
Copy link

sskras commented Aug 15, 2023

Printing CR and LF characters using echo -e works as expected in all tested environments:

  • Cygwin 3.4.6-1 (2023-02-14)
  • Midipix 2022.11.18
  • MSYS2 3.4.6 (2023-04-01)
  • Ubuntu 20.04.06 LTS

But when echoing CR-LF during command substitution (recording output of the command between the backticks), in some cases MSYS2 behavior starts to differ:

What is echoed

Simple echo, generic case is OK

During command substitution

MSYS2 state

on Cygwin 3.4.6-1, Ubuntu 20.04, midipix 2022.11

On MSYS2 3.4.6

CR-only, no LF:

$ echo -e -n "\015" | od -tx1
0000000 0d
0000001
$ echo -n `echo -e -n "\015"` | od -tx1
0000000 0d
0000001
$ echo -n `echo -e -n "\015"` | od -tx1
0000000 0d
0000001

OK

CR + implicit LF:

$ echo -e "\015" | od -tx1
0000000 0d 0a
0000002
$ echo -n `echo -e "\015"` | od -tx1
0000000 0d
0000001
$ echo -n `echo -e "\015"` | od -tx1
0000000

Broken

CR + explicit LF:

$ echo -e -n "\015\012" | od -tx1
0000000 0d 0a
0000002
$ echo -n `echo -e -n "\015\012"` | od -tx1
0000000 0d
0000001
$ echo -n `echo -e -n "\015\012"` | od -tx1
0000000

Broken

Leading CR-LF:

$ echo -e -n "\015\012." | od -tx1
0000000 0d 0a 2e
0000003
$ echo -n `echo -e -n "\015\012."` | od -tx1
0000000 0d 20 2e
0000003
$ echo -n `echo -e -n "\015\012."` | od -tx1
0000000 0d 20 2e
0000003

OK

Middle CR-LF:

$ echo -e -n ".\015\012." | od -tx1
0000000 2e 0d 0a 2e
0000004
$ echo -n `echo -e -n ".\015\012."` | od -tx1
0000000 2e 0d 20 2e
0000004
$ echo -n `echo -e -n ".\015\012."` | od -tx1
0000000 2e 0d 20 2e
0000004

OK

Trailing CR-LF:

$ echo -e -n ".\015\012" | od -tx1
0000000 2e 0d 0a
0000003
$ echo -n `echo -e -n ".\015\012"` | od -tx1
0000000 2e 0d
0000002
$ echo -n `echo -e -n ".\015\012"` | od -tx1
0000000 2e
0000001

Broken

I would summarize the issue following:

Bash on MSYS2 eats trailing CR-LF bytes during the command substitution (instead of eating just the LF byte).

@sskras
Copy link

sskras commented Aug 28, 2023

Ping @lazka: do you (or someone of other core devs) agree with my summary (the last line) ?

@sskras
Copy link

sskras commented Aug 29, 2023

The behavior is the same on MSYS2 3.4.8.x86_64 2023-08-18 23:11.

@ghost ghost changed the title Building BaCon on MSYS2 [Bash bug] Building BaCon on MSYS2 Sep 5, 2023
@ghost
Copy link
Author

ghost commented Sep 5, 2023

Ping @lazka: do you (or someone of other core devs) agree with my summary (the last line) ?

It seems no one cares.

@ghost ghost closed this as completed Sep 5, 2023
@sskras
Copy link

sskras commented Sep 5, 2023

Ping @lazka @elieux. We've got a bug in the build of Bash at handling CRs. Cygwin build is fine.
Maybe we should keep this issue open (even if you are not responding) ? :)

@sskras
Copy link

sskras commented Sep 5, 2023

Also ping @MehdiChinoune.

@lazka lazka reopened this Sep 5, 2023
@lazka
Copy link
Member

lazka commented Sep 5, 2023

Ok, even if no one has time right now. Let's keep this open.

@sskras
Copy link

sskras commented Sep 5, 2023

I could do some R'n'D about the Cygwin-vs-MSYS2 difference. But I have no idea about how to do it / where to start.

@sskras
Copy link

sskras commented Jan 23, 2024

Still present:

$ uname -a
MINGW64_NT-10.0-19044 DESKTOP-O7JE7JE 3.4.10.x86_64 2023-12-22 10:06 UTC x86_64 Msys

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants