Skip to content

Commit

Permalink
bash: Don't use the igncr option for now
Browse files Browse the repository at this point in the history
Don't use the igncr option for now as suggested at msys2#4477.
  • Loading branch information
k-takata committed Jun 3, 2024
1 parent eac7e79 commit 319f0f4
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 20 deletions.
39 changes: 20 additions & 19 deletions bash/0005-bash-4.3-msys2-fix-lineendings.patch
Original file line number Diff line number Diff line change
Expand Up @@ -64,21 +64,6 @@ index f4c2a2f..0ae74ca 100644
}

/* **************************************************************** */
diff --git a/input.c b/input.c
index 3944585c..d4fa2ced 100644
--- a/input.c
+++ b/input.c
@@ -41,7 +41,9 @@
#include "externs.h"
#include "trap.h"

-#ifdef __CYGWIN__
+#ifdef __MSYS__
+int igncr = 1;
+#elif defined(__CYGWIN__)
int igncr;
#endif

diff --git a/lib/readline/display.c b/lib/readline/display.c
index c1135ec..b388af6 100644
--- a/lib/readline/display.c
Expand All @@ -97,17 +82,33 @@ index c1135ec..b388af6 100644
if (vlp)
diff --git a/parse.y b/parse.y
index 8fd24a1c..232a33dc 100644
@@ -1678,7 +1684,16 @@ rewind_input_string ()
--- a/parse.y
+++ b/parse.y
@@ -1459,7 +1459,13 @@ yy_input_name ()
static int
yy_getc ()
{
- return (*(bash_input.getter)) ();
+#ifdef __MSYS__
+ int c;
+ while ((c = (*(bash_input.getter)) ()) == '\r');
+ return c;
+#else
+ return (*(bash_input.getter)) ();
+#endif
}

/* Call this to unget C. That is, to make C the next character
@@ -1684,7 +1690,15 @@ rewind_input_string ()
into account, e.g., $(...\n) */
xchars = shell_input_line_len - shell_input_line_index;
if (bash_input.location.string[-1] == '\n')
- xchars++;
+ {
+ xchars++;
+#ifdef __CYGWIN__
+#ifdef __MSYS__
+ {
+ extern int igncr;
+ if (igncr && bash_input.location.string[-2] == '\r')
+ if (bash_input.location.string[-2] == '\r')
+ xchars++;
+ }
+#endif
Expand Down
2 changes: 1 addition & 1 deletion bash/PKGBUILD
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ sha256sums=('a139c166df7ff4471c5e0733051642ee5556c1cc8a4a78f145583c5c81ab32fb'
'SKIP'
'948b8b5401dcb4e5eb577cfa6543e740e2e3bd0690939d8e77d078d75d110097'
'6ca7633a87db7caf1d2d1a96779681c365d0ad2c11b2ea758e772f4ebff2a62f'
'0fec68ca244ae251fae123dbb02387d3ca45e6f8f315e2f3f2555c97ebdfa88a'
'ed6a63d0e0c1d5d90e5c12405f606d2cb385f68d32181b65e0fbafd49f40f6f1'
'500c75c64593a70276585345a55c807226c0cc220d08b7cccece2ab005b3bcea'
'cbae1aa81d56eba4e916bdaf2b2983731d6e2537dd8d606a3b378e49bcb81e79'
'f42f2fee923bc2209f406a1892772121c467f44533bedfe00a176139da5d310a'
Expand Down

0 comments on commit 319f0f4

Please sign in to comment.