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