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