Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)

cygwin: bash updated to 4.3 for cygwin platform

+1407 -1002
-987
pkgs/shells/bash/bash-4.1.17-9.src.patch
··· 1 - --- Makefile.in 2009-12-30 10:05:40.000000000 -0800 2 - +++ Makefile.in 2014-10-08 13:50:27.419837900 -0700 3 - @@ -565,7 +565,7 @@ lint: 4 - ${MAKE} ${MFLAGS} CFLAGS='${GCC_LINT_FLAGS}' .made 5 - 6 - version.h: $(SOURCES) config.h Makefile 7 - - $(SHELL) $(SUPPORT_SRC)mkversion.sh -b -S ${topdir} -s $(RELSTATUS) -d $(Version) -o newversion.h \ 8 - + $(SHELL) $(SUPPORT_SRC)mkversion.sh -S ${topdir} -s $(RELSTATUS) -d $(Version) -o newversion.h \ 9 - && mv newversion.h version.h 10 - 11 - bashversion$(EXEEXT): patchlevel.h conftypes.h version.h buildversion.o $(SUPPORT_SRC)bashversion.c 12 - --- bashline.c 2014-10-08 13:45:09.240173500 -0700 13 - +++ bashline.c 2014-10-08 13:50:27.419837900 -0700 14 - @@ -68,6 +68,12 @@ 15 - # include "pcomplete.h" 16 - #endif 17 - 18 - +#ifdef __x86_64__ 19 - +#define IMP(x) __imp_##x 20 - +#else 21 - +#define IMP(x) _imp__##x 22 - +#endif 23 - + 24 - /* These should agree with the defines for emacs_mode and vi_mode in 25 - rldefs.h, even though that's not a public readline header file. */ 26 - #ifndef EMACS_EDITING_MODE 27 - @@ -239,6 +245,11 @@ int no_empty_command_completion; 28 - are the only possible matches, even if FIGNORE says to. */ 29 - int force_fignore = 1; 30 - 31 - +#if __CYGWIN__ 32 - +/* If set, shorten "foo.exe" to "foo" when they are the same file. */ 33 - +int completion_strip_exe; 34 - +#endif /* __CYGWIN__ */ 35 - + 36 - /* Perform spelling correction on directory names during word completion */ 37 - int dircomplete_spelling = 0; 38 - 39 - @@ -446,11 +457,12 @@ initialize_readline () 40 - kseq[0] = CTRL('J'); 41 - kseq[1] = '\0'; 42 - func = rl_function_of_keyseq (kseq, emacs_meta_keymap, (int *)NULL); 43 - - if (func == rl_vi_editing_mode) 44 - + extern rl_command_func_t *IMP(rl_vi_editing_mode); 45 - + if (func == rl_vi_editing_mode || func == IMP(rl_vi_editing_mode)) 46 - rl_unbind_key_in_map (CTRL('J'), emacs_meta_keymap); 47 - kseq[0] = CTRL('M'); 48 - func = rl_function_of_keyseq (kseq, emacs_meta_keymap, (int *)NULL); 49 - - if (func == rl_vi_editing_mode) 50 - + if (func == rl_vi_editing_mode || func == IMP(rl_vi_editing_mode)) 51 - rl_unbind_key_in_map (CTRL('M'), emacs_meta_keymap); 52 - #if defined (VI_MODE) 53 - rl_unbind_key_in_map (CTRL('E'), vi_movement_keymap); 54 - @@ -469,7 +481,8 @@ initialize_readline () 55 - kseq[0] = '~'; 56 - kseq[1] = '\0'; 57 - func = rl_function_of_keyseq (kseq, emacs_meta_keymap, (int *)NULL); 58 - - if (func == 0 || func == rl_tilde_expand) 59 - + extern rl_command_func_t *IMP(rl_tilde_expand); 60 - + if (func == 0 || func == rl_tilde_expand || func == IMP(rl_tilde_expand)) 61 - rl_bind_keyseq_in_map (kseq, bash_complete_username, emacs_meta_keymap); 62 - 63 - rl_bind_key_if_unbound_in_map ('~', bash_possible_username_completions, emacs_ctlx_keymap); 64 - @@ -492,7 +505,8 @@ initialize_readline () 65 - kseq[0] = TAB; 66 - kseq[1] = '\0'; 67 - func = rl_function_of_keyseq (kseq, emacs_meta_keymap, (int *)NULL); 68 - - if (func == 0 || func == rl_tab_insert) 69 - + extern rl_command_func_t *IMP(rl_tab_insert); 70 - + if (func == 0 || func == rl_tab_insert || func == IMP(rl_tab_insert)) 71 - rl_bind_key_in_map (TAB, dynamic_complete_history, emacs_meta_keymap); 72 - 73 - /* Tell the completer that we want a crack first. */ 74 - @@ -1826,6 +1840,14 @@ globword: 75 - /* If we have found a match, and it is an executable file or a 76 - directory name, return it. */ 77 - if (match && executable_or_directory (val)) 78 - +#elif __CYGWIN__ 79 - + /* executable_or_directory will do the right thing on //server, 80 - + but calling stat("//server") is an order of magnitude slower 81 - + than noting that readdir("//") only returns directories. */ 82 - + if (match && (searching_path ? executable_file (val) 83 - + : ((val[0] == '/' && val[1] == '/' 84 - + && ! strchr (&val[2], '/')) 85 - + || executable_or_directory (val)))) 86 - #else 87 - /* If we have found a match, and it is an executable file, return it. 88 - We don't return directory names when searching $PATH, since the 89 - @@ -1835,6 +1857,21 @@ globword: 90 - if (match && (searching_path ? executable_file (val) : executable_or_directory (val))) 91 - #endif 92 - { 93 - +#if __CYGWIN__ 94 - + if (completion_strip_exe) 95 - + { 96 - + int val_len = strlen (val); 97 - + char *candidate; 98 - + if (val_len > 4 && !strcasecmp (&val[val_len - 4], ".exe") 99 - + && (candidate = strdup (val))) 100 - + { 101 - + candidate[val_len - 4] = '\0'; 102 - + if (same_file (val, candidate, NULL, NULL)) 103 - + temp[strlen (temp) - 4] = '\0'; 104 - + free (candidate); 105 - + } 106 - + } 107 - +#endif 108 - free (val); 109 - val = ""; /* So it won't be NULL. */ 110 - return (temp); 111 - @@ -2566,6 +2603,17 @@ test_for_directory (name) 112 - int r; 113 - 114 - fn = bash_tilde_expand (name, 0); 115 - +#if __CYGWIN__ 116 - + /* stat("//server") can only be successful as a directory, but takes 117 - + a several-second timeout to fail. It is much faster to assume 118 - + that //server is a valid name than it is to wait for the stat, 119 - + even though it gives false positives on bad names. */ 120 - + if (fn[0] == '/' && fn[1] == '/' && ! strchr (&fn[2], '/')) 121 - + { 122 - + free (fn); 123 - + return 1; 124 - + } 125 - +#endif /* __CYGWIN__ */ 126 - r = file_isdir (fn); 127 - free (fn); 128 - 129 - --- builtins/evalfile.c 2009-10-19 14:38:21.000000000 -0700 130 - +++ builtins/evalfile.c 2014-10-08 13:50:27.419837900 -0700 131 - @@ -148,10 +148,6 @@ file_error_and_exit: 132 - return ((flags & FEVAL_BUILTIN) ? EXECUTION_FAILURE : -1); 133 - } 134 - 135 - -#if defined (__CYGWIN__) && defined (O_TEXT) 136 - - setmode (fd, O_TEXT); 137 - -#endif 138 - - 139 - if (S_ISREG (finfo.st_mode) && file_size <= SSIZE_MAX) 140 - { 141 - string = (char *)xmalloc (1 + file_size); 142 - --- builtins/set.def 2009-01-04 11:32:23.000000000 -0800 143 - +++ builtins/set.def 2014-10-08 13:50:27.419837900 -0700 144 - @@ -56,6 +56,13 @@ extern int dont_save_function_defs; 145 - #if defined (READLINE) 146 - extern int no_line_editing; 147 - #endif /* READLINE */ 148 - +#if __CYGWIN__ 149 - +extern int igncr; 150 - +static int set_minus_o_option_maybe (int, const char *, int); 151 - +# define INTERACTIVE_ONLY ,1 152 - +#else /* ! __CYGWIN__ */ 153 - +# define INTERACTIVE_ONLY 154 - +#endif 155 - 156 - $BUILTIN set 157 - $FUNCTION set_builtin 158 - @@ -92,6 +99,9 @@ Options: 159 - #if defined (HISTORY) 160 - history enable command history 161 - #endif 162 - +#if __CYGWIN__ 163 - + igncr on cygwin, ignore \r in line endings 164 - +#endif 165 - ignoreeof the shell will not exit upon reading EOF 166 - interactive-comments 167 - allow comments to appear in interactive commands 168 - @@ -181,28 +191,40 @@ const struct { 169 - int *variable; 170 - setopt_set_func_t *set_func; 171 - setopt_get_func_t *get_func; 172 - +#if __CYGWIN__ 173 - + /* Cygwin users have taken to exporting SHELLOPTS for the 174 - + cygwin-specific igncr. As a result, we need to make sure 175 - + SHELLOPTS parsing does not turn on interactive options when 176 - + exported from an interactive shell, but parsed in a 177 - + non-interactive setting, since some interactive options violate 178 - + POSIX /bin/sh rules. */ 179 - + int interactive_only; 180 - +#endif /* __CYGWIN__ */ 181 - } o_options[] = { 182 - { "allexport", 'a', (int *)NULL, (setopt_set_func_t *)NULL, (setopt_get_func_t *)NULL }, 183 - #if defined (BRACE_EXPANSION) 184 - { "braceexpand",'B', (int *)NULL, (setopt_set_func_t *)NULL, (setopt_get_func_t *)NULL }, 185 - #endif 186 - #if defined (READLINE) 187 - - { "emacs", '\0', (int *)NULL, set_edit_mode, get_edit_mode }, 188 - + { "emacs", '\0', (int *)NULL, set_edit_mode, get_edit_mode INTERACTIVE_ONLY}, 189 - #endif 190 - { "errexit", 'e', (int *)NULL, (setopt_set_func_t *)NULL, (setopt_get_func_t *)NULL }, 191 - { "errtrace", 'E', (int *)NULL, (setopt_set_func_t *)NULL, (setopt_get_func_t *)NULL }, 192 - { "functrace", 'T', (int *)NULL, (setopt_set_func_t *)NULL, (setopt_get_func_t *)NULL }, 193 - { "hashall", 'h', (int *)NULL, (setopt_set_func_t *)NULL, (setopt_get_func_t *)NULL }, 194 - #if defined (BANG_HISTORY) 195 - - { "histexpand", 'H', (int *)NULL, (setopt_set_func_t *)NULL, (setopt_get_func_t *)NULL }, 196 - + { "histexpand", 'H', (int *)NULL, (setopt_set_func_t *)NULL, (setopt_get_func_t *)NULL INTERACTIVE_ONLY}, 197 - #endif /* BANG_HISTORY */ 198 - #if defined (HISTORY) 199 - - { "history", '\0', &enable_history_list, bash_set_history, (setopt_get_func_t *)NULL }, 200 - + { "history", '\0', &enable_history_list, bash_set_history, (setopt_get_func_t *)NULL INTERACTIVE_ONLY}, 201 - +#endif 202 - +#if __CYGWIN__ 203 - + { "igncr", '\0', &igncr, NULL, (setopt_get_func_t *)NULL }, 204 - #endif 205 - { "ignoreeof", '\0', &ignoreeof, set_ignoreeof, (setopt_get_func_t *)NULL }, 206 - { "interactive-comments", '\0', &interactive_comments, (setopt_set_func_t *)NULL, (setopt_get_func_t *)NULL }, 207 - { "keyword", 'k', (int *)NULL, (setopt_set_func_t *)NULL, (setopt_get_func_t *)NULL }, 208 - - { "monitor", 'm', (int *)NULL, (setopt_set_func_t *)NULL, (setopt_get_func_t *)NULL }, 209 - + { "monitor", 'm', (int *)NULL, (setopt_set_func_t *)NULL, (setopt_get_func_t *)NULL INTERACTIVE_ONLY}, 210 - { "noclobber", 'C', (int *)NULL, (setopt_set_func_t *)NULL, (setopt_get_func_t *)NULL }, 211 - { "noexec", 'n', (int *)NULL, (setopt_set_func_t *)NULL, (setopt_get_func_t *)NULL }, 212 - { "noglob", 'f', (int *)NULL, (setopt_set_func_t *)NULL, (setopt_get_func_t *)NULL }, 213 - @@ -220,7 +242,7 @@ const struct { 214 - { "privileged", 'p', (int *)NULL, (setopt_set_func_t *)NULL, (setopt_get_func_t *)NULL }, 215 - { "verbose", 'v', (int *)NULL, (setopt_set_func_t *)NULL, (setopt_get_func_t *)NULL }, 216 - #if defined (READLINE) 217 - - { "vi", '\0', (int *)NULL, set_edit_mode, get_edit_mode }, 218 - + { "vi", '\0', (int *)NULL, set_edit_mode, get_edit_mode INTERACTIVE_ONLY}, 219 - #endif 220 - { "xtrace", 'x', (int *)NULL, (setopt_set_func_t *)NULL, (setopt_get_func_t *)NULL }, 221 - {(char *)NULL, 0 , (int *)NULL, (setopt_set_func_t *)NULL, (setopt_get_func_t *)NULL }, 222 - @@ -407,6 +429,15 @@ int 223 - set_minus_o_option (on_or_off, option_name) 224 - int on_or_off; 225 - char *option_name; 226 - +#if __CYGWIN__ 227 - +{ 228 - + /* See cygwin comments above. */ 229 - + return set_minus_o_option_maybe (on_or_off, option_name, 0); 230 - +} 231 - +static int 232 - +set_minus_o_option_maybe (int on_or_off, const char *option_name, 233 - + int avoid_interactive) 234 - +#endif /* __CYGWIN__ */ 235 - { 236 - register int i; 237 - 238 - @@ -414,6 +445,10 @@ set_minus_o_option (on_or_off, option_na 239 - { 240 - if (STREQ (option_name, o_options[i].name)) 241 - { 242 - +#if __CYGWIN__ 243 - + if (o_options[i].interactive_only && avoid_interactive) 244 - + return EXECUTION_SUCCESS; 245 - +#endif /* __CYGWIN__ */ 246 - if (o_options[i].letter == 0) 247 - { 248 - SET_BINARY_O_OPTION_VALUE (i, on_or_off, option_name); 249 - @@ -539,7 +574,11 @@ parse_shellopts (value) 250 - vptr = 0; 251 - while (vname = extract_colon_unit (value, &vptr)) 252 - { 253 - +#if __CYGWIN__ 254 - + set_minus_o_option_maybe (FLAG_ON, vname, !interactive_shell); 255 - +#else /* !__CYGWIN__ */ 256 - set_minus_o_option (FLAG_ON, vname); 257 - +#endif 258 - free (vname); 259 - } 260 - } 261 - --- builtins/shopt.def 2009-12-22 13:25:32.000000000 -0800 262 - +++ builtins/shopt.def 2014-10-08 13:50:27.435414600 -0700 263 - @@ -85,6 +85,10 @@ extern int check_jobs_at_exit; 264 - extern int autocd; 265 - extern int glob_star; 266 - 267 - +#if defined(__CYGWIN__) && defined(READLINE) 268 - +extern int completion_strip_exe; 269 - +#endif 270 - + 271 - #if defined (EXTENDED_GLOB) 272 - extern int extended_glob; 273 - #endif 274 - @@ -146,6 +150,9 @@ static struct { 275 - { "compat31", &shopt_compat31, set_compatibility_level }, 276 - { "compat32", &shopt_compat32, set_compatibility_level }, 277 - { "compat40", &shopt_compat40, set_compatibility_level }, 278 - +#if defined(__CYGWIN__) && defined(READLINE) 279 - + { "completion_strip_exe", &completion_strip_exe, NULL }, 280 - +#endif 281 - #if defined (READLINE) 282 - { "dirspell", &dircomplete_spelling, (shopt_set_func_t *)NULL }, 283 - #endif 284 - --- config-top.h 2009-12-22 12:29:39.000000000 -0800 285 - +++ config-top.h 2014-10-08 13:50:27.435414600 -0700 286 - @@ -75,10 +75,10 @@ 287 - #define KSH_COMPATIBLE_SELECT 288 - 289 - /* System-wide .bashrc file for interactive shells. */ 290 - -/* #define SYS_BASHRC "/etc/bash.bashrc" */ 291 - +//set by nix #define SYS_BASHRC "/etc/bash.bashrc" 292 - 293 - /* System-wide .bash_logout for login shells. */ 294 - -/* #define SYS_BASH_LOGOUT "/etc/bash.bash_logout" */ 295 - +//set by nix #define SYS_BASH_LOGOUT "/etc/bash.bash_logout" 296 - 297 - /* Define this to make non-interactive shells begun with argv[0][0] == '-' 298 - run the startup files when not in posix mode. */ 299 - @@ -88,7 +88,7 @@ 300 - sshd and source the .bashrc if so (like the rshd behavior). This checks 301 - for the presence of SSH_CLIENT or SSH2_CLIENT in the initial environment, 302 - which can be fooled under certain not-uncommon circumstances. */ 303 - -/* #define SSH_SOURCE_BASHRC */ 304 - +//set by nix #define SSH_SOURCE_BASHRC 305 - 306 - /* Define if you want the case-capitalizing operators (~[~]) and the 307 - `capcase' variable attribute (declare -c). */ 308 - --- doc/Makefile.in 2009-03-10 08:44:30.000000000 -0700 309 - +++ doc/Makefile.in 2014-10-08 13:50:27.435414600 -0700 310 - @@ -170,7 +170,7 @@ bashref.html: $(BASHREF_FILES) $(HSUSER) 311 - $(TEXI2HTML) -menu -monolithic -I $(TEXINPUTDIR) $(srcdir)/bashref.texi 312 - 313 - bash.info: bashref.info 314 - - ${SHELL} ${INFOPOST} < $(srcdir)/bashref.info > $@ ; \ 315 - + ${SHELL} ${INFOPOST} < bashref.info > $@ ; \ 316 - 317 - bash.txt: bash.1 318 - bash.ps: bash.1 319 - @@ -226,9 +226,9 @@ install: info installdirs bash.info 320 - -$(INSTALL_DATA) $(srcdir)/bash.1 $(DESTDIR)$(man1dir)/bash${man1ext} 321 - -$(INSTALL_DATA) $(srcdir)/bashbug.1 $(DESTDIR)$(man1dir)/bashbug${man1ext} 322 - # uncomment the next lines to install the builtins man page 323 - -# sed 's:bash\.1:man1/&:' $(srcdir)/builtins.1 > $${TMPDIR:-/var/tmp}/builtins.1 324 - -# -$(INSTALL_DATA) $${TMPDIR:-/var/tmp}/builtins.1 $(DESTDIR)$(man1dir)/bash_builtins${man1ext} 325 - -# -$(RM) $${TMPDIR:-/var/tmp}/builtins.1 326 - + sed 's:bash\.1:man1/&:' $(srcdir)/builtins.1 > $${TMPDIR:-/var/tmp}/builtins.1 327 - + -$(INSTALL_DATA) $${TMPDIR:-/var/tmp}/builtins.1 $(DESTDIR)$(man1dir)/bash_builtins${man1ext} 328 - + -$(RM) $${TMPDIR:-/var/tmp}/builtins.1 329 - -if test -f bash.info; then d=.; else d=$(srcdir); fi; \ 330 - $(INSTALL_DATA) $$d/bash.info $(DESTDIR)$(infodir)/bash.info 331 - # run install-info if it is present to update the info directory 332 - --- doc/bash.1 2009-12-30 10:01:31.000000000 -0800 333 - +++ doc/bash.1 2014-10-08 13:50:27.435414600 -0700 334 - @@ -1568,6 +1568,14 @@ subsequently reset. 335 - Expands to the effective user ID of the current user, initialized at 336 - shell startup. This variable is readonly. 337 - .TP 338 - +.B EXECIGNORE 339 - +A colon-separated list of extended glob (see \fBPattern Matching\fP) 340 - +patterns. Files with full paths matching one of these patterns are 341 - +not considered executable for the purposes of completion and PATH 342 - +searching, but the \fB[\fP, \fB[[\fP, and \fBtest\fP builtins are not 343 - +affected. Use this variable to deal with systems that set the 344 - +executable bit on files that are not actually executable. 345 - +.TP 346 - .B FUNCNAME 347 - An array variable containing the names of all shell functions 348 - currently in the execution call stack. 349 - @@ -8772,6 +8780,10 @@ If set, 350 - attempts spelling correction on directory names during word completion 351 - if the directory name initially supplied does not exist. 352 - .TP 8 353 - +.B completion_strip_exe 354 - +If set, whenever bash sees `foo.exe' during completion, it checks if 355 - +`foo' is the same file and strips the suffix. 356 - +.TP 8 357 - .B dotglob 358 - If set, 359 - .B bash 360 - --- doc/bashref.texi 2009-12-29 12:59:18.000000000 -0800 361 - +++ doc/bashref.texi 2014-10-08 13:50:27.435414600 -0700 362 - @@ -4363,6 +4363,10 @@ If set, Bash 363 - changes its behavior to that of version 3.1 with respect to quoted 364 - arguments to the conditional command's =~ operator. 365 - 366 - +@item completion_strip_exe 367 - +If set, whenever bash sees `foo.exe' during completion, it checks if 368 - +`foo' is the same file and strips the suffix. 369 - + 370 - @item dirspell 371 - If set, Bash 372 - attempts spelling correction on directory names during word completion 373 - @@ -4892,6 +4896,14 @@ emacs shell buffer and disables line edi 374 - The numeric effective user id of the current user. This variable 375 - is readonly. 376 - 377 - +@item EXECIGNORE 378 - +A colon-separated list of extended glob ((@pxref{Pattern Matching}) 379 - +patterns. Files with full paths matching one of these patterns are 380 - +not considered executable for the purposes of completion and PATH 381 - +searching, but the @code{[}, @code{[[}, and @code{test} builtins are 382 - +not affected. Use this variable to deal with systems that set the 383 - +executable bit on files that are not actually executable. 384 - + 385 - @item FCEDIT 386 - The editor used as a default by the @option{-e} option to the @code{fc} 387 - builtin command. 388 - --- doc/builtins.1 2008-08-12 06:24:40.000000000 -0700 389 - +++ doc/builtins.1 2014-10-08 13:50:27.435414600 -0700 390 - @@ -12,6 +12,6 @@ shift, shopt, source, suspend, test, tim 391 - ulimit, umask, unalias, unset, wait \- bash built-in commands, see \fBbash\fR(1) 392 - .SH BASH BUILTIN COMMANDS 393 - .nr zZ 1 394 - -.so bash.1 395 - +.so man1/bash.1 396 - .SH SEE ALSO 397 - bash(1), sh(1) 398 - --- execute_cmd.c 2009-12-30 09:55:37.000000000 -0800 399 - +++ execute_cmd.c 2014-10-08 13:50:27.435414600 -0700 400 - @@ -4004,7 +4004,7 @@ execute_function (var, words, flags, fds 401 - char *debug_trap, *error_trap, *return_trap; 402 - #if defined (ARRAY_VARS) 403 - SHELL_VAR *funcname_v, *nfv, *bash_source_v, *bash_lineno_v; 404 - - ARRAY *funcname_a, *bash_source_a, *bash_lineno_a; 405 - + ARRAY *funcname_a, *volatile bash_source_a, *volatile bash_lineno_a; 406 - #endif 407 - FUNCTION_DEF *shell_fn; 408 - char *sfile, *t; 409 - @@ -4571,6 +4571,12 @@ execute_disk_command (words, redirects, 410 - hookf = find_function (NOTFOUND_HOOK); 411 - if (hookf == 0) 412 - { 413 - +#if __CYGWIN__ 414 - + /* Point out \r use to clueless users. The memory leak 415 - + is harmless - we're about to exit. */ 416 - + if (ansic_shouldquote (pathname)) 417 - + pathname = ansic_quote (pathname, 0, NULL); 418 - +#endif /* __CYGWIN__ */ 419 - internal_error (_("%s: command not found"), pathname); 420 - exit (EX_NOTFOUND); /* Posix.2 says the exit status is 127 */ 421 - } 422 - @@ -4990,6 +4996,10 @@ do_piping (pipe_in, pipe_out) 423 - dup_error (pipe_in, 0); 424 - if (pipe_in > 0) 425 - close (pipe_in); 426 - +#if __CYGWIN__ 427 - + /* Let stdio know that fd may have changed from text to binary. */ 428 - + freopen (NULL, "r", stdin); 429 - +#endif /* __CYGWIN__ */ 430 - } 431 - if (pipe_out != NO_PIPE) 432 - { 433 - @@ -5005,5 +5015,12 @@ do_piping (pipe_in, pipe_out) 434 - if (dup2 (1, 2) < 0) 435 - dup_error (1, 2); 436 - } 437 - +#if __CYGWIN__ 438 - + extern int sh_setlinebuf (FILE *); 439 - + /* Let stdio know that fd may have changed from text to binary. */ 440 - + freopen (NULL, "w", stdout); 441 - + /* Bash builtins (foolishly) rely on line-buffering. */ 442 - + sh_setlinebuf (stdout); 443 - +#endif /* __CYGWIN__ */ 444 - } 445 - } 446 - --- findcmd.c 2009-06-05 13:25:38.000000000 -0700 447 - +++ findcmd.c 2014-10-08 13:50:27.451015900 -0700 448 - @@ -43,6 +43,8 @@ 449 - #include "hashcmd.h" 450 - #include "findcmd.h" /* matching prototypes and declarations */ 451 - 452 - +#include <glob/strmatch.h> 453 - + 454 - extern int posixly_correct; 455 - 456 - /* Static functions defined and used in this file. */ 457 - @@ -71,6 +73,38 @@ int check_hashed_filenames; 458 - containing the file of interest. */ 459 - int dot_found_in_search = 0; 460 - 461 - +static struct ignorevar execignore = 462 - +{ 463 - + "EXECIGNORE", 464 - + (struct ign *)0, 465 - + 0, 466 - + (char *)0, 467 - + (sh_iv_item_func_t *)0, 468 - +}; 469 - + 470 - +void 471 - +setup_exec_ignore (char *varname) 472 - +{ 473 - + setup_ignore_patterns (&execignore); 474 - +} 475 - + 476 - +/* Return whether we should never consider file executable 477 - + * even if the system tells us it is. */ 478 - +static int 479 - +is_on_exec_blacklist (char *name) 480 - +{ 481 - + struct ign *p; 482 - + int flags = FNM_EXTMATCH | FNM_CASEFOLD; 483 - + 484 - + for (p = execignore.ignores; p && p->val; p++) 485 - + { 486 - + if (strmatch (p->val, (char *)name, flags) != FNM_NOMATCH) 487 - + return (1); 488 - + } 489 - + 490 - + return (0); 491 - +} 492 - + 493 - /* Return some flags based on information about this file. 494 - The EXISTS bit is non-zero if the file is found. 495 - The EXECABLE bit is non-zero the file is executble. 496 - @@ -98,7 +132,7 @@ file_status (name) 497 - file access mechanisms into account. eaccess uses the effective 498 - user and group IDs, not the real ones. We could use sh_eaccess, 499 - but we don't want any special treatment for /dev/fd. */ 500 - - if (eaccess (name, X_OK) == 0) 501 - + if (!is_on_exec_blacklist (name) && eaccess (name, X_OK) == 0) 502 - r |= FS_EXECABLE; 503 - if (eaccess (name, R_OK) == 0) 504 - r |= FS_READABLE; 505 - --- findcmd.h 2009-01-04 11:32:29.000000000 -0800 506 - +++ findcmd.h 2014-10-08 13:50:27.451015900 -0700 507 - @@ -31,5 +31,6 @@ extern char *find_user_command __P((cons 508 - extern char *find_path_file __P((const char *)); 509 - extern char *search_for_command __P((const char *)); 510 - extern char *user_command_matches __P((const char *, int, int)); 511 - +extern void setup_exec_ignore __P((char *)); 512 - 513 - #endif /* _FINDCMD_H_ */ 514 - --- general.c 2009-11-28 18:44:46.000000000 -0800 515 - +++ general.c 2014-10-08 13:50:27.451015900 -0700 516 - @@ -43,6 +43,10 @@ 517 - 518 - #include <tilde/tilde.h> 519 - 520 - +#ifdef __CYGWIN__ 521 - +#include <sys/cygwin.h> 522 - +#endif 523 - + 524 - #if !defined (errno) 525 - extern int errno; 526 - #endif /* !errno */ 527 - @@ -601,7 +605,8 @@ make_absolute (string, dot_path) 528 - { 529 - char pathbuf[PATH_MAX + 1]; 530 - 531 - - cygwin_conv_to_full_posix_path (string, pathbuf); 532 - + cygwin_conv_path (CCP_WIN_A_TO_POSIX | CCP_ABSOLUTE, string, pathbuf, 533 - + PATH_MAX + 1); 534 - result = savestring (pathbuf); 535 - } 536 - #else 537 - --- input.c 2009-01-04 11:32:29.000000000 -0800 538 - +++ input.c 2014-10-08 13:50:27.451015900 -0700 539 - @@ -43,6 +43,10 @@ 540 - #include "externs.h" 541 - #include "quit.h" 542 - 543 - +#if __CYGWIN__ 544 - +int igncr; 545 - +#endif /* __CYGWIN__ */ 546 - + 547 - #if !defined (errno) 548 - extern int errno; 549 - #endif /* !errno */ 550 - @@ -193,6 +197,10 @@ make_buffered_stream (fd, buffer, bufsiz 551 - bp->b_used = bp->b_inputp = bp->b_flag = 0; 552 - if (bufsize == 1) 553 - bp->b_flag |= B_UNBUFF; 554 - +#if __CYGWIN__ 555 - + if ((fcntl (fd, F_GETFL) & O_TEXT) != 0) 556 - + bp->b_flag |= B_TEXT; 557 - +#endif /* __CYGWIN__ */ 558 - return (bp); 559 - } 560 - 561 - @@ -361,11 +369,7 @@ duplicate_buffered_stream (fd1, fd2) 562 - } 563 - 564 - /* Return 1 if a seek on FD will succeed. */ 565 - -#ifndef __CYGWIN__ 566 - # define fd_is_seekable(fd) (lseek ((fd), 0L, SEEK_CUR) >= 0) 567 - -#else 568 - -# define fd_is_seekable(fd) 0 569 - -#endif /* __CYGWIN__ */ 570 - 571 - /* Take FD, a file descriptor, and create and return a buffered stream 572 - corresponding to it. If something is wrong and the file descriptor 573 - @@ -474,6 +478,25 @@ b_fill_buffer (bp) 574 - ssize_t nr; 575 - 576 - CHECK_TERMSIG; 577 - +#ifdef __CYGWIN__ 578 - + /* lseek'ing on text files is problematic; lseek reports the true 579 - + file offset, but read collapses \r\n and returns a character 580 - + count. We cannot reliably seek backwards if nr is smaller than 581 - + the seek offset encountered during the read, and must instead 582 - + treat the stream as unbuffered. */ 583 - + if ((bp->b_flag & (B_TEXT | B_UNBUFF)) == B_TEXT) 584 - + { 585 - + off_t offset = lseek (bp->b_fd, 0, SEEK_CUR); 586 - + nr = zread (bp->b_fd, bp->b_buffer, bp->b_size); 587 - + if (nr > 0 && nr < lseek (bp->b_fd, 0, SEEK_CUR) - offset) 588 - + { 589 - + lseek (bp->b_fd, offset, SEEK_SET); 590 - + bp->b_flag |= B_UNBUFF; 591 - + nr = zread (bp->b_fd, bp->b_buffer, bp->b_size = 1); 592 - + } 593 - + } 594 - + else 595 - +#endif /* __CYGWIN__ */ 596 - nr = zread (bp->b_fd, bp->b_buffer, bp->b_size); 597 - if (nr <= 0) 598 - { 599 - @@ -486,15 +509,6 @@ b_fill_buffer (bp) 600 - return (EOF); 601 - } 602 - 603 - -#if defined (__CYGWIN__) 604 - - /* If on cygwin, translate \r\n to \n. */ 605 - - if (nr >= 2 && bp->b_buffer[nr - 2] == '\r' && bp->b_buffer[nr - 1] == '\n') 606 - - { 607 - - bp->b_buffer[nr - 2] = '\n'; 608 - - nr--; 609 - - } 610 - -#endif 611 - - 612 - bp->b_used = nr; 613 - bp->b_inputp = 0; 614 - return (bp->b_buffer[bp->b_inputp++] & 0xFF); 615 - @@ -543,6 +557,19 @@ buffered_getchar () 616 - { 617 - CHECK_TERMSIG; 618 - 619 - +#if __CYGWIN__ 620 - + /* shopt igncr means to discard carriage returns from input stream. 621 - + If cr is the only character in the buffer, then recurse to pick 622 - + up the next character; otherwise flatten the buffer. */ 623 - + if (igncr) 624 - + { 625 - + int ch; 626 - + while ((ch = bufstream_getc (buffers[bash_input.location.buffered_fd])) 627 - + == '\r') 628 - + ; 629 - + return ch; 630 - + } 631 - +#endif /* __CYGWIN__ */ 632 - #if !defined (DJGPP) 633 - return (bufstream_getc (buffers[bash_input.location.buffered_fd])); 634 - #else 635 - --- input.h 2009-01-04 11:32:29.000000000 -0800 636 - +++ input.h 2014-10-08 13:50:27.451015900 -0700 637 - @@ -48,6 +48,7 @@ enum stream_type {st_none, st_stdin, st_ 638 - #define B_ERROR 0x02 639 - #define B_UNBUFF 0x04 640 - #define B_WASBASHINPUT 0x08 641 - +#define B_TEXT 0x10 /* Text stream, when O_BINARY is nonzero */ 642 - 643 - /* A buffered stream. Like a FILE *, but with our own buffering and 644 - synchronization. Look in input.c for the implementation. */ 645 - --- lib/sh/pathcanon.c 2008-08-12 11:01:37.000000000 -0700 646 - +++ lib/sh/pathcanon.c 2014-10-08 13:50:27.451015900 -0700 647 - @@ -194,6 +194,8 @@ sh_canonpath (path, flags) 648 - *q++ = DIRSEP; 649 - while (*p && (ISDIRSEP(*p) == 0)) 650 - *q++ = *p++; 651 - + } 652 - + } 653 - /* Check here for a valid directory with _path_isdir. */ 654 - if (flags & PATH_CHECKEXISTS) 655 - { 656 - @@ -211,8 +213,7 @@ sh_canonpath (path, flags) 657 - } 658 - *q = c; 659 - } 660 - - } 661 - - } 662 - + 663 - 664 - /* Empty string is really ``.'' or `/', depending on what we started with. */ 665 - if (q == result) 666 - --- lib/sh/pathphys.c 2008-08-12 11:01:23.000000000 -0700 667 - +++ lib/sh/pathphys.c 2014-10-08 13:50:27.451015900 -0700 668 - @@ -35,6 +35,7 @@ 669 - #include <stdio.h> 670 - #include <chartypes.h> 671 - #include <errno.h> 672 - +#include <stdlib.h> 673 - 674 - #include "shell.h" 675 - 676 - @@ -76,6 +77,10 @@ sh_physpath (path, flags) 677 - char *path; 678 - int flags; 679 - { 680 - +#if __CYGWIN__ 681 - + /* realpath does this right without all the hassle */ 682 - + return realpath (path, NULL); 683 - +#else 684 - char tbuf[PATH_MAX+1], linkbuf[PATH_MAX+1]; 685 - char *result, *p, *q, *qsave, *qbase, *workpath; 686 - int double_slash_path, linklen, nlink; 687 - @@ -249,6 +254,7 @@ error: 688 - } 689 - 690 - return (result); 691 - +#endif /* !__CYGWIN__ */ 692 - } 693 - 694 - char * 695 - --- lib/sh/tmpfile.c 2008-08-12 10:50:12.000000000 -0700 696 - +++ lib/sh/tmpfile.c 2014-10-08 13:50:27.451015900 -0700 697 - @@ -40,7 +40,7 @@ 698 - extern int errno; 699 - #endif 700 - 701 - -#define BASEOPENFLAGS (O_CREAT | O_TRUNC | O_EXCL) 702 - +#define BASEOPENFLAGS (O_CREAT | O_TRUNC | O_EXCL | O_BINARY) 703 - 704 - #define DEFAULT_TMPDIR "." /* bogus default, should be changed */ 705 - #define DEFAULT_NAMEROOT "shtmp" 706 - @@ -94,7 +94,7 @@ get_tmpdir (flags) 707 - if (tdir && (file_iswdir (tdir) == 0 || strlen (tdir) > PATH_MAX)) 708 - tdir = 0; 709 - 710 - - if (tdir == 0) 711 - + if (tdir == 0 || !file_iswdir (tdir)) 712 - tdir = get_sys_tmpdir (); 713 - 714 - #if defined (HAVE_PATHCONF) && defined (_PC_NAME_MAX) 715 - @@ -116,14 +116,15 @@ sh_mktmpname (nameroot, flags) 716 - struct stat sb; 717 - int r, tdlen; 718 - 719 - - filename = (char *)xmalloc (PATH_MAX + 1); 720 - + filename = NULL; 721 - tdir = get_tmpdir (flags); 722 - tdlen = strlen (tdir); 723 - 724 - lroot = nameroot ? nameroot : DEFAULT_NAMEROOT; 725 - 726 - #ifdef USE_MKTEMP 727 - - sprintf (filename, "%s/%s.XXXXXX", tdir, lroot); 728 - + if (asprintf (&filename, "%s/%s.XXXXXX", tdir, lroot) < 0) 729 - + return NULL; 730 - if (mktemp (filename) == 0) 731 - { 732 - free (filename); 733 - @@ -136,7 +137,9 @@ sh_mktmpname (nameroot, flags) 734 - (unsigned long) time ((time_t *)0) ^ 735 - (unsigned long) dollar_dollar_pid ^ 736 - (unsigned long) ((flags & MT_USERANDOM) ? get_random_number () : ntmpfiles++); 737 - - sprintf (filename, "%s/%s-%lu", tdir, lroot, filenum); 738 - + free (filename); 739 - + if (asprintf (&filename, "%s/%s-%lu", tdir, lroot, filenum) < 0) 740 - + return NULL; 741 - if (tmpnamelen > 0 && tmpnamelen < 32) 742 - filename[tdlen + 1 + tmpnamelen] = '\0'; 743 - # ifdef HAVE_LSTAT 744 - @@ -161,14 +164,19 @@ sh_mktmpfd (nameroot, flags, namep) 745 - char *filename, *tdir, *lroot; 746 - int fd, tdlen; 747 - 748 - - filename = (char *)xmalloc (PATH_MAX + 1); 749 - + filename = NULL; 750 - tdir = get_tmpdir (flags); 751 - tdlen = strlen (tdir); 752 - 753 - lroot = nameroot ? nameroot : DEFAULT_NAMEROOT; 754 - 755 - #ifdef USE_MKSTEMP 756 - - sprintf (filename, "%s/%s.XXXXXX", tdir, lroot); 757 - + if (asprintf (&filename, "%s/%s.XXXXXX", tdir, lroot) < 0) 758 - + { 759 - + if (namep) 760 - + *namep = NULL; 761 - + return -1; 762 - + } 763 - fd = mkstemp (filename); 764 - if (fd < 0 || namep == 0) 765 - { 766 - @@ -185,7 +193,13 @@ sh_mktmpfd (nameroot, flags, namep) 767 - (unsigned long) time ((time_t *)0) ^ 768 - (unsigned long) dollar_dollar_pid ^ 769 - (unsigned long) ((flags & MT_USERANDOM) ? get_random_number () : ntmpfiles++); 770 - - sprintf (filename, "%s/%s-%lu", tdir, lroot, filenum); 771 - + free (filename); 772 - + if (asprintf (&filename, "%s/%s-%lu", tdir, lroot, filenum) < 0) 773 - + { 774 - + if (namep) 775 - + *namep = NULL; 776 - + return -1; 777 - + } 778 - if (tmpnamelen > 0 && tmpnamelen < 32) 779 - filename[tdlen + 1 + tmpnamelen] = '\0'; 780 - fd = open (filename, BASEOPENFLAGS | ((flags & MT_READWRITE) ? O_RDWR : O_WRONLY), 0600); 781 - --- parse.y 2014-10-08 13:45:10.394563700 -0700 782 - +++ parse.y 2014-10-08 13:50:27.451015900 -0700 783 - @@ -1520,14 +1520,20 @@ yy_string_get () 784 - string = bash_input.location.string; 785 - 786 - /* If the string doesn't exist, or is empty, EOF found. */ 787 - - if (string && *string) 788 - + while (string && *string) 789 - { 790 - c = *string++; 791 - bash_input.location.string = string; 792 - +#if __CYGWIN__ 793 - + { 794 - + extern int igncr; 795 - + if (igncr && c == '\r') 796 - + continue; 797 - + } 798 - +#endif /* __CYGWIN__ */ 799 - return (c); 800 - } 801 - - else 802 - - return (EOF); 803 - + return (EOF); 804 - } 805 - 806 - static int 807 - @@ -5487,6 +5493,15 @@ report_syntax_error (message) 808 - parser's complaining about by looking at current_token. */ 809 - if (current_token != 0 && EOF_Reached == 0 && (msg = error_token_from_token (current_token))) 810 - { 811 - +#if __CYGWIN__ 812 - + /* Try to help clueless users. */ 813 - + char *p = msg; 814 - + if (ansic_shouldquote (msg)) 815 - + { 816 - + msg = ansic_quote (msg, 0, NULL); 817 - + free (p); 818 - + } 819 - +#endif /* __CYGWIN__ */ 820 - parser_error (line_number, _("syntax error near unexpected token `%s'"), msg); 821 - free (msg); 822 - 823 - --- pathexp.h 2009-01-04 11:32:40.000000000 -0800 824 - +++ pathexp.h 2014-10-08 13:50:27.451015900 -0700 825 - @@ -86,7 +86,7 @@ struct ign { 826 - typedef int sh_iv_item_func_t __P((struct ign *)); 827 - 828 - struct ignorevar { 829 - - char *varname; /* FIGNORE or GLOBIGNORE */ 830 - + char *varname; /* FIGNORE or GLOBIGNORE or EXECIGNORE */ 831 - struct ign *ignores; /* Store the ignore strings here */ 832 - int num_ignores; /* How many are there? */ 833 - char *last_ignoreval; /* Last value of variable - cached for speed */ 834 - --- redir.c 2009-09-17 07:04:18.000000000 -0700 835 - +++ redir.c 2014-10-08 13:50:27.451015900 -0700 836 - @@ -437,7 +437,7 @@ here_document_to_fd (redirectee, ri) 837 - /* In an attempt to avoid races, we close the first fd only after opening 838 - the second. */ 839 - /* Make the document really temporary. Also make it the input. */ 840 - - fd2 = open (filename, O_RDONLY, 0600); 841 - + fd2 = open (filename, O_RDONLY | O_BINARY, 0600); 842 - 843 - if (fd2 < 0) 844 - { 845 - @@ -453,14 +453,6 @@ here_document_to_fd (redirectee, ri) 846 - if (unlink (filename) < 0) 847 - { 848 - r = errno; 849 - -#if defined (__CYGWIN__) 850 - - /* Under CygWin 1.1.0, the unlink will fail if the file is 851 - - open. This hack will allow the previous action of silently 852 - - ignoring the error, but will still leave the file there. This 853 - - needs some kind of magic. */ 854 - - if (r == EACCES) 855 - - return (fd2); 856 - -#endif /* __CYGWIN__ */ 857 - close (fd2); 858 - free (filename); 859 - errno = r; 860 - --- shell.c 2009-11-19 07:05:54.000000000 -0800 861 - +++ shell.c 2014-10-08 13:50:27.466607600 -0700 862 - @@ -329,7 +329,10 @@ _cygwin32_check_tmp () 863 - struct stat sb; 864 - 865 - if (stat ("/tmp", &sb) < 0) 866 - - internal_warning (_("could not find /tmp, please create!")); 867 - + { 868 - + if (mkdir ("/tmp", S_IRWXU | S_IRWXG | S_IRWXO | S_ISVTX) != 0) 869 - + internal_warning (_("could not find /tmp, please create!")); 870 - + } 871 - else 872 - { 873 - if (S_ISDIR (sb.st_mode) == 0) 874 - @@ -1471,10 +1474,6 @@ open_shell_script (script_name) 875 - not match with ours. */ 876 - fd = move_to_high_fd (fd, 1, -1); 877 - 878 - -#if defined (__CYGWIN__) && defined (O_TEXT) 879 - - setmode (fd, O_TEXT); 880 - -#endif 881 - - 882 - #if defined (BUFFERED_INPUT) 883 - default_buffered_input = fd; 884 - SET_CLOSE_ON_EXEC (default_buffered_input); 885 - --- subst.c 2009-12-30 05:24:28.000000000 -0800 886 - +++ subst.c 2014-10-08 13:50:27.466607600 -0700 887 - @@ -4921,10 +4921,6 @@ read_comsub (fd, quoted, rflag) 888 - for (skip_ctlesc = skip_ctlnul = 0, s = ifs_value; s && *s; s++) 889 - skip_ctlesc |= *s == CTLESC, skip_ctlnul |= *s == CTLNUL; 890 - 891 - -#ifdef __CYGWIN__ 892 - - setmode (fd, O_TEXT); /* we don't want CR/LF, we want Unix-style */ 893 - -#endif 894 - - 895 - /* Read the output of the command through the pipe. This may need to be 896 - changed to understand multibyte characters in the future. */ 897 - while (1) 898 - @@ -4947,6 +4943,13 @@ read_comsub (fd, quoted, rflag) 899 - #endif 900 - continue; 901 - } 902 - +#if __CYGWIN__ 903 - + { 904 - + extern int igncr; 905 - + if (igncr && c == '\r') 906 - + continue; 907 - + } 908 - +#endif /* __CYGWIN__ */ 909 - 910 - /* Add the character to ISTRING, possibly after resizing it. */ 911 - RESIZE_MALLOCED_BUFFER (istring, istring_index, 2, istring_size, DEFAULT_ARRAY_SIZE); 912 - @@ -5063,6 +5066,27 @@ command_substitute (string, quoted) 913 - sys_error (_("cannot make pipe for command substitution")); 914 - goto error_exit; 915 - } 916 - +#if __CYGWIN__ 917 - + /* Passing a pipe through std fds can cause hangs when talking to a 918 - + non-cygwin child. Move it. */ 919 - + if (fildes[0] < 3) 920 - + { 921 - + int fd = fcntl (fildes[0], F_DUPFD, 3); 922 - + close (fildes[0]); 923 - + fildes[0] = fd; 924 - + } 925 - + if (fildes[1] < 3) 926 - + { 927 - + int fd = fcntl (fildes[1], F_DUPFD, 3); 928 - + close (fildes[1]); 929 - + fildes[1] = fd; 930 - + } 931 - + if (fildes[0] < 0 || fildes[1] < 0) 932 - + { 933 - + sys_error (_("cannot make pipe for command substitution")); 934 - + goto error_exit; 935 - + } 936 - +#endif /* __CYGWIN__ */ 937 - 938 - old_pid = last_made_pid; 939 - #if defined (JOB_CONTROL) 940 - @@ -5130,6 +5154,12 @@ command_substitute (string, quoted) 941 - (fildes[0] != fileno (stdout)) && 942 - (fildes[0] != fileno (stderr))) 943 - close (fildes[0]); 944 - +#if __CYGWIN__ 945 - + /* Inform stdio if any text/binary changes happened. */ 946 - + freopen (NULL, "w", stdout); 947 - + /* Bash builtins (foolishly) rely on line-buffering. */ 948 - + sh_setlinebuf (stdout); 949 - +#endif /* __CYGWIN__ */ 950 - 951 - /* The currently executing shell is not interactive. */ 952 - interactive = 0; 953 - --- variables.c 2014-10-08 13:45:10.285364600 -0700 954 - +++ variables.c 2014-10-08 13:50:27.466607600 -0700 955 - @@ -4143,6 +4143,8 @@ static struct name_and_function special_ 956 - { "COMP_WORDBREAKS", sv_comp_wordbreaks }, 957 - #endif 958 - 959 - + { "EXECIGNORE", sv_execignore }, 960 - + 961 - { "GLOBIGNORE", sv_globignore }, 962 - 963 - #if defined (HISTORY) 964 - @@ -4323,6 +4325,13 @@ sv_globignore (name) 965 - setup_glob_ignore (name); 966 - } 967 - 968 - +/* What to do when EXECIGNORE changes. */ 969 - +void 970 - +sv_execignore (char *name) 971 - +{ 972 - + setup_exec_ignore (name); 973 - +} 974 - + 975 - #if defined (READLINE) 976 - void 977 - sv_comp_wordbreaks (name) 978 - --- variables.h 2009-08-16 13:10:15.000000000 -0700 979 - +++ variables.h 2014-10-08 13:50:27.466607600 -0700 980 - @@ -351,6 +351,7 @@ extern void sv_ifs __P((char *)); 981 - extern void sv_path __P((char *)); 982 - extern void sv_mail __P((char *)); 983 - extern void sv_globignore __P((char *)); 984 - +extern void sv_execignore __P((char *)); 985 - extern void sv_ignoreeof __P((char *)); 986 - extern void sv_strict_posix __P((char *)); 987 - extern void sv_optind __P((char *));
+1393
pkgs/shells/bash/cygwin-bash-4.3.33-1.src.patch
··· 1 + --- bashline.c 2015-02-06 17:12:55.823275600 -0700 2 + +++ bashline.c 2015-02-06 17:14:11.000103800 -0700 3 + @@ -71,6 +71,16 @@ 4 + # include "pcomplete.h" 5 + #endif 6 + 7 + +#if __CYGWIN__ 8 + +# ifdef __x86_64__ 9 + +# define IMP(x) __imp_##x 10 + +# else 11 + +# define IMP(x) _imp__##x 12 + +# endif 13 + +#else 14 + +# define IMP(x) x 15 + +#endif 16 + + 17 + /* These should agree with the defines for emacs_mode and vi_mode in 18 + rldefs.h, even though that's not a public readline header file. */ 19 + #ifndef EMACS_EDITING_MODE 20 + @@ -264,6 +274,11 @@ int no_empty_command_completion; 21 + are the only possible matches, even if FIGNORE says to. */ 22 + int force_fignore = 1; 23 + 24 + +#if __CYGWIN__ 25 + +/* If set, shorten "foo.exe" to "foo" when they are the same file. */ 26 + +int completion_strip_exe; 27 + +#endif /* __CYGWIN__ */ 28 + + 29 + /* Perform spelling correction on directory names during word completion */ 30 + int dircomplete_spelling = 0; 31 + 32 + @@ -491,11 +506,12 @@ initialize_readline () 33 + kseq[0] = CTRL('J'); 34 + kseq[1] = '\0'; 35 + func = rl_function_of_keyseq (kseq, emacs_meta_keymap, (int *)NULL); 36 + - if (func == rl_vi_editing_mode) 37 + + extern rl_command_func_t *IMP(rl_vi_editing_mode); 38 + + if (func == rl_vi_editing_mode || func == IMP(rl_vi_editing_mode)) 39 + rl_unbind_key_in_map (CTRL('J'), emacs_meta_keymap); 40 + kseq[0] = CTRL('M'); 41 + func = rl_function_of_keyseq (kseq, emacs_meta_keymap, (int *)NULL); 42 + - if (func == rl_vi_editing_mode) 43 + + if (func == rl_vi_editing_mode || func == IMP(rl_vi_editing_mode)) 44 + rl_unbind_key_in_map (CTRL('M'), emacs_meta_keymap); 45 + #if defined (VI_MODE) 46 + rl_unbind_key_in_map (CTRL('E'), vi_movement_keymap); 47 + @@ -514,7 +530,8 @@ initialize_readline () 48 + kseq[0] = '~'; 49 + kseq[1] = '\0'; 50 + func = rl_function_of_keyseq (kseq, emacs_meta_keymap, (int *)NULL); 51 + - if (func == 0 || func == rl_tilde_expand) 52 + + extern rl_command_func_t *IMP(rl_tilde_expand); 53 + + if (func == 0 || func == rl_tilde_expand || func == IMP(rl_tilde_expand)) 54 + rl_bind_keyseq_in_map (kseq, bash_complete_username, emacs_meta_keymap); 55 + 56 + rl_bind_key_if_unbound_in_map ('~', bash_possible_username_completions, emacs_ctlx_keymap); 57 + @@ -537,7 +554,8 @@ initialize_readline () 58 + kseq[0] = TAB; 59 + kseq[1] = '\0'; 60 + func = rl_function_of_keyseq (kseq, emacs_meta_keymap, (int *)NULL); 61 + - if (func == 0 || func == rl_tab_insert) 62 + + extern rl_command_func_t *IMP(rl_tab_insert); 63 + + if (func == 0 || func == rl_tab_insert || func == IMP(rl_tab_insert)) 64 + rl_bind_key_in_map (TAB, dynamic_complete_history, emacs_meta_keymap); 65 + 66 + /* Tell the completer that we want a crack first. */ 67 + @@ -2109,6 +2127,21 @@ globword: 68 + 69 + if (match && executable_completion ((searching_path ? val : cval), searching_path)) 70 + { 71 + +#if __CYGWIN__ 72 + + if (completion_strip_exe) 73 + + { 74 + + size_t val_len = strlen (val); 75 + + char *candidate; 76 + + if (val_len > 4 && !strcasecmp (&val[val_len - 4], ".exe") 77 + + && (candidate = strdup (val))) 78 + + { 79 + + candidate[val_len - 4] = '\0'; 80 + + if (same_file (val, candidate, NULL, NULL)) 81 + + temp[strlen (temp) - 4] = '\0'; 82 + + free (candidate); 83 + + } 84 + + } 85 + +#endif 86 + if (cval != val) 87 + free (cval); 88 + free (val); 89 + @@ -2844,6 +2877,17 @@ test_for_directory (name) 90 + int r; 91 + 92 + fn = bash_tilde_expand (name, 0); 93 + +#if __CYGWIN__ 94 + + /* stat("//server") can only be successful as a directory, but takes 95 + + a several-second timeout to fail. It is much faster to assume 96 + + that //server is a valid name than it is to wait for the stat, 97 + + even though it gives false positives on bad names. */ 98 + + if (fn[0] == '/' && fn[1] == '/' && ! strchr (&fn[2], '/')) 99 + + { 100 + + free (fn); 101 + + return 1; 102 + + } 103 + +#endif /* __CYGWIN__ */ 104 + r = file_isdir (fn); 105 + free (fn); 106 + 107 + --- builtins/evalstring.c 2015-02-06 17:12:55.682776800 -0700 108 + +++ builtins/evalstring.c 2015-02-06 17:14:11.015662800 -0700 109 + @@ -195,7 +195,7 @@ parse_and_execute (string, from_file, fl 110 + int code, lreset; 111 + volatile int should_jump_to_top_level, last_result; 112 + COMMAND *volatile command; 113 + - volatile sigset_t pe_sigmask; 114 + + sigset_t pe_sigmask; 115 + 116 + parse_prologue (string, flags, PE_TAG); 117 + 118 + @@ -451,7 +451,7 @@ parse_string (string, from_file, flags, 119 + volatile int should_jump_to_top_level; 120 + COMMAND *volatile command, *oglobal; 121 + char *ostring; 122 + - volatile sigset_t ps_sigmask; 123 + + sigset_t ps_sigmask; 124 + 125 + parse_prologue (string, flags, PS_TAG); 126 + 127 + --- builtins/set.def 2013-04-19 05:20:34.000000000 -0600 128 + +++ builtins/set.def 2015-02-06 17:14:11.015662800 -0700 129 + @@ -56,6 +56,13 @@ extern int dont_save_function_defs; 130 + #if defined (READLINE) 131 + extern int no_line_editing; 132 + #endif /* READLINE */ 133 + +#if __CYGWIN__ 134 + +extern int igncr; 135 + +static int set_minus_o_option_maybe (int, const char *, int); 136 + +# define INTERACTIVE_ONLY ,1 137 + +#else /* ! __CYGWIN__ */ 138 + +# define INTERACTIVE_ONLY 139 + +#endif 140 + 141 + $BUILTIN set 142 + $FUNCTION set_builtin 143 + @@ -92,6 +99,9 @@ Options: 144 + #if defined (HISTORY) 145 + history enable command history 146 + #endif 147 + +#if __CYGWIN__ 148 + + igncr on cygwin, ignore \r in line endings 149 + +#endif 150 + ignoreeof the shell will not exit upon reading EOF 151 + interactive-comments 152 + allow comments to appear in interactive commands 153 + @@ -188,29 +198,41 @@ const struct { 154 + int *variable; 155 + setopt_set_func_t *set_func; 156 + setopt_get_func_t *get_func; 157 + +#if __CYGWIN__ 158 + + /* Cygwin users have taken to exporting SHELLOPTS for the 159 + + cygwin-specific igncr. As a result, we need to make sure 160 + + SHELLOPTS parsing does not turn on interactive options when 161 + + exported from an interactive shell, but parsed in a 162 + + non-interactive setting, since some interactive options violate 163 + + POSIX /bin/sh rules. */ 164 + + int interactive_only; 165 + +#endif /* __CYGWIN__ */ 166 + } o_options[] = { 167 + { "allexport", 'a', (int *)NULL, (setopt_set_func_t *)NULL, (setopt_get_func_t *)NULL }, 168 + #if defined (BRACE_EXPANSION) 169 + { "braceexpand",'B', (int *)NULL, (setopt_set_func_t *)NULL, (setopt_get_func_t *)NULL }, 170 + #endif 171 + #if defined (READLINE) 172 + - { "emacs", '\0', (int *)NULL, set_edit_mode, get_edit_mode }, 173 + + { "emacs", '\0', (int *)NULL, set_edit_mode, get_edit_mode INTERACTIVE_ONLY}, 174 + #endif 175 + { "errexit", 'e', (int *)NULL, (setopt_set_func_t *)NULL, (setopt_get_func_t *)NULL }, 176 + { "errtrace", 'E', (int *)NULL, (setopt_set_func_t *)NULL, (setopt_get_func_t *)NULL }, 177 + { "functrace", 'T', (int *)NULL, (setopt_set_func_t *)NULL, (setopt_get_func_t *)NULL }, 178 + { "hashall", 'h', (int *)NULL, (setopt_set_func_t *)NULL, (setopt_get_func_t *)NULL }, 179 + #if defined (BANG_HISTORY) 180 + - { "histexpand", 'H', (int *)NULL, (setopt_set_func_t *)NULL, (setopt_get_func_t *)NULL }, 181 + + { "histexpand", 'H', (int *)NULL, (setopt_set_func_t *)NULL, (setopt_get_func_t *)NULL INTERACTIVE_ONLY}, 182 + #endif /* BANG_HISTORY */ 183 + #if defined (HISTORY) 184 + - { "history", '\0', &enable_history_list, bash_set_history, (setopt_get_func_t *)NULL }, 185 + + { "history", '\0', &enable_history_list, bash_set_history, (setopt_get_func_t *)NULL INTERACTIVE_ONLY}, 186 + +#endif 187 + +#if __CYGWIN__ 188 + + { "igncr", '\0', &igncr, NULL, (setopt_get_func_t *)NULL }, 189 + #endif 190 + { "ignoreeof", '\0', &ignoreeof, set_ignoreeof, (setopt_get_func_t *)NULL }, 191 + { "interactive-comments", '\0', &interactive_comments, (setopt_set_func_t *)NULL, (setopt_get_func_t *)NULL }, 192 + { "keyword", 'k', (int *)NULL, (setopt_set_func_t *)NULL, (setopt_get_func_t *)NULL }, 193 + #if defined (JOB_CONTROL) 194 + - { "monitor", 'm', (int *)NULL, (setopt_set_func_t *)NULL, (setopt_get_func_t *)NULL }, 195 + + { "monitor", 'm', (int *)NULL, (setopt_set_func_t *)NULL, (setopt_get_func_t *)NULL INTERACTIVE_ONLY}, 196 + #endif 197 + { "noclobber", 'C', (int *)NULL, (setopt_set_func_t *)NULL, (setopt_get_func_t *)NULL }, 198 + { "noexec", 'n', (int *)NULL, (setopt_set_func_t *)NULL, (setopt_get_func_t *)NULL }, 199 + @@ -229,7 +251,7 @@ const struct { 200 + { "privileged", 'p', (int *)NULL, (setopt_set_func_t *)NULL, (setopt_get_func_t *)NULL }, 201 + { "verbose", 'v', (int *)NULL, (setopt_set_func_t *)NULL, (setopt_get_func_t *)NULL }, 202 + #if defined (READLINE) 203 + - { "vi", '\0', (int *)NULL, set_edit_mode, get_edit_mode }, 204 + + { "vi", '\0', (int *)NULL, set_edit_mode, get_edit_mode INTERACTIVE_ONLY}, 205 + #endif 206 + { "xtrace", 'x', (int *)NULL, (setopt_set_func_t *)NULL, (setopt_get_func_t *)NULL }, 207 + {(char *)NULL, 0 , (int *)NULL, (setopt_set_func_t *)NULL, (setopt_get_func_t *)NULL }, 208 + @@ -416,6 +438,15 @@ int 209 + set_minus_o_option (on_or_off, option_name) 210 + int on_or_off; 211 + char *option_name; 212 + +#if __CYGWIN__ 213 + +{ 214 + + /* See cygwin comments above. */ 215 + + return set_minus_o_option_maybe (on_or_off, option_name, 0); 216 + +} 217 + +static int 218 + +set_minus_o_option_maybe (int on_or_off, const char *option_name, 219 + + int avoid_interactive) 220 + +#endif /* __CYGWIN__ */ 221 + { 222 + register int i; 223 + 224 + @@ -423,6 +454,10 @@ set_minus_o_option (on_or_off, option_na 225 + { 226 + if (STREQ (option_name, o_options[i].name)) 227 + { 228 + +#if __CYGWIN__ 229 + + if (o_options[i].interactive_only && avoid_interactive) 230 + + return EXECUTION_SUCCESS; 231 + +#endif /* __CYGWIN__ */ 232 + if (o_options[i].letter == 0) 233 + { 234 + SET_BINARY_O_OPTION_VALUE (i, on_or_off, option_name); 235 + @@ -548,7 +583,11 @@ parse_shellopts (value) 236 + vptr = 0; 237 + while (vname = extract_colon_unit (value, &vptr)) 238 + { 239 + +#if __CYGWIN__ 240 + + set_minus_o_option_maybe (FLAG_ON, vname, !interactive_shell); 241 + +#else /* !__CYGWIN__ */ 242 + set_minus_o_option (FLAG_ON, vname); 243 + +#endif 244 + free (vname); 245 + } 246 + } 247 + --- builtins/shopt.def 2013-02-27 07:43:20.000000000 -0700 248 + +++ builtins/shopt.def 2015-02-06 17:14:11.015662800 -0700 249 + @@ -91,6 +91,11 @@ extern int glob_star; 250 + extern int glob_asciirange; 251 + extern int lastpipe_opt; 252 + 253 + +#if __CYGWIN__ 254 + +extern int completion_strip_exe; 255 + +#endif 256 + + 257 + + 258 + #if defined (EXTENDED_GLOB) 259 + extern int extended_glob; 260 + #endif 261 + @@ -161,6 +166,9 @@ static struct { 262 + { "compat40", &shopt_compat40, set_compatibility_level }, 263 + { "compat41", &shopt_compat41, set_compatibility_level }, 264 + { "compat42", &shopt_compat41, set_compatibility_level }, 265 + +#if __CYGWIN__ 266 + + { "completion_strip_exe", &completion_strip_exe, NULL }, 267 + +#endif 268 + #if defined (READLINE) 269 + { "complete_fullquote", &complete_fullquote, (shopt_set_func_t *)NULL}, 270 + { "direxpand", &dircomplete_expand, shopt_set_complete_direxpand }, 271 + --- config-top.h 2012-08-18 18:51:30.000000000 -0600 272 + +++ config-top.h 2015-02-06 17:14:11.015662800 -0700 273 + @@ -80,10 +80,10 @@ 274 + #define KSH_COMPATIBLE_SELECT 275 + 276 + /* System-wide .bashrc file for interactive shells. */ 277 + -/* #define SYS_BASHRC "/etc/bash.bashrc" */ 278 + +#define SYS_BASHRC "/etc/bash.bashrc" 279 + 280 + /* System-wide .bash_logout for login shells. */ 281 + -/* #define SYS_BASH_LOGOUT "/etc/bash.bash_logout" */ 282 + +#define SYS_BASH_LOGOUT "/etc/bash.bash_logout" 283 + 284 + /* Define this to make non-interactive shells begun with argv[0][0] == '-' 285 + run the startup files when not in posix mode. */ 286 + @@ -93,7 +93,7 @@ 287 + sshd and source the .bashrc if so (like the rshd behavior). This checks 288 + for the presence of SSH_CLIENT or SSH2_CLIENT in the initial environment, 289 + which can be fooled under certain not-uncommon circumstances. */ 290 + -/* #define SSH_SOURCE_BASHRC */ 291 + +#define SSH_SOURCE_BASHRC 292 + 293 + /* Define if you want the case-capitalizing operators (~[~]) and the 294 + `capcase' variable attribute (declare -c). */ 295 + --- doc/Makefile.in 2013-10-30 14:18:12.000000000 -0600 296 + +++ doc/Makefile.in 2015-02-06 17:14:11.015662800 -0700 297 + @@ -176,7 +176,7 @@ bashref.html: $(BASHREF_FILES) $(HSUSER) 298 + $(TEXI2HTML) -menu -monolithic -I $(TEXINPUTDIR) $(srcdir)/bashref.texi 299 + 300 + bash.info: bashref.info 301 + - ${SHELL} ${INFOPOST} < $(srcdir)/bashref.info > $@ ; \ 302 + + ${SHELL} ${INFOPOST} < bashref.info > $@ ; \ 303 + 304 + bash.txt: bash.1 305 + bash.ps: bash.1 306 + @@ -237,9 +237,9 @@ install: info installdirs bash.info 307 + -$(INSTALL_DATA) $(srcdir)/bashbug.1 $(DESTDIR)$(man1dir)/bashbug${man1ext} 308 + -$(INSTALL_DATA) $(OTHER_DOCS) $(DESTDIR)$(docdir) 309 + # uncomment the next lines to install the builtins man page 310 + -# sed 's:bash\.1:man1/&:' $(srcdir)/builtins.1 > $${TMPDIR:-/var/tmp}/builtins.1 311 + -# -$(INSTALL_DATA) $${TMPDIR:-/var/tmp}/builtins.1 $(DESTDIR)$(man1dir)/bash_builtins${man1ext} 312 + -# -$(RM) $${TMPDIR:-/var/tmp}/builtins.1 313 + + sed 's:bash\.1:man1/&:' $(srcdir)/builtins.1 > $${TMPDIR:-/var/tmp}/builtins.1 314 + + -$(INSTALL_DATA) $${TMPDIR:-/var/tmp}/builtins.1 $(DESTDIR)$(man1dir)/bash_builtins${man1ext} 315 + + -$(RM) $${TMPDIR:-/var/tmp}/builtins.1 316 + -if test -f bash.info; then d=.; else d=$(srcdir); fi; \ 317 + $(INSTALL_DATA) $$d/bash.info $(DESTDIR)$(infodir)/bash.info 318 + # run install-info if it is present to update the info directory 319 + --- doc/bash.1 2014-02-06 07:03:52.000000000 -0700 320 + +++ doc/bash.1 2015-02-06 17:14:11.015662800 -0700 321 + @@ -1658,6 +1658,14 @@ subsequently reset. 322 + Expands to the effective user ID of the current user, initialized at 323 + shell startup. This variable is readonly. 324 + .TP 325 + +.B EXECIGNORE 326 + +A colon-separated list of extended glob (see \fBPattern Matching\fP) 327 + +patterns. Files with full paths matching one of these patterns are 328 + +not considered executable for the purposes of completion and PATH 329 + +searching, but the \fB[\fP, \fB[[\fP, and \fBtest\fP builtins are not 330 + +affected. Use this variable to deal with systems that set the 331 + +executable bit on files that are not actually executable. 332 + +.TP 333 + .B FUNCNAME 334 + An array variable containing the names of all shell functions 335 + currently in the execution call stack. 336 + @@ -3308,6 +3316,10 @@ the character 337 + .B ``.'' 338 + at the start of a name or immediately following a slash 339 + must be matched explicitly, unless the shell option 340 + +.B completion_strip_exe 341 + +If set, whenever bash sees `foo.exe' during completion, it checks if 342 + +`foo' is the same file and strips the suffix. 343 + +.TP 8 344 + .B dotglob 345 + is set. 346 + When matching a pathname, the slash character must always be 347 + --- doc/bashref.texi 2014-02-22 11:20:36.000000000 -0700 348 + +++ doc/bashref.texi 2015-02-06 17:14:11.015662800 -0700 349 + @@ -4992,6 +4992,10 @@ filenames. 350 + This variable is set by default, which is the default Bash behavior in 351 + versions through 4.2. 352 + 353 + +@item completion_strip_exe 354 + +If set, whenever bash sees `foo.exe' during completion, it checks if 355 + +`foo' is the same file and strips the suffix. 356 + + 357 + @item direxpand 358 + If set, Bash 359 + replaces directory names with the results of word expansion when performing 360 + @@ -5578,6 +5582,14 @@ Similar to @code{BASH_ENV}; used when th 361 + The numeric effective user id of the current user. This variable 362 + is readonly. 363 + 364 + +@item EXECIGNORE 365 + +A colon-separated list of extended glob ((@pxref{Pattern Matching}) 366 + +patterns. Files with full paths matching one of these patterns are 367 + +not considered executable for the purposes of completion and PATH 368 + +searching, but the @code{[}, @code{[[}, and @code{test} builtins are 369 + +not affected. Use this variable to deal with systems that set the 370 + +executable bit on files that are not actually executable. 371 + + 372 + @item FCEDIT 373 + The editor used as a default by the @option{-e} option to the @code{fc} 374 + builtin command. 375 + --- doc/builtins.1 2012-02-21 12:32:05.000000000 -0700 376 + +++ doc/builtins.1 2015-02-06 17:14:11.031260100 -0700 377 + @@ -19,6 +19,6 @@ shift, shopt, source, suspend, test, tim 378 + ulimit, umask, unalias, unset, wait \- bash built-in commands, see \fBbash\fR(1) 379 + .SH BASH BUILTIN COMMANDS 380 + .nr zZ 1 381 + -.so bash.1 382 + +.so man1/bash.1 383 + .SH SEE ALSO 384 + bash(1), sh(1) 385 + --- execute_cmd.c 2015-02-06 17:12:55.261573700 -0700 386 + +++ execute_cmd.c 2015-02-06 17:14:11.031260100 -0700 387 + @@ -58,6 +58,7 @@ extern int errno; 388 + #endif 389 + 390 + #define NEED_FPURGE_DECL 391 + +#define NEED_SH_SETLINEBUF_DECL /* used in externs.h */ 392 + 393 + #include "bashansi.h" 394 + #include "bashintl.h" 395 + --- expr.c 2014-01-03 06:55:00.000000000 -0700 396 + +++ expr.c 2015-02-06 17:14:11.031260100 -0700 397 + @@ -83,6 +83,7 @@ 398 + 399 + #include "shell.h" 400 + #include "typemax.h" /* INTMAX_MAX, INTMAX_MIN */ 401 + +#define exp2 exp2_ 402 + 403 + /* Because of the $((...)) construct, expressions may include newlines. 404 + Here is a macro which accepts newlines, tabs and spaces as whitespace. */ 405 + --- findcmd.c 2012-10-15 05:45:04.000000000 -0600 406 + +++ findcmd.c 2015-02-06 17:14:11.031260100 -0700 407 + @@ -48,6 +48,8 @@ 408 + extern int errno; 409 + #endif 410 + 411 + +#include <glob/strmatch.h> 412 + + 413 + extern int posixly_correct; 414 + extern int last_command_exit_value; 415 + 416 + @@ -77,6 +79,38 @@ int check_hashed_filenames; 417 + containing the file of interest. */ 418 + int dot_found_in_search = 0; 419 + 420 + +static struct ignorevar execignore = 421 + +{ 422 + + "EXECIGNORE", 423 + + (struct ign *)0, 424 + + 0, 425 + + (char *)0, 426 + + (sh_iv_item_func_t *)0, 427 + +}; 428 + + 429 + +void 430 + +setup_exec_ignore (char *varname) 431 + +{ 432 + + setup_ignore_patterns (&execignore); 433 + +} 434 + + 435 + +/* Return whether we should never consider file executable 436 + + * even if the system tells us it is. */ 437 + +static int 438 + +is_on_exec_blacklist (char *name) 439 + +{ 440 + + struct ign *p; 441 + + int flags = FNM_EXTMATCH | FNM_CASEFOLD; 442 + + 443 + + for (p = execignore.ignores; p && p->val; p++) 444 + + { 445 + + if (strmatch (p->val, (char *)name, flags) != FNM_NOMATCH) 446 + + return (1); 447 + + } 448 + + 449 + + return (0); 450 + +} 451 + + 452 + /* Return some flags based on information about this file. 453 + The EXISTS bit is non-zero if the file is found. 454 + The EXECABLE bit is non-zero the file is executble. 455 + @@ -104,7 +138,7 @@ file_status (name) 456 + file access mechanisms into account. eaccess uses the effective 457 + user and group IDs, not the real ones. We could use sh_eaccess, 458 + but we don't want any special treatment for /dev/fd. */ 459 + - if (eaccess (name, X_OK) == 0) 460 + + if (!is_on_exec_blacklist (name) && eaccess (name, X_OK) == 0) 461 + r |= FS_EXECABLE; 462 + if (eaccess (name, R_OK) == 0) 463 + r |= FS_READABLE; 464 + --- findcmd.h 2012-01-14 16:56:25.000000000 -0700 465 + +++ findcmd.h 2015-02-06 17:14:11.031260100 -0700 466 + @@ -31,5 +31,6 @@ extern char *find_user_command __P((cons 467 + extern char *find_path_file __P((const char *)); 468 + extern char *search_for_command __P((const char *, int)); 469 + extern char *user_command_matches __P((const char *, int, int)); 470 + +extern void setup_exec_ignore __P((char *)); 471 + 472 + #endif /* _FINDCMD_H_ */ 473 + --- general.c 2014-01-30 14:46:15.000000000 -0700 474 + +++ general.c 2015-02-06 17:14:11.031260100 -0700 475 + @@ -44,6 +44,10 @@ 476 + 477 + #include <tilde/tilde.h> 478 + 479 + +#ifdef __CYGWIN__ 480 + +# include <sys/cygwin.h> 481 + +#endif 482 + + 483 + #if !defined (errno) 484 + extern int errno; 485 + #endif /* !errno */ 486 + @@ -632,7 +636,8 @@ make_absolute (string, dot_path) 487 + { 488 + char pathbuf[PATH_MAX + 1]; 489 + 490 + - cygwin_conv_to_full_posix_path (string, pathbuf); 491 + + cygwin_conv_path (CCP_WIN_A_TO_POSIX | CCP_ABSOLUTE, string, pathbuf, 492 + + sizeof pathbuf); 493 + result = savestring (pathbuf); 494 + } 495 + #else 496 + --- include/chartypes.h 2011-04-11 12:30:52.000000000 -0600 497 + +++ include/chartypes.h 2015-02-06 17:14:11.031260100 -0700 498 + @@ -40,6 +40,7 @@ 499 + #else 500 + # define IN_CTYPE_DOMAIN(c) isascii(c) 501 + #endif 502 + +#define to_uchar(c) ((unsigned char)(c)) 503 + 504 + #if !defined (isspace) && !defined (HAVE_ISSPACE) 505 + # define isspace(c) ((c) == ' ' || (c) == '\t' || (c) == '\n' || (c) == '\f') 506 + @@ -67,16 +68,16 @@ 507 + 508 + #undef ISPRINT 509 + 510 + -#define ISPRINT(c) (IN_CTYPE_DOMAIN (c) && isprint (c)) 511 + -#define ISDIGIT(c) (IN_CTYPE_DOMAIN (c) && isdigit (c)) 512 + -#define ISALNUM(c) (IN_CTYPE_DOMAIN (c) && isalnum (c)) 513 + -#define ISALPHA(c) (IN_CTYPE_DOMAIN (c) && isalpha (c)) 514 + -#define ISCNTRL(c) (IN_CTYPE_DOMAIN (c) && iscntrl (c)) 515 + -#define ISLOWER(c) (IN_CTYPE_DOMAIN (c) && islower (c)) 516 + -#define ISPUNCT(c) (IN_CTYPE_DOMAIN (c) && ispunct (c)) 517 + -#define ISSPACE(c) (IN_CTYPE_DOMAIN (c) && isspace (c)) 518 + -#define ISUPPER(c) (IN_CTYPE_DOMAIN (c) && isupper (c)) 519 + -#define ISXDIGIT(c) (IN_CTYPE_DOMAIN (c) && isxdigit (c)) 520 + +#define ISPRINT(c) (IN_CTYPE_DOMAIN (c) && isprint (to_uchar (c))) 521 + +#define ISDIGIT(c) (IN_CTYPE_DOMAIN (c) && isdigit (to_uchar (c))) 522 + +#define ISALNUM(c) (IN_CTYPE_DOMAIN (c) && isalnum (to_uchar (c))) 523 + +#define ISALPHA(c) (IN_CTYPE_DOMAIN (c) && isalpha (to_uchar (c))) 524 + +#define ISCNTRL(c) (IN_CTYPE_DOMAIN (c) && iscntrl (to_uchar (c))) 525 + +#define ISLOWER(c) (IN_CTYPE_DOMAIN (c) && islower (to_uchar (c))) 526 + +#define ISPUNCT(c) (IN_CTYPE_DOMAIN (c) && ispunct (to_uchar (c))) 527 + +#define ISSPACE(c) (IN_CTYPE_DOMAIN (c) && isspace (to_uchar (c))) 528 + +#define ISUPPER(c) (IN_CTYPE_DOMAIN (c) && isupper (to_uchar (c))) 529 + +#define ISXDIGIT(c) (IN_CTYPE_DOMAIN (c) && isxdigit (to_uchar (c))) 530 + 531 + #define ISLETTER(c) (ISALPHA(c)) 532 + 533 + --- include/posixjmp.h 2012-12-23 20:20:50.000000000 -0700 534 + +++ include/posixjmp.h 2015-02-06 17:14:11.031260100 -0700 535 + @@ -27,13 +27,13 @@ 536 + 537 + #if defined (HAVE_POSIX_SIGSETJMP) 538 + # define procenv_t sigjmp_buf 539 + -# if !defined (__OPENNT) 540 + +# if !defined (__OPENNT) && !defined __CYGWIN__ 541 + # undef setjmp 542 + # define setjmp(x) sigsetjmp((x), 1) 543 + -# define setjmp_nosigs(x) sigsetjmp((x), 0) 544 + # undef longjmp 545 + # define longjmp(x, n) siglongjmp((x), (n)) 546 + # endif /* !__OPENNT */ 547 + +# define setjmp_nosigs(x) sigsetjmp((x), 0) 548 + #else 549 + # define procenv_t jmp_buf 550 + # define setjmp_nosigs setjmp 551 + --- input.c 2014-02-07 07:13:08.000000000 -0700 552 + +++ input.c 2015-02-06 17:14:11.031260100 -0700 553 + @@ -44,6 +44,10 @@ 554 + #include "quit.h" 555 + #include "trap.h" 556 + 557 + +#if __CYGWIN__ 558 + +int igncr; 559 + +#endif 560 + + 561 + #if !defined (errno) 562 + extern int errno; 563 + #endif /* !errno */ 564 + @@ -561,6 +565,19 @@ buffered_getchar () 565 + { 566 + CHECK_TERMSIG; 567 + 568 + +#if __CYGWIN__ 569 + + /* shopt igncr means to discard carriage returns from input stream. 570 + + If cr is the only character in the buffer, then recurse to pick 571 + + up the next character; otherwise flatten the buffer. */ 572 + + if (igncr) 573 + + { 574 + + int ch; 575 + + while ((ch = bufstream_getc (buffers[bash_input.location.buffered_fd])) 576 + + == '\r') 577 + + ; 578 + + return ch; 579 + + } 580 + +#endif /* __CYGWIN__ */ 581 + #if !defined (DJGPP) 582 + return (bufstream_getc (buffers[bash_input.location.buffered_fd])); 583 + #else 584 + --- lib/readline/bind.c 2013-04-06 15:46:38.000000000 -0600 585 + +++ lib/readline/bind.c 2015-02-06 17:14:11.031260100 -0700 586 + @@ -452,7 +452,7 @@ rl_translate_keyseq (seq, array, len) 587 + { 588 + register int i, c, l, temp; 589 + 590 + - for (i = l = 0; c = seq[i]; i++) 591 + + for (i = l = 0; (c = seq[i]); i++) 592 + { 593 + if (c == '\\') 594 + { 595 + @@ -1210,7 +1210,7 @@ _rl_skip_to_delim (string, start, delim) 596 + { 597 + int i, c, passc; 598 + 599 + - for (i = start,passc = 0; c = string[i]; i++) 600 + + for (i = start,passc = 0; (c = string[i]); i++) 601 + { 602 + if (passc) 603 + { 604 + @@ -1297,7 +1297,6 @@ rl_parse_and_bind (string) 605 + if (_rl_stricmp (string, "set") == 0) 606 + { 607 + char *var, *value, *e; 608 + - int s; 609 + 610 + var = string + i; 611 + /* Make VAR point to start of variable name. */ 612 + @@ -2198,7 +2197,7 @@ rl_function_dumper (print_readably) 613 + 614 + fprintf (rl_outstream, "\n"); 615 + 616 + - for (i = 0; name = names[i]; i++) 617 + + for (i = 0; (name = names[i]); i++) 618 + { 619 + rl_command_func_t *function; 620 + char **invokers; 621 + --- lib/readline/chardefs.h 2011-07-25 19:47:56.000000000 -0600 622 + +++ lib/readline/chardefs.h 2015-02-06 17:14:11.046889800 -0700 623 + @@ -71,6 +71,7 @@ 624 + #else 625 + # define IN_CTYPE_DOMAIN(c) isascii(c) 626 + #endif 627 + +#define to_uchar(c) ((unsigned char)(c)) 628 + 629 + #if !defined (isxdigit) && !defined (HAVE_ISXDIGIT) && !defined (__cplusplus) 630 + # define isxdigit(c) (isdigit((c)) || ((c) >= 'a' && (c) <= 'f') || ((c) >= 'A' && (c) <= 'F')) 631 + @@ -87,13 +88,13 @@ 632 + 633 + /* Beware: these only work with single-byte ASCII characters. */ 634 + 635 + -#define ISALNUM(c) (IN_CTYPE_DOMAIN (c) && isalnum (c)) 636 + -#define ISALPHA(c) (IN_CTYPE_DOMAIN (c) && isalpha (c)) 637 + -#define ISDIGIT(c) (IN_CTYPE_DOMAIN (c) && isdigit (c)) 638 + -#define ISLOWER(c) (IN_CTYPE_DOMAIN (c) && islower (c)) 639 + -#define ISPRINT(c) (IN_CTYPE_DOMAIN (c) && isprint (c)) 640 + -#define ISUPPER(c) (IN_CTYPE_DOMAIN (c) && isupper (c)) 641 + -#define ISXDIGIT(c) (IN_CTYPE_DOMAIN (c) && isxdigit (c)) 642 + +#define ISALNUM(c) (IN_CTYPE_DOMAIN (c) && isalnum (to_uchar (c))) 643 + +#define ISALPHA(c) (IN_CTYPE_DOMAIN (c) && isalpha (to_uchar (c))) 644 + +#define ISDIGIT(c) (IN_CTYPE_DOMAIN (c) && isdigit (to_uchar (c))) 645 + +#define ISLOWER(c) (IN_CTYPE_DOMAIN (c) && islower (to_uchar (c))) 646 + +#define ISPRINT(c) (IN_CTYPE_DOMAIN (c) && isprint (to_uchar (c))) 647 + +#define ISUPPER(c) (IN_CTYPE_DOMAIN (c) && isupper (to_uchar (c))) 648 + +#define ISXDIGIT(c) (IN_CTYPE_DOMAIN (c) && isxdigit (to_uchar (c))) 649 + 650 + #define _rl_lowercase_p(c) (NON_NEGATIVE(c) && ISLOWER(c)) 651 + #define _rl_uppercase_p(c) (NON_NEGATIVE(c) && ISUPPER(c)) 652 + --- lib/readline/complete.c 2013-10-14 07:27:10.000000000 -0600 653 + +++ lib/readline/complete.c 2015-02-06 17:14:11.046889800 -0700 654 + @@ -1082,7 +1082,7 @@ _rl_find_completion_word (fp, dp) 655 + /* We didn't find an unclosed quoted substring upon which to do 656 + completion, so use the word break characters to find the 657 + substring on which to complete. */ 658 + - while (rl_point = MB_PREVCHAR (rl_line_buffer, rl_point, MB_FIND_ANY)) 659 + + while ((rl_point = MB_PREVCHAR (rl_line_buffer, rl_point, MB_FIND_ANY))) 660 + { 661 + scan = rl_line_buffer[rl_point]; 662 + 663 + @@ -2116,7 +2116,7 @@ rl_completion_matches (text, entry_funct 664 + match_list = (char **)xmalloc ((match_list_size + 1) * sizeof (char *)); 665 + match_list[1] = (char *)NULL; 666 + 667 + - while (string = (*entry_function) (text, matches)) 668 + + while ((string = (*entry_function) (text, matches))) 669 + { 670 + if (RL_SIG_RECEIVED ()) 671 + { 672 + @@ -2190,7 +2190,7 @@ rl_username_completion_function (text, s 673 + } 674 + 675 + #if defined (HAVE_GETPWENT) 676 + - while (entry = getpwent ()) 677 + + while ((entry = getpwent ())) 678 + { 679 + /* Null usernames should result in all users as possible completions. */ 680 + if (namelen == 0 || (STREQN (username, entry->pw_name, namelen))) 681 + @@ -2723,7 +2723,7 @@ rl_menu_complete (count, ignore) 682 + static int full_completion = 0; /* set to 1 if menu completion should reinitialize on next call */ 683 + static int orig_start, orig_end; 684 + static char quote_char; 685 + - static int delimiter, cstate; 686 + + static int delimiter; 687 + 688 + /* The first time through, we generate the list of matches and set things 689 + up to insert them. */ 690 + --- lib/readline/display.c 2015-02-06 17:12:54.793574600 -0700 691 + +++ lib/readline/display.c 2015-02-06 17:14:11.046889800 -0700 692 + @@ -66,7 +66,6 @@ extern char *strchr (), *strrchr (); 693 + static void update_line PARAMS((char *, char *, int, int, int, int)); 694 + static void space_to_eol PARAMS((int)); 695 + static void delete_chars PARAMS((int)); 696 + -static void insert_some_chars PARAMS((char *, int, int)); 697 + static void open_some_spaces PARAMS((int)); 698 + static void cr PARAMS((void)); 699 + 700 + @@ -1314,7 +1313,7 @@ update_line (old, new, current_line, oma 701 + int current_line, omax, nmax, inv_botlin; 702 + { 703 + register char *ofd, *ols, *oe, *nfd, *nls, *ne; 704 + - int temp, lendiff, wsatend, od, nd, twidth, o_cpos; 705 + + int temp, lendiff, wsatend, od, nd, o_cpos; 706 + int current_invis_chars; 707 + int col_lendiff, col_temp; 708 + int bytes_to_insert; 709 + @@ -2485,6 +2484,7 @@ _rl_clear_screen () 710 + #endif /* __DJGPP__ */ 711 + } 712 + 713 + +#if 0 714 + /* Insert COUNT characters from STRING to the output stream at column COL. */ 715 + static void 716 + insert_some_chars (string, count, col) 717 + @@ -2494,6 +2494,7 @@ insert_some_chars (string, count, col) 718 + open_some_spaces (col); 719 + _rl_output_some_chars (string, count); 720 + } 721 + +#endif 722 + 723 + /* Insert COL spaces, keeping the cursor at the same position. We follow the 724 + ncurses documentation and use either im/ei with explicit spaces, or IC/ic 725 + --- lib/readline/histexpand.c 2013-12-02 07:22:30.000000000 -0700 726 + +++ lib/readline/histexpand.c 2015-02-06 17:14:11.046889800 -0700 727 + @@ -204,7 +204,7 @@ get_history_event (string, caller_index, 728 + } 729 + 730 + /* Only a closing `?' or a newline delimit a substring search string. */ 731 + - for (local_index = i; c = string[i]; i++) 732 + + for (local_index = i; (c = string[i]); i++) 733 + { 734 + #if defined (HANDLE_MULTIBYTE) 735 + if (MB_CUR_MAX > 1 && rl_byte_oriented == 0) 736 + @@ -677,7 +677,7 @@ history_expand_internal (string, start, 737 + case 's': 738 + { 739 + char *new_event; 740 + - int delimiter, failed, si, l_temp, ws, we; 741 + + int delimiter, failed, si, l_temp, we; 742 + 743 + if (c == 's') 744 + { 745 + @@ -776,7 +776,6 @@ history_expand_internal (string, start, 746 + { 747 + for (; temp[si] && whitespace (temp[si]); si++) 748 + ; 749 + - ws = si; 750 + we = history_tokenize_word (temp, si); 751 + } 752 + 753 + --- lib/readline/histfile.c 2013-07-19 06:17:17.000000000 -0600 754 + +++ lib/readline/histfile.c 2015-02-06 17:14:11.046889800 -0700 755 + @@ -104,7 +104,7 @@ int history_write_timestamps = 0; 756 + 757 + /* Does S look like the beginning of a history timestamp entry? Placeholder 758 + for more extensive tests. */ 759 + -#define HIST_TIMESTAMP_START(s) (*(s) == history_comment_char && isdigit ((s)[1]) ) 760 + +#define HIST_TIMESTAMP_START(s) (*(s) == history_comment_char && isdigit ((unsigned char) (s)[1]) ) 761 + 762 + /* Return the string that should be used in the place of this 763 + filename. This only matters when you don't specify the 764 + --- lib/readline/input.c 2015-02-06 17:12:55.027577800 -0700 765 + +++ lib/readline/input.c 2015-02-06 17:14:11.046889800 -0700 766 + @@ -431,7 +431,7 @@ rl_read_key () 767 + else 768 + { 769 + /* If input is coming from a macro, then use that. */ 770 + - if (c = _rl_next_macro_key ()) 771 + + if ((c = _rl_next_macro_key ())) 772 + return (c); 773 + 774 + /* If the user has an event function, then call it periodically. */ 775 + --- lib/readline/isearch.c 2013-10-14 07:08:40.000000000 -0600 776 + +++ lib/readline/isearch.c 2015-02-06 17:14:11.046889800 -0700 777 + @@ -740,7 +740,7 @@ rl_search_history (direction, invoking_k 778 + int direction, invoking_key; 779 + { 780 + _rl_search_cxt *cxt; /* local for now, but saved globally */ 781 + - int c, r; 782 + + int r; 783 + 784 + RL_SETSTATE(RL_STATE_ISEARCH); 785 + cxt = _rl_isearch_init (direction); 786 + @@ -755,7 +755,7 @@ rl_search_history (direction, invoking_k 787 + r = -1; 788 + for (;;) 789 + { 790 + - c = _rl_search_getchar (cxt); 791 + + _rl_search_getchar (cxt); 792 + /* We might want to handle EOF here (c == 0) */ 793 + r = _rl_isearch_dispatch (cxt, cxt->lastc); 794 + if (r <= 0) 795 + @@ -778,9 +778,9 @@ int 796 + _rl_isearch_callback (cxt) 797 + _rl_search_cxt *cxt; 798 + { 799 + - int c, r; 800 + + int r; 801 + 802 + - c = _rl_search_getchar (cxt); 803 + + _rl_search_getchar (cxt); 804 + /* We might want to handle EOF here */ 805 + r = _rl_isearch_dispatch (cxt, cxt->lastc); 806 + 807 + --- lib/readline/misc.c 2015-02-06 17:12:55.230384200 -0700 808 + +++ lib/readline/misc.c 2015-02-06 17:14:11.046889800 -0700 809 + @@ -455,7 +455,7 @@ _rl_revert_all_lines () 810 + entry = (hpos == history_length) ? previous_history () : current_history (); 811 + while (entry) 812 + { 813 + - if (ul = (UNDO_LIST *)entry->data) 814 + + if ((ul = (UNDO_LIST *)entry->data)) 815 + { 816 + if (ul == saved_undo_list) 817 + saved_undo_list = 0; 818 + @@ -502,7 +502,7 @@ rl_clear_history () 819 + for (i = 0; i < history_length; i++) 820 + { 821 + hent = hlist[i]; 822 + - if (ul = (UNDO_LIST *)hent->data) 823 + + if ((ul = (UNDO_LIST *)hent->data)) 824 + { 825 + if (ul == saved_undo_list) 826 + saved_undo_list = 0; 827 + --- lib/readline/nls.c 2013-03-09 12:51:10.000000000 -0700 828 + +++ lib/readline/nls.c 2015-02-06 17:14:11.046889800 -0700 829 + @@ -80,7 +80,7 @@ static char *legal_lang_values[] = 830 + static char *normalize_codeset PARAMS((char *)); 831 + #endif /* !HAVE_SETLOCALE */ 832 + 833 + -static char *find_codeset PARAMS((char *, size_t *)); 834 + +static char *find_codeset PARAMS((char *, size_t *)) __attribute__ ((__unused__)); 835 + 836 + static char *_rl_get_locale_var PARAMS((const char *)); 837 + 838 + @@ -104,12 +104,13 @@ utf8locale (lspec) 839 + char *lspec; 840 + { 841 + char *cp; 842 + - size_t len; 843 + 844 + #if HAVE_LANGINFO_CODESET 845 + cp = nl_langinfo (CODESET); 846 + return (STREQ (cp, "UTF-8") || STREQ (cp, "utf8")); 847 + #else 848 + + size_t len; 849 + + 850 + cp = find_codeset (lspec, &len); 851 + 852 + if (cp == 0 || len < 4 || len > 5) 853 + --- lib/readline/parens.c 2009-04-19 11:12:06.000000000 -0600 854 + +++ lib/readline/parens.c 2015-02-06 17:14:11.046889800 -0700 855 + @@ -106,7 +106,7 @@ rl_insert_close (count, invoking_key) 856 + else 857 + { 858 + #if defined (HAVE_SELECT) 859 + - int orig_point, match_point, ready; 860 + + int orig_point, match_point; 861 + struct timeval timer; 862 + fd_set readfds; 863 + 864 + @@ -126,7 +126,7 @@ rl_insert_close (count, invoking_key) 865 + orig_point = rl_point; 866 + rl_point = match_point; 867 + (*rl_redisplay_function) (); 868 + - ready = select (1, &readfds, (fd_set *)NULL, (fd_set *)NULL, &timer); 869 + + select (1, &readfds, (fd_set *)NULL, (fd_set *)NULL, &timer); 870 + rl_point = orig_point; 871 + #else /* !HAVE_SELECT */ 872 + _rl_insert_char (count, invoking_key); 873 + --- lib/readline/posixjmp.h 2012-12-23 20:20:50.000000000 -0700 874 + +++ lib/readline/posixjmp.h 2015-02-06 17:14:11.046889800 -0700 875 + @@ -27,13 +27,13 @@ 876 + 877 + #if defined (HAVE_POSIX_SIGSETJMP) 878 + # define procenv_t sigjmp_buf 879 + -# if !defined (__OPENNT) 880 + +# if !defined (__OPENNT) && !defined __CYGWIN__ 881 + # undef setjmp 882 + # define setjmp(x) sigsetjmp((x), 1) 883 + -# define setjmp_nosigs(x) sigsetjmp((x), 0) 884 + # undef longjmp 885 + # define longjmp(x, n) siglongjmp((x), (n)) 886 + # endif /* !__OPENNT */ 887 + +# define setjmp_nosigs(x) sigsetjmp((x), 0) 888 + #else 889 + # define procenv_t jmp_buf 890 + # define setjmp_nosigs setjmp 891 + --- lib/readline/readline.c 2015-02-06 17:12:54.310964200 -0700 892 + +++ lib/readline/readline.c 2015-02-06 17:14:11.046889800 -0700 893 + @@ -95,7 +95,7 @@ static void bind_arrow_keys_internal PAR 894 + static void bind_arrow_keys PARAMS((void)); 895 + 896 + static void readline_default_bindings PARAMS((void)); 897 + -static void reset_default_bindings PARAMS((void)); 898 + +//static void reset_default_bindings PARAMS((void)); 899 + 900 + static int _rl_subseq_result PARAMS((int, Keymap, int, int)); 901 + static int _rl_subseq_getchar PARAMS((int)); 902 + @@ -522,7 +522,7 @@ readline_internal_char () 903 + readline_internal_charloop () 904 + #endif 905 + { 906 + - static int lastc, eof_found; 907 + + static int lastc, eof_found __attribute__((unused)); 908 + int c, code, lk; 909 + 910 + lastc = -1; 911 + @@ -1204,6 +1204,7 @@ readline_default_bindings () 912 + rl_tty_set_default_bindings (_rl_keymap); 913 + } 914 + 915 + +#if 0 916 + /* Reset the default bindings for the terminal special characters we're 917 + interested in back to rl_insert and read the new ones. */ 918 + static void 919 + @@ -1215,6 +1216,7 @@ reset_default_bindings () 920 + rl_tty_set_default_bindings (_rl_keymap); 921 + } 922 + } 923 + +#endif 924 + 925 + /* Bind some common arrow key sequences in MAP. */ 926 + static void 927 + --- lib/readline/rltty.c 2013-08-25 14:57:05.000000000 -0600 928 + +++ lib/readline/rltty.c 2015-02-06 17:14:11.062454900 -0700 929 + @@ -30,6 +30,7 @@ 930 + #include <signal.h> 931 + #include <errno.h> 932 + #include <stdio.h> 933 + +#include <sys/ioctl.h> 934 + 935 + #if defined (HAVE_UNISTD_H) 936 + # include <unistd.h> 937 + --- lib/readline/shell.c 2013-03-13 08:17:00.000000000 -0600 938 + +++ lib/readline/shell.c 2015-02-06 17:14:11.062454900 -0700 939 + @@ -123,8 +123,10 @@ sh_single_quote (string) 940 + /* Set the environment variables LINES and COLUMNS to lines and cols, 941 + respectively. */ 942 + static char setenv_buf[INT_STRLEN_BOUND (int) + 1]; 943 + +# if !defined (HAVE_SETENV) && defined (HAVE_PUTENV) 944 + static char putenv_buf1[INT_STRLEN_BOUND (int) + 6 + 1]; /* sizeof("LINES=") == 6 */ 945 + static char putenv_buf2[INT_STRLEN_BOUND (int) + 8 + 1]; /* sizeof("COLUMNS=") == 8 */ 946 + +# endif 947 + 948 + void 949 + sh_set_lines_and_columns (lines, cols) 950 + --- lib/readline/signals.c 2014-01-10 13:06:48.000000000 -0700 951 + +++ lib/readline/signals.c 2015-02-06 17:14:11.062454900 -0700 952 + @@ -576,7 +576,6 @@ rl_free_line_state () 953 + /* **************************************************************** */ 954 + 955 + #if defined (HAVE_POSIX_SIGNALS) 956 + -static sigset_t sigint_set, sigint_oset; 957 + static sigset_t sigwinch_set, sigwinch_oset; 958 + #else /* !HAVE_POSIX_SIGNALS */ 959 + # if defined (HAVE_BSD_SIGNALS) 960 + --- lib/readline/terminal.c 2013-09-18 07:12:01.000000000 -0600 961 + +++ lib/readline/terminal.c 2015-02-06 17:14:11.062454900 -0700 962 + @@ -31,6 +31,7 @@ 963 + #if defined (HAVE_SYS_FILE_H) 964 + # include <sys/file.h> 965 + #endif /* HAVE_SYS_FILE_H */ 966 + +#include <sys/ioctl.h> 967 + 968 + #if defined (HAVE_UNISTD_H) 969 + # include <unistd.h> 970 + --- lib/readline/text.c 2013-10-14 07:25:05.000000000 -0600 971 + +++ lib/readline/text.c 2015-02-06 17:14:11.062454900 -0700 972 + @@ -859,11 +859,10 @@ _rl_overwrite_char (count, c) 973 + int i; 974 + #if defined (HANDLE_MULTIBYTE) 975 + char mbkey[MB_LEN_MAX]; 976 + - int k; 977 + 978 + /* Read an entire multibyte character sequence to insert COUNT times. */ 979 + if (count > 0 && MB_CUR_MAX > 1 && rl_byte_oriented == 0) 980 + - k = _rl_read_mbstring (c, mbkey, MB_LEN_MAX); 981 + + _rl_read_mbstring (c, mbkey, MB_LEN_MAX); 982 + #endif 983 + 984 + rl_begin_undo_group (); 985 + --- lib/readline/tilde.c 2010-07-25 15:42:13.000000000 -0600 986 + +++ lib/readline/tilde.c 2015-02-06 17:14:11.062454900 -0700 987 + @@ -196,7 +196,7 @@ tilde_expand (string) 988 + int result_size, result_index; 989 + 990 + result_index = result_size = 0; 991 + - if (result = strchr (string, '~')) 992 + + if ((result = strchr (string, '~'))) 993 + result = (char *)xmalloc (result_size = (strlen (string) + 16)); 994 + else 995 + result = (char *)xmalloc (result_size = (strlen (string) + 1)); 996 + --- lib/readline/undo.c 2014-02-02 13:47:46.000000000 -0700 997 + +++ lib/readline/undo.c 2015-02-06 17:14:11.062454900 -0700 998 + @@ -124,7 +124,7 @@ _rl_free_undo_list (ul) 999 + void 1000 + rl_free_undo_list () 1001 + { 1002 + - UNDO_LIST *release, *orig_list; 1003 + + UNDO_LIST *orig_list; 1004 + 1005 + orig_list = rl_undo_list; 1006 + _rl_free_undo_list (rl_undo_list); 1007 + --- lib/readline/vi_mode.c 2012-09-01 16:55:30.000000000 -0600 1008 + +++ lib/readline/vi_mode.c 2015-02-06 17:14:11.062454900 -0700 1009 + @@ -1089,7 +1089,7 @@ static int 1010 + rl_domove_motion_callback (m) 1011 + _rl_vimotion_cxt *m; 1012 + { 1013 + - int c, save, r; 1014 + + int c, r; 1015 + int old_end; 1016 + 1017 + _rl_vi_last_motion = c = m->motion; 1018 + @@ -1257,7 +1257,6 @@ int 1019 + rl_vi_domove (x, ignore) 1020 + int x, *ignore; 1021 + { 1022 + - int r; 1023 + _rl_vimotion_cxt *m; 1024 + 1025 + m = _rl_vimvcxt; 1026 + --- lib/sh/pathphys.c 2013-05-28 13:33:58.000000000 -0600 1027 + +++ lib/sh/pathphys.c 2015-02-06 17:14:11.062454900 -0700 1028 + @@ -35,6 +35,7 @@ 1029 + #include <stdio.h> 1030 + #include <chartypes.h> 1031 + #include <errno.h> 1032 + +#include <stdlib.h> 1033 + 1034 + #include "shell.h" 1035 + 1036 + @@ -76,6 +77,10 @@ sh_physpath (path, flags) 1037 + char *path; 1038 + int flags; 1039 + { 1040 + +#if __CYGWIN__ 1041 + + /* realpath does this correctly without all the hassle */ 1042 + + return realpath (path, NULL); 1043 + +#else 1044 + char tbuf[PATH_MAX+1], linkbuf[PATH_MAX+1]; 1045 + char *result, *p, *q, *qsave, *qbase, *workpath; 1046 + int double_slash_path, linklen, nlink; 1047 + @@ -214,11 +219,7 @@ error: 1048 + { 1049 + q = result; 1050 + /* Duplicating some code here... */ 1051 + -#if defined (__CYGWIN__) 1052 + - qbase = (ISALPHA((unsigned char)workpath[0]) && workpath[1] == ':') ? workpath + 3 : workpath + 1; 1053 + -#else 1054 + qbase = workpath + 1; 1055 + -#endif 1056 + double_slash_path = DOUBLE_SLASH (workpath); 1057 + qbase += double_slash_path; 1058 + 1059 + @@ -249,6 +250,7 @@ error: 1060 + } 1061 + 1062 + return (result); 1063 + +#endif /* ! __CYGWIN__ */ 1064 + } 1065 + 1066 + char * 1067 + --- lib/sh/tmpfile.c 2013-12-18 15:50:13.000000000 -0700 1068 + +++ lib/sh/tmpfile.c 2015-02-06 17:14:11.062454900 -0700 1069 + @@ -96,7 +96,7 @@ get_tmpdir (flags) 1070 + if (tdir && (file_iswdir (tdir) == 0 || strlen (tdir) > PATH_MAX)) 1071 + tdir = 0; 1072 + 1073 + - if (tdir == 0) 1074 + + if (tdir == 0 || !file_iswdir (tdir)) 1075 + tdir = get_sys_tmpdir (); 1076 + 1077 + #if defined (HAVE_PATHCONF) && defined (_PC_NAME_MAX) 1078 + @@ -118,14 +118,15 @@ sh_mktmpname (nameroot, flags) 1079 + struct stat sb; 1080 + int r, tdlen; 1081 + 1082 + - filename = (char *)xmalloc (PATH_MAX + 1); 1083 + + filename = NULL; 1084 + tdir = get_tmpdir (flags); 1085 + tdlen = strlen (tdir); 1086 + 1087 + lroot = nameroot ? nameroot : DEFAULT_NAMEROOT; 1088 + 1089 + #ifdef USE_MKTEMP 1090 + - sprintf (filename, "%s/%s.XXXXXX", tdir, lroot); 1091 + + if (asprintf (&filename, "%s/%s.XXXXXX", tdir, lroot) < 0) 1092 + + return NULL; 1093 + if (mktemp (filename) == 0) 1094 + { 1095 + free (filename); 1096 + @@ -138,7 +139,9 @@ sh_mktmpname (nameroot, flags) 1097 + (unsigned long) time ((time_t *)0) ^ 1098 + (unsigned long) dollar_dollar_pid ^ 1099 + (unsigned long) ((flags & MT_USERANDOM) ? random () : ntmpfiles++); 1100 + - sprintf (filename, "%s/%s-%lu", tdir, lroot, filenum); 1101 + + free (filename); 1102 + + if (asprintf (&filename, "%s/%s-%lu", tdir, lroot, filenum) < 0) 1103 + + return NULL; 1104 + if (tmpnamelen > 0 && tmpnamelen < 32) 1105 + filename[tdlen + 1 + tmpnamelen] = '\0'; 1106 + # ifdef HAVE_LSTAT 1107 + @@ -163,14 +166,19 @@ sh_mktmpfd (nameroot, flags, namep) 1108 + char *filename, *tdir, *lroot; 1109 + int fd, tdlen; 1110 + 1111 + - filename = (char *)xmalloc (PATH_MAX + 1); 1112 + + filename = NULL; 1113 + tdir = get_tmpdir (flags); 1114 + tdlen = strlen (tdir); 1115 + 1116 + lroot = nameroot ? nameroot : DEFAULT_NAMEROOT; 1117 + 1118 + #ifdef USE_MKSTEMP 1119 + - sprintf (filename, "%s/%s.XXXXXX", tdir, lroot); 1120 + + if (asprintf (&filename, "%s/%s.XXXXXX", tdir, lroot) < 0) 1121 + + { 1122 + + if (namep) 1123 + + *namep = NULL; 1124 + + return -1; 1125 + + } 1126 + fd = mkstemp (filename); 1127 + if (fd < 0 || namep == 0) 1128 + { 1129 + @@ -187,7 +195,13 @@ sh_mktmpfd (nameroot, flags, namep) 1130 + (unsigned long) time ((time_t *)0) ^ 1131 + (unsigned long) dollar_dollar_pid ^ 1132 + (unsigned long) ((flags & MT_USERANDOM) ? random () : ntmpfiles++); 1133 + - sprintf (filename, "%s/%s-%lu", tdir, lroot, filenum); 1134 + + free (filename); 1135 + + if (asprintf (&filename, "%s/%s-%lu", tdir, lroot, filenum) < 0) 1136 + + { 1137 + + if (namep) 1138 + + *namep = NULL; 1139 + + return -1; 1140 + + } 1141 + if (tmpnamelen > 0 && tmpnamelen < 32) 1142 + filename[tdlen + 1 + tmpnamelen] = '\0'; 1143 + fd = open (filename, BASEOPENFLAGS | ((flags & MT_READWRITE) ? O_RDWR : O_WRONLY), 0600); 1144 + --- mksyntax.c 2012-07-29 17:48:38.000000000 -0600 1145 + +++ mksyntax.c 2015-02-06 17:14:11.062454900 -0700 1146 + @@ -29,13 +29,13 @@ 1147 + 1148 + #ifdef HAVE_UNISTD_H 1149 + # include <unistd.h> 1150 + +#else 1151 + +extern int optind; 1152 + +extern char *optarg; 1153 + #endif 1154 + 1155 + #include "syntax.h" 1156 + 1157 + -extern int optind; 1158 + -extern char *optarg; 1159 + - 1160 + #ifndef errno 1161 + extern int errno; 1162 + #endif 1163 + --- parse.y 2015-02-06 17:12:55.682776800 -0700 1164 + +++ parse.y 2015-02-06 17:14:11.062454900 -0700 1165 + @@ -1531,14 +1531,20 @@ yy_string_get () 1166 + string = bash_input.location.string; 1167 + 1168 + /* If the string doesn't exist, or is empty, EOF found. */ 1169 + - if (string && *string) 1170 + + while (string && *string) 1171 + { 1172 + c = *string++; 1173 + bash_input.location.string = string; 1174 + +#if __CYGWIN__ 1175 + + { 1176 + + extern int igncr; 1177 + + if (igncr && c == '\r') 1178 + + continue; 1179 + + } 1180 + +#endif 1181 + return (c); 1182 + } 1183 + - else 1184 + - return (EOF); 1185 + + return (EOF); 1186 + } 1187 + 1188 + static int 1189 + @@ -2305,7 +2311,7 @@ shell_getc (remove_quoted_newline) 1190 + if (n <= 2) /* we have to save 1 for the newline added below */ 1191 + { 1192 + if (truncating == 0) 1193 + - internal_warning("shell_getc: shell_input_line_size (%zu) exceeds SIZE_MAX (%llu): line truncated", shell_input_line_size, SIZE_MAX); 1194 + + internal_warning("shell_getc: shell_input_line_size (%zu) exceeds SIZE_MAX (%zu): line truncated", shell_input_line_size, SIZE_MAX); 1195 + shell_input_line[i] = '\0'; 1196 + truncating = 1; 1197 + } 1198 + @@ -3582,7 +3588,6 @@ parse_comsub (qc, open, close, lenp, fla 1199 + 1200 + while (count) 1201 + { 1202 + -comsub_readchar: 1203 + ch = shell_getc (qc != '\'' && (tflags & (LEX_INCOMMENT|LEX_PASSNEXT)) == 0); 1204 + 1205 + if (ch == EOF) 1206 + --- pathexp.h 2009-01-04 12:32:40.000000000 -0700 1207 + +++ pathexp.h 2015-02-06 17:14:11.062454900 -0700 1208 + @@ -86,7 +86,7 @@ struct ign { 1209 + typedef int sh_iv_item_func_t __P((struct ign *)); 1210 + 1211 + struct ignorevar { 1212 + - char *varname; /* FIGNORE or GLOBIGNORE */ 1213 + + char *varname; /* FIGNORE or GLOBIGNORE or EXECIGNORE */ 1214 + struct ign *ignores; /* Store the ignore strings here */ 1215 + int num_ignores; /* How many are there? */ 1216 + char *last_ignoreval; /* Last value of variable - cached for speed */ 1217 + --- redir.c 2013-10-14 07:19:59.000000000 -0600 1218 + +++ redir.c 2015-02-06 17:14:11.078059300 -0700 1219 + @@ -156,7 +156,6 @@ redirection_error (temp, error) 1220 + #endif 1221 + else if (expandable_redirection_filename (temp)) 1222 + { 1223 + -expandable_filename: 1224 + oflags = temp->redirectee.filename->flags; 1225 + if (posixly_correct && interactive_shell == 0) 1226 + temp->redirectee.filename->flags |= W_NOGLOB; 1227 + --- subst.c 2015-02-06 17:12:55.370841100 -0700 1228 + +++ subst.c 2015-02-06 17:14:11.078059300 -0700 1229 + @@ -41,6 +41,7 @@ 1230 + #include "posixstat.h" 1231 + #include "bashintl.h" 1232 + 1233 + +#define NEED_SH_SETLINEBUF_DECL /* used in externs.h */ 1234 + #include "shell.h" 1235 + #include "parser.h" 1236 + #include "flags.h" 1237 + @@ -5268,6 +5269,13 @@ read_comsub (fd, quoted, rflag) 1238 + #endif 1239 + continue; 1240 + } 1241 + +#if __CYGWIN__ 1242 + + { 1243 + + extern int igncr; 1244 + + if (igncr && c == '\r') 1245 + + continue; 1246 + + } 1247 + +#endif /* __CYGWIN__ */ 1248 + 1249 + /* Add the character to ISTRING, possibly after resizing it. */ 1250 + RESIZE_MALLOCED_BUFFER (istring, istring_index, 2, istring_size, DEFAULT_ARRAY_SIZE); 1251 + @@ -5385,6 +5393,28 @@ command_substitute (string, quoted) 1252 + goto error_exit; 1253 + } 1254 + 1255 + +#if __CYGWIN__ 1256 + + /* Passing a pipe through std fds can cause hangs when talking to a 1257 + + non-cygwin child. Move it. */ 1258 + + if (fildes[0] < 3) 1259 + + { 1260 + + int fd = fcntl (fildes[0], F_DUPFD, 3); 1261 + + close (fildes[0]); 1262 + + fildes[0] = fd; 1263 + + } 1264 + + if (fildes[1] < 3) 1265 + + { 1266 + + int fd = fcntl (fildes[1], F_DUPFD, 3); 1267 + + close (fildes[1]); 1268 + + fildes[1] = fd; 1269 + + } 1270 + + if (fildes[0] < 0 || fildes[1] < 0) 1271 + + { 1272 + + sys_error (_("cannot make pipe for command substitution")); 1273 + + goto error_exit; 1274 + + } 1275 + +#endif /* __CYGWIN__ */ 1276 + + 1277 + old_pid = last_made_pid; 1278 + #if defined (JOB_CONTROL) 1279 + old_pipeline_pgrp = pipeline_pgrp; 1280 + --- support/bashversion.c 2008-09-09 07:31:53.000000000 -0600 1281 + +++ support/bashversion.c 2015-02-06 17:14:11.078059300 -0700 1282 + @@ -26,6 +26,9 @@ 1283 + 1284 + #if defined (HAVE_UNISTD_H) 1285 + # include <unistd.h> 1286 + +#else 1287 + +extern int optind; 1288 + +extern char *optarg; 1289 + #endif 1290 + 1291 + #include "bashansi.h" 1292 + @@ -41,9 +44,6 @@ 1293 + #define LFLAG 0x0020 1294 + #define XFLAG 0x0040 1295 + 1296 + -extern int optind; 1297 + -extern char *optarg; 1298 + - 1299 + extern char *dist_version; 1300 + extern int patch_level; 1301 + 1302 + @@ -65,7 +65,7 @@ main (argc, argv) 1303 + char **argv; 1304 + { 1305 + int opt, oflags; 1306 + - char dv[128], *rv; 1307 + + char dv[128], *rv = NULL; 1308 + 1309 + if (progname = strrchr (argv[0], '/')) 1310 + progname++; 1311 + --- support/mkversion.sh 2008-08-13 06:25:57.000000000 -0600 1312 + +++ support/mkversion.sh 2015-02-06 17:14:11.078059300 -0700 1313 + @@ -29,7 +29,7 @@ source_dir="." 1314 + while [ $# -gt 0 ]; do 1315 + case "$1" in 1316 + -o) shift; OUTFILE=$1; shift ;; 1317 + - -b) shift; inc_build=yes ;; 1318 + + -b) shift; ;;# inc_build=yes ;; # hacked out for cygport 1319 + -s) shift; rel_status=$1; shift ;; 1320 + -p) shift; patch_level=$1; shift ;; 1321 + -d) shift; dist_version=$1; shift ;; 1322 + --- variables.c 2015-02-06 17:12:55.729569600 -0700 1323 + +++ variables.c 2015-02-06 17:14:11.078059300 -0700 1324 + @@ -2526,9 +2526,9 @@ bind_variable_internal (name, value, tab 1325 + 1326 + newname = 0; 1327 + #if defined (ARRAY_VARS) 1328 + - if ((aflags & ASS_FROMREF) && (hflags & HASH_NOSRCH) == 0 && valid_array_reference (name)) 1329 + + if ((aflags & ASS_FROMREF) && (hflags & HASH_NOSRCH) == 0 && valid_array_reference ((char *)name)) 1330 + { 1331 + - newname = array_variable_name (name, &subp, &sublen); 1332 + + newname = array_variable_name ((char*)name, &subp, &sublen); 1333 + if (newname == 0) 1334 + return (SHELL_VAR *)NULL; /* XXX */ 1335 + entry = hash_lookup (newname, table); 1336 + @@ -2573,13 +2573,13 @@ bind_variable_internal (name, value, tab 1337 + entry = make_new_array_variable (newname); /* indexed array by default */ 1338 + if (entry == 0) 1339 + return entry; 1340 + - ind = array_expand_index (name, subp, sublen); 1341 + + ind = array_expand_index (entry, subp, sublen); 1342 + bind_array_element (entry, ind, value, aflags); 1343 + } 1344 + #endif 1345 + else if (entry == 0) 1346 + { 1347 + - entry = make_new_variable (name, table); 1348 + + entry = make_new_variable ((char*)name, table); 1349 + var_setvalue (entry, make_variable_value (entry, value, 0)); /* XXX */ 1350 + } 1351 + else if (entry->assign_func) /* array vars have assign functions now */ 1352 + @@ -4679,6 +4679,8 @@ static struct name_and_function special_ 1353 + { "COMP_WORDBREAKS", sv_comp_wordbreaks }, 1354 + #endif 1355 + 1356 + + { "EXECIGNORE", sv_execignore }, 1357 + + 1358 + { "FUNCNEST", sv_funcnest }, 1359 + 1360 + { "GLOBIGNORE", sv_globignore }, 1361 + @@ -4877,6 +4879,13 @@ sv_globignore (name) 1362 + setup_glob_ignore (name); 1363 + } 1364 + 1365 + +/* What to do when EXECIGNORE changes. */ 1366 + +void 1367 + +sv_execignore (char *name) 1368 + +{ 1369 + + setup_exec_ignore (name); 1370 + +} 1371 + + 1372 + #if defined (READLINE) 1373 + void 1374 + sv_comp_wordbreaks (name) 1375 + @@ -4950,7 +4959,7 @@ sv_winsize (name) 1376 + /* Update the value of HOME in the export environment so tilde expansion will 1377 + work on cygwin. */ 1378 + #if defined (__CYGWIN__) 1379 + -sv_home (name) 1380 + +void sv_home (name) 1381 + char *name; 1382 + { 1383 + array_needs_making = 1; 1384 + --- variables.h 2014-01-08 13:33:29.000000000 -0700 1385 + +++ variables.h 2015-02-06 17:14:11.078059300 -0700 1386 + @@ -372,6 +372,7 @@ extern void sv_ifs __P((char *)); 1387 + extern void sv_path __P((char *)); 1388 + extern void sv_mail __P((char *)); 1389 + extern void sv_funcnest __P((char *)); 1390 + +extern void sv_execignore __P((char *)); 1391 + extern void sv_globignore __P((char *)); 1392 + extern void sv_ignoreeof __P((char *)); 1393 + extern void sv_strict_posix __P((char *));
+13 -15
pkgs/shells/bash/default.nix
··· 3 3 assert interactive -> readline != null; 4 4 5 5 let 6 - version = if stdenv.isCygwin then "4.1" else "4.3"; 6 + version = "4.3"; 7 7 realName = "bash-${version}"; 8 - shortName = if stdenv.isCygwin then "bash41" else "bash43"; 8 + shortName = "bash43"; 9 9 baseConfigureFlags = if interactive then "--with-installed-readline" else "--disable-readline"; 10 - sha256 = if version == "4.1" then 11 - "1np1ggp1lv8idwfx3mcxl9rhadqdf4h3x4isa3dk8v9wm0j72qiz" 12 - else 13 - "1m14s1f61mf6bijfibcjm9y6pkyvz6gibyl8p4hxq90fisi8gimg"; 14 - 15 - basePatchFun = if version == "4.1" then 16 - ./bash-4.1-patches.nix 17 - else 18 - ./bash-4.3-patches.nix; 19 - 20 - extraPatches = stdenv.lib.optional stdenv.isCygwin ./bash-4.1.17-9.src.patch; 10 + sha256 = "1m14s1f61mf6bijfibcjm9y6pkyvz6gibyl8p4hxq90fisi8gimg"; 21 11 in 22 12 23 13 stdenv.mkDerivation rec { ··· 47 37 inherit sha256; 48 38 }; 49 39 in 50 - import basePatchFun patch) ++ extraPatches; 40 + import ./bash-4.3-patches.nix patch) 41 + ++ stdenv.lib.optional stdenv.isCygwin ./cygwin-bash-4.3.33-1.src.patch; 51 42 52 43 crossAttrs = { 53 44 configureFlags = baseConfigureFlags + 54 - " bash_cv_job_control_missing=nomissing bash_cv_sys_named_pipes=nomissing"; 45 + " bash_cv_job_control_missing=nomissing bash_cv_sys_named_pipes=nomissing" + 46 + stdenv.lib.optionalString stdenv.isCygwin '' 47 + --without-libintl-prefix --without-libiconv-prefix 48 + --with-installed-readline 49 + bash_cv_dev_stdin=present 50 + bash_cv_dev_fd=standard 51 + bash_cv_termcap_lib=libncurses 52 + ''; 55 53 }; 56 54 57 55 configureFlags = baseConfigureFlags;
+1
pkgs/top-level/all-packages.nix
··· 3392 3392 3393 3393 bash = lowPrio (callPackage ../shells/bash { 3394 3394 texinfo = null; 3395 + interactive = stdenv.isCygwin; # patch for cygwin requires readline support 3395 3396 }); 3396 3397 3397 3398 bashInteractive = appendToName "interactive" (callPackage ../shells/bash {