Mozilla/5.0 (Windows NT 6.3; rv:56.0) Gecko/20100101 Thunderbird/56.0
On 22/05/2019 15:30, Chet Ramey wrote:
What error message did you get when trying to compile bash-5.0? I don't
have or use cygwin, so you'll probably have to go to the cygwin bash
maintainer, but we can at least try to point him in the right direction.
I tried to compile several times, but always failed with
builtins/set.def:
-------------------------
./mkbuiltins.exe -D . set.def
gcc -c -DHAVE_CONFIG_H -DSHELL -I. -I.. -I.. -I../include -I../lib
-I. -DRECYCLES_PIDS -g -O2 -Wno-parentheses -Wno-format-security
set.c || ( rm -f set.c ; exit 1 )
./set.def:219:21: error: 'igncr' undeclared here (not in a function);
did you mean 'signal'?
{ "igncr", '\0', &igncr, NULL, (setopt_get_func_t *)NULL },
^~~~~
signal
./set.def: In function 'set_minus_o_option_maybe':
./set.def:504:28: warning: passing argument 1 of 'find_minus_o_option'
discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers]
i = find_minus_o_option (option_name);
^~~~~~~~~~~
./set.def:262:12: note: expected 'char *' but argument is of type 'const
char *'
char *name;
^~~~
./set.def:507:26: warning: passing argument 1 of 'sh_invalidoptname'
discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers]
sh_invalidoptname (option_name);
^~~~~~~~~~~
In file included from /usr/include/wchar.h:16,
from ../config-bot.h:144,
from ../config.h:1206,
from ./set.def:23:
common.h:94:36: note: expected 'char *' but argument is of type 'const
char *'
./set.def:514:48: warning: passing argument 2 of 'o_options[i].set_func'
discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers]
SET_BINARY_O_OPTION_VALUE (i, on_or_off, option_name);
^~~~~~~~~~~
./set.def:257:63: note: in definition of macro 'SET_BINARY_O_OPTION_VALUE'
((o_options[i].set_func) ? (*o_options[i].set_func) (onoff, name) \
^~~~
./set.def:514:48: note: expected 'char *' but argument is of type 'const
char *'
SET_BINARY_O_OPTION_VALUE (i, on_or_off, option_name);
^~~~~~~~~~~
./set.def:257:63: note: in definition of macro 'SET_BINARY_O_OPTION_VALUE'
((o_options[i].set_func) ? (*o_options[i].set_func) (onoff, name) \
^~~~
./set.def:521:23: warning: passing argument 1 of 'sh_invalidoptname'
discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers]
sh_invalidoptname (option_name);
^~~~~~~~~~~
In file included from /usr/include/wchar.h:16,
from ../config-bot.h:144,
from ../config.h:1206,
from ./set.def:23:
common.h:94:36: note: expected 'char *' but argument is of type 'const
char *'
extern void sh_invalidoptname __P((char *));
^~~~~~
make[1]: *** [Makefile:119: set.o] Error 1
make[1]: Leaving directory '/usr/src/bash/5.0/bash-5.0/builtins'
make: *** [Makefile:733: builtins/libbuiltins.a] Error 1
-------------------------------
I think, the "'igncr' undeclared here" indicates that this is cygwin
related. As there is no bash-5.0 cygwin patch I reused the 4.4.12
one. It applied with rejects in builtins/set.def.
The relevant part of the cygwin patch is as follows:
--- origsrc/bash-4.4/builtins/set.def 2016-06-02 19:10:10.000000000 -0500
+++ src/bash-4.4/builtins/set.def 2017-01-27 12:22:17.633133400 -0600
@@ -56,6 +56,13 @@ extern int dont_save_function_defs;
#if defined (READLINE)
extern int no_line_editing;
#endif /* READLINE */
+#ifdef __CYGWIN__
+extern int igncr;
+static int set_minus_o_option_maybe (int, const char *, int);
+# define INTERACTIVE_ONLY ,1
+#else
+# define INTERACTIVE_ONLY
+#endif
$BUILTIN set
$FUNCTION set_builtin
@@ -92,6 +99,9 @@ Options:
#if defined (HISTORY)
history enable command history
#endif
+#ifdef __CYGWIN__
+ igncr on Cygwin, ignore \r in line endings
+#endif
ignoreeof the shell will not exit upon reading EOF
interactive-comments
allow comments to appear in interactive commands
@@ -192,29 +202,39 @@ const struct {
int *variable;
setopt_set_func_t *set_func;
setopt_get_func_t *get_func;
+#ifdef __CYGWIN__
+ /* Cygwin users have taken to exporting SHELLOPTS for the cygwin-specific
+ igncr. As a result, we want to ensure SHELLOPTS parsing does not turn
+ on interactive options when exported from an interactive shell, but
+ parse in a non-interactive setting, so as not to break POSIX
/bin/sh */
@@ -588,7 +621,11 @@ parse_shellopts (value)
vptr = 0;
while (vname = extract_colon_unit (value, &vptr))
{
+#ifdef __CYGWIN__
+ set_minus_o_option_maybe (FLAG_ON, vname, !interactive_shell);
+#else
set_minus_o_option (FLAG_ON, vname);
+#endif
free (vname);
}
}
------------------------------
Several hunks applied, others could be applied manually. But the lines
where INTERACTIVE_ONLY was added, produced an error message like
expected } before INTERACTIVE_ONLY
All this is of course far beyond my knowledge and I wouldn't mind you
asking me to be patient and wait for cygwin ...
Thanks for your efforts
Henning