[cf468ea] | 1 | Submitted By: Jeremy Huntwork (jhuntwork at linuxfromscratch dot org)
|
---|
| 2 | Date: 2006-04-11
|
---|
[69cde8d] | 3 | Initial Package Version: 3.1
|
---|
| 4 | Origin: http://ftp.gnu.org/gnu/bash/bash-3.1-patches/
|
---|
[cf468ea] | 5 | Upstream Status: From Upstream
|
---|
| 6 | Description: Contains patches 001-016 from upstream
|
---|
[69cde8d] | 7 |
|
---|
| 8 | diff -Naur bash-3.1.orig/doc/bash.1 bash-3.1/doc/bash.1
|
---|
[cf468ea] | 9 | --- bash-3.1.orig/doc/bash.1 2005-10-12 11:40:52.000000000 -0400
|
---|
| 10 | +++ bash-3.1/doc/bash.1 2006-04-11 11:36:54.702393214 -0400
|
---|
[69cde8d] | 11 | @@ -6,12 +6,12 @@
|
---|
| 12 | .\" Case Western Reserve University
|
---|
| 13 | .\" chet@po.cwru.edu
|
---|
| 14 | .\"
|
---|
| 15 | -.\" Last Change: Sat Aug 27 13:28:44 EDT 2005
|
---|
| 16 | +.\" Last Change: Wed Dec 28 19:58:45 EST 2005
|
---|
| 17 | .\"
|
---|
| 18 | .\" bash_builtins, strip all but Built-Ins section
|
---|
| 19 | .if \n(zZ=1 .ig zZ
|
---|
| 20 | .if \n(zY=1 .ig zY
|
---|
| 21 | -.TH BASH 1 "2005 Aug 27" "GNU Bash-3.1-beta1"
|
---|
| 22 | +.TH BASH 1 "2005 Dec 28" "GNU Bash-3.1"
|
---|
| 23 | .\"
|
---|
| 24 | .\" There's some problem with having a `@'
|
---|
| 25 | .\" in a tagged paragraph with the BSD man macros.
|
---|
| 26 | @@ -677,8 +677,8 @@
|
---|
| 27 | .B nocasematch
|
---|
| 28 | is enabled, the match is performed without regard to the case
|
---|
| 29 | of alphabetic characters.
|
---|
| 30 | -The return value is 0 if the string matches or does not match
|
---|
| 31 | -the pattern, respectively, and 1 otherwise.
|
---|
| 32 | +The return value is 0 if the string matches (\fB==\fP) or does not match
|
---|
| 33 | +(\fB!=\fP) the pattern, and 1 otherwise.
|
---|
| 34 | Any part of the pattern may be quoted to force it to be matched as a
|
---|
| 35 | string.
|
---|
| 36 | .if t .sp 0.5
|
---|
| 37 | @@ -807,6 +807,12 @@
|
---|
| 38 | as for pathname expansion (see
|
---|
| 39 | .B Pathname Expansion
|
---|
| 40 | below).
|
---|
| 41 | +The \fIword\fP is expanded using tilde
|
---|
| 42 | +expansion, parameter and variable expansion, arithmetic substituion,
|
---|
| 43 | +command substitution, process substitution and quote removal.
|
---|
| 44 | +Each \fIpattern\fP examined is expanded using tilde
|
---|
| 45 | +expansion, parameter and variable expansion, arithmetic substituion,
|
---|
| 46 | +command substitution, and process substitution.
|
---|
| 47 | If the shell option
|
---|
| 48 | .B nocasematch
|
---|
| 49 | is enabled, the match is performed without regard to the case
|
---|
| 50 | @@ -8484,7 +8490,7 @@
|
---|
| 51 | returns true if any of the arguments are found, false if
|
---|
| 52 | none are found.
|
---|
| 53 | .TP
|
---|
| 54 | -\fBulimit\fP [\fB\-SHacdflmnpstuv\fP [\fIlimit\fP]]
|
---|
| 55 | +\fBulimit\fP [\fB\-SHacdfilmnpqstuvx\fP [\fIlimit\fP]]
|
---|
| 56 | Provides control over the resources available to the shell and to
|
---|
| 57 | processes started by it, on systems that allow such control.
|
---|
| 58 | The \fB\-H\fP and \fB\-S\fP options specify that the hard or soft limit is
|
---|
| 59 | @@ -8523,6 +8529,9 @@
|
---|
| 60 | .B \-f
|
---|
| 61 | The maximum size of files created by the shell
|
---|
| 62 | .TP
|
---|
| 63 | +.B \-i
|
---|
| 64 | +The maximum number of pending signals
|
---|
| 65 | +.TP
|
---|
| 66 | .B \-l
|
---|
| 67 | The maximum size that may be locked into memory
|
---|
| 68 | .TP
|
---|
| 69 | @@ -8536,6 +8545,9 @@
|
---|
| 70 | .B \-p
|
---|
| 71 | The pipe size in 512-byte blocks (this may not be set)
|
---|
| 72 | .TP
|
---|
| 73 | +.B \-q
|
---|
| 74 | +The maximum number of bytes in POSIX message queues
|
---|
| 75 | +.TP
|
---|
| 76 | .B \-s
|
---|
| 77 | The maximum stack size
|
---|
| 78 | .TP
|
---|
| 79 | @@ -8547,6 +8559,9 @@
|
---|
| 80 | .TP
|
---|
| 81 | .B \-v
|
---|
| 82 | The maximum amount of virtual memory available to the shell
|
---|
| 83 | +.TP
|
---|
| 84 | +.B \-x
|
---|
| 85 | +The maximum number of file locks
|
---|
| 86 | .PD
|
---|
| 87 | .PP
|
---|
| 88 | If
|
---|
| 89 | diff -Naur bash-3.1.orig/doc/bashref.texi bash-3.1/doc/bashref.texi
|
---|
[cf468ea] | 90 | --- bash-3.1.orig/doc/bashref.texi 2005-10-03 15:07:21.000000000 -0400
|
---|
| 91 | +++ bash-3.1/doc/bashref.texi 2006-04-11 11:36:54.709392515 -0400
|
---|
[69cde8d] | 92 | @@ -961,8 +961,8 @@
|
---|
| 93 | (see the description of @code{shopt} in @ref{Bash Builtins})
|
---|
| 94 | is enabled, the match is performed without regard to the case
|
---|
| 95 | of alphabetic characters.
|
---|
| 96 | -The return value is 0 if the string matches or does not match
|
---|
| 97 | -the pattern, respectively, and 1 otherwise.
|
---|
| 98 | +The return value is 0 if the string matches (@samp{==}) or does not
|
---|
| 99 | +match (@samp{!=})the pattern, and 1 otherwise.
|
---|
| 100 | Any part of the pattern may be quoted to force it to be matched as a
|
---|
| 101 | string.
|
---|
| 102 |
|
---|
| 103 | @@ -2598,7 +2598,7 @@
|
---|
| 104 | Builtin commands are necessary to implement functionality impossible
|
---|
| 105 | or inconvenient to obtain with separate utilities.
|
---|
| 106 |
|
---|
| 107 | -This section briefly the builtins which Bash inherits from
|
---|
| 108 | +This section briefly describes the builtins which Bash inherits from
|
---|
| 109 | the Bourne Shell, as well as the builtin commands which are unique
|
---|
| 110 | to or have been extended in Bash.
|
---|
| 111 |
|
---|
| 112 | @@ -3833,7 +3833,7 @@
|
---|
| 113 | @item ulimit
|
---|
| 114 | @btindex ulimit
|
---|
| 115 | @example
|
---|
| 116 | -ulimit [-acdflmnpstuvSH] [@var{limit}]
|
---|
| 117 | +ulimit [-acdfilmnpqstuvxSH] [@var{limit}]
|
---|
| 118 | @end example
|
---|
| 119 | @code{ulimit} provides control over the resources available to processes
|
---|
| 120 | started by the shell, on systems that allow such control. If an
|
---|
| 121 | @@ -3857,6 +3857,9 @@
|
---|
| 122 | @item -f
|
---|
| 123 | The maximum size of files created by the shell.
|
---|
| 124 |
|
---|
| 125 | +@item -i
|
---|
| 126 | +The maximum number of pending signals.
|
---|
| 127 | +
|
---|
| 128 | @item -l
|
---|
| 129 | The maximum size that may be locked into memory.
|
---|
| 130 |
|
---|
| 131 | @@ -3869,6 +3872,9 @@
|
---|
| 132 | @item -p
|
---|
| 133 | The pipe buffer size.
|
---|
| 134 |
|
---|
| 135 | +@item -q
|
---|
| 136 | +The maximum number of bytes in POSIX message queues.
|
---|
| 137 | +
|
---|
| 138 | @item -s
|
---|
| 139 | The maximum stack size.
|
---|
| 140 |
|
---|
| 141 | @@ -3881,6 +3887,9 @@
|
---|
| 142 | @item -v
|
---|
| 143 | The maximum amount of virtual memory available to the process.
|
---|
| 144 |
|
---|
| 145 | +@item -x
|
---|
| 146 | +The maximum number of file locks.
|
---|
| 147 | +
|
---|
| 148 | @end table
|
---|
| 149 |
|
---|
| 150 | If @var{limit} is given, it is the new value of the specified resource;
|
---|
| 151 | @@ -4089,8 +4098,8 @@
|
---|
| 152 | Print shell input lines as they are read.
|
---|
| 153 |
|
---|
| 154 | @item -x
|
---|
| 155 | -Print a trace of simple commands, \fBfor\fP commands, \fBcase\fP
|
---|
| 156 | -commands, \fBselect\fP commands, and arithmetic \fBfor\fP commands
|
---|
| 157 | +Print a trace of simple commands, @code{for} commands, @code{case}
|
---|
| 158 | +commands, @code{select} commands, and arithmetic @code{for} commands
|
---|
| 159 | and their arguments or associated word lists after they are
|
---|
| 160 | expanded and before they are executed. The value of the @env{PS4}
|
---|
| 161 | variable is expanded and the resultant value is printed before
|
---|
| 162 | diff -Naur bash-3.1.orig/doc/version.texi bash-3.1/doc/version.texi
|
---|
[cf468ea] | 163 | --- bash-3.1.orig/doc/version.texi 2005-09-20 14:52:56.000000000 -0400
|
---|
| 164 | +++ bash-3.1/doc/version.texi 2006-04-11 11:36:54.710392415 -0400
|
---|
[69cde8d] | 165 | @@ -2,9 +2,9 @@
|
---|
| 166 | Copyright (C) 1988-2005 Free Software Foundation, Inc.
|
---|
| 167 | @end ignore
|
---|
| 168 |
|
---|
| 169 | -@set LASTCHANGE Mon Sep 5 11:47:04 EDT 2005
|
---|
| 170 | +@set LASTCHANGE Fri Dec 30 10:50:51 EST 2005
|
---|
| 171 |
|
---|
| 172 | -@set EDITION 3.1-beta1
|
---|
| 173 | -@set VERSION 3.1-beta1
|
---|
| 174 | -@set UPDATED 5 September 2005
|
---|
| 175 | -@set UPDATED-MONTH September 2005
|
---|
| 176 | +@set EDITION 3.1
|
---|
| 177 | +@set VERSION 3.1
|
---|
| 178 | +@set UPDATED 30 December 2005
|
---|
| 179 | +@set UPDATED-MONTH December 2005
|
---|
| 180 | diff -Naur bash-3.1.orig/jobs.c bash-3.1/jobs.c
|
---|
[cf468ea] | 181 | --- bash-3.1.orig/jobs.c 2005-11-11 23:13:27.000000000 -0500
|
---|
| 182 | +++ bash-3.1/jobs.c 2006-04-11 11:36:54.713392115 -0400
|
---|
[69cde8d] | 183 | @@ -619,8 +619,11 @@
|
---|
| 184 | * once in the parent and once in each child. This is where
|
---|
| 185 | * the parent gives it away.
|
---|
| 186 | *
|
---|
| 187 | + * Don't give the terminal away if this shell is an asynchronous
|
---|
| 188 | + * subshell.
|
---|
| 189 | + *
|
---|
| 190 | */
|
---|
| 191 | - if (job_control && newjob->pgrp)
|
---|
| 192 | + if (job_control && newjob->pgrp && (subshell_environment&SUBSHELL_ASYNC) == 0)
|
---|
| 193 | give_terminal_to (newjob->pgrp, 0);
|
---|
| 194 | }
|
---|
| 195 | }
|
---|
| 196 | @@ -844,9 +847,10 @@
|
---|
| 197 | realloc_jobs_list ()
|
---|
| 198 | {
|
---|
| 199 | sigset_t set, oset;
|
---|
| 200 | - int nsize, i, j;
|
---|
| 201 | + int nsize, i, j, ncur, nprev;
|
---|
| 202 | JOB **nlist;
|
---|
| 203 |
|
---|
| 204 | + ncur = nprev = NO_JOB;
|
---|
| 205 | nsize = ((js.j_njobs + JOB_SLOTS - 1) / JOB_SLOTS);
|
---|
| 206 | nsize *= JOB_SLOTS;
|
---|
| 207 | i = js.j_njobs % JOB_SLOTS;
|
---|
| 208 | @@ -854,17 +858,51 @@
|
---|
| 209 | nsize += JOB_SLOTS;
|
---|
| 210 |
|
---|
| 211 | BLOCK_CHILD (set, oset);
|
---|
| 212 | - nlist = (JOB **) xmalloc (nsize * sizeof (JOB *));
|
---|
| 213 | + nlist = (js.j_jobslots == nsize) ? jobs : (JOB **) xmalloc (nsize * sizeof (JOB *));
|
---|
| 214 | +
|
---|
| 215 | for (i = j = 0; i < js.j_jobslots; i++)
|
---|
| 216 | if (jobs[i])
|
---|
| 217 | - nlist[j++] = jobs[i];
|
---|
| 218 | + {
|
---|
| 219 | + if (i == js.j_current)
|
---|
| 220 | + ncur = j;
|
---|
| 221 | + if (i == js.j_previous)
|
---|
| 222 | + nprev = j;
|
---|
| 223 | + nlist[j++] = jobs[i];
|
---|
| 224 | + }
|
---|
| 225 | +
|
---|
| 226 | +#if defined (DEBUG)
|
---|
| 227 | + itrace ("realloc_jobs_list: resize jobs list from %d to %d", js.j_jobslots, nsize);
|
---|
| 228 | + itrace ("realloc_jobs_list: j_lastj changed from %d to %d", js.j_lastj, (j > 0) ? j - 1 : 0);
|
---|
| 229 | + itrace ("realloc_jobs_list: j_njobs changed from %d to %d", js.j_njobs, (j > 0) ? j - 1 : 0);
|
---|
| 230 | +#endif
|
---|
| 231 |
|
---|
| 232 | js.j_firstj = 0;
|
---|
| 233 | - js.j_lastj = (j > 0) ? j - 1: 0;
|
---|
| 234 | + js.j_lastj = (j > 0) ? j - 1 : 0;
|
---|
| 235 | + js.j_njobs = j;
|
---|
| 236 | js.j_jobslots = nsize;
|
---|
| 237 |
|
---|
| 238 | - free (jobs);
|
---|
| 239 | - jobs = nlist;
|
---|
| 240 | + /* Zero out remaining slots in new jobs list */
|
---|
| 241 | + for ( ; j < nsize; j++)
|
---|
| 242 | + nlist[j] = (JOB *)NULL;
|
---|
| 243 | +
|
---|
| 244 | + if (jobs != nlist)
|
---|
| 245 | + {
|
---|
| 246 | + free (jobs);
|
---|
| 247 | + jobs = nlist;
|
---|
| 248 | + }
|
---|
| 249 | +
|
---|
| 250 | + if (ncur != NO_JOB)
|
---|
| 251 | + js.j_current = ncur;
|
---|
| 252 | + if (nprev != NO_JOB)
|
---|
| 253 | + js.j_previous = nprev;
|
---|
| 254 | +
|
---|
| 255 | + /* Need to reset these */
|
---|
| 256 | + if (js.j_current == NO_JOB || js.j_previous == NO_JOB || js.j_current > js.j_lastj || js.j_previous > js.j_lastj)
|
---|
| 257 | + reset_current ();
|
---|
| 258 | +
|
---|
| 259 | +#ifdef DEBUG
|
---|
| 260 | + itrace ("realloc_jobs_list: reset js.j_current (%d) and js.j_previous (%d)", js.j_current, js.j_previous);
|
---|
| 261 | +#endif
|
---|
| 262 |
|
---|
| 263 | UNBLOCK_CHILD (oset);
|
---|
| 264 | }
|
---|
| 265 | @@ -1655,7 +1693,7 @@
|
---|
| 266 | In this case, we don't want to give the terminal to the
|
---|
| 267 | shell's process group (we could be in the middle of a
|
---|
| 268 | pipeline, for example). */
|
---|
| 269 | - if (async_p == 0 && pipeline_pgrp != shell_pgrp)
|
---|
| 270 | + if (async_p == 0 && pipeline_pgrp != shell_pgrp && ((subshell_environment&SUBSHELL_ASYNC) == 0))
|
---|
| 271 | give_terminal_to (pipeline_pgrp, 0);
|
---|
| 272 |
|
---|
| 273 | #if defined (PGRP_PIPE)
|
---|
| 274 | @@ -2198,7 +2236,11 @@
|
---|
| 275 | /* This is possibly a race condition -- should it go in stop_pipeline? */
|
---|
| 276 | wait_sigint_received = 0;
|
---|
| 277 | if (job_control == 0)
|
---|
| 278 | - old_sigint_handler = set_signal_handler (SIGINT, wait_sigint_handler);
|
---|
| 279 | + {
|
---|
| 280 | + old_sigint_handler = set_signal_handler (SIGINT, wait_sigint_handler);
|
---|
| 281 | + if (old_sigint_handler == SIG_IGN)
|
---|
| 282 | + set_signal_handler (SIGINT, old_sigint_handler);
|
---|
| 283 | + }
|
---|
| 284 |
|
---|
| 285 | termination_state = last_command_exit_value;
|
---|
| 286 |
|
---|
[cf468ea] | 287 | diff -Naur bash-3.1.orig/lib/glob/glob.c bash-3.1/lib/glob/glob.c
|
---|
| 288 | --- bash-3.1.orig/lib/glob/glob.c 2005-03-24 12:42:27.000000000 -0500
|
---|
| 289 | +++ bash-3.1/lib/glob/glob.c 2006-04-11 11:37:12.868577740 -0400
|
---|
| 290 | @@ -360,6 +360,7 @@
|
---|
| 291 | count = lose = skip = 0;
|
---|
| 292 |
|
---|
| 293 | firstmalloc = 0;
|
---|
| 294 | + nalloca = 0;
|
---|
| 295 |
|
---|
| 296 | /* If PAT is empty, skip the loop, but return one (empty) filename. */
|
---|
| 297 | if (pat == 0 || *pat == '\0')
|
---|
| 298 | @@ -546,6 +547,8 @@
|
---|
| 299 | firstmalloc = 0;
|
---|
| 300 | tmplink = lastlink;
|
---|
| 301 | }
|
---|
| 302 | + else
|
---|
| 303 | + tmplink = 0;
|
---|
| 304 | free (lastlink->name);
|
---|
| 305 | lastlink = lastlink->next;
|
---|
| 306 | FREE (tmplink);
|
---|
| 307 | diff -Naur bash-3.1.orig/lib/glob/sm_loop.c bash-3.1/lib/glob/sm_loop.c
|
---|
| 308 | --- bash-3.1.orig/lib/glob/sm_loop.c 2005-10-16 21:21:04.000000000 -0400
|
---|
| 309 | +++ bash-3.1/lib/glob/sm_loop.c 2006-04-11 11:37:09.500914295 -0400
|
---|
| 310 | @@ -638,12 +638,13 @@
|
---|
| 311 | CHAR *psub; /* pointer to sub-pattern */
|
---|
| 312 | CHAR *pnext; /* pointer to next sub-pattern */
|
---|
| 313 | CHAR *srest; /* pointer to rest of string */
|
---|
| 314 | - int m1, m2;
|
---|
| 315 | + int m1, m2, xflags; /* xflags = flags passed to recursive matches */
|
---|
| 316 |
|
---|
| 317 | #if DEBUG_MATCHING
|
---|
| 318 | fprintf(stderr, "extmatch: xc = %c\n", xc);
|
---|
| 319 | fprintf(stderr, "extmatch: s = %s; se = %s\n", s, se);
|
---|
| 320 | fprintf(stderr, "extmatch: p = %s; pe = %s\n", p, pe);
|
---|
| 321 | +fprintf(stderr, "extmatch: flags = %d\n", flags);
|
---|
| 322 | #endif
|
---|
| 323 |
|
---|
| 324 | prest = PATSCAN (p + (*p == L('(')), pe, 0); /* ) */
|
---|
| 325 | @@ -677,8 +678,12 @@
|
---|
| 326 | string matches the rest of the pattern. Also handle
|
---|
| 327 | multiple matches of the pattern. */
|
---|
| 328 | if (m1)
|
---|
| 329 | - m2 = (GMATCH (srest, se, prest, pe, flags) == 0) ||
|
---|
| 330 | - (s != srest && GMATCH (srest, se, p - 1, pe, flags) == 0);
|
---|
| 331 | + {
|
---|
| 332 | + /* if srest > s, we are not at start of string */
|
---|
| 333 | + xflags = (srest > s) ? (flags & ~FNM_PERIOD) : flags;
|
---|
| 334 | + m2 = (GMATCH (srest, se, prest, pe, xflags) == 0) ||
|
---|
| 335 | + (s != srest && GMATCH (srest, se, p - 1, pe, xflags) == 0);
|
---|
| 336 | + }
|
---|
| 337 | if (m1 && m2)
|
---|
| 338 | return (0);
|
---|
| 339 | }
|
---|
| 340 | @@ -704,8 +709,10 @@
|
---|
| 341 | srest = (prest == pe) ? se : s;
|
---|
| 342 | for ( ; srest <= se; srest++)
|
---|
| 343 | {
|
---|
| 344 | + /* if srest > s, we are not at start of string */
|
---|
| 345 | + xflags = (srest > s) ? (flags & ~FNM_PERIOD) : flags;
|
---|
| 346 | if (GMATCH (s, srest, psub, pnext - 1, flags) == 0 &&
|
---|
| 347 | - GMATCH (srest, se, prest, pe, flags) == 0)
|
---|
| 348 | + GMATCH (srest, se, prest, pe, xflags) == 0)
|
---|
| 349 | return (0);
|
---|
| 350 | }
|
---|
| 351 | if (pnext == prest)
|
---|
| 352 | @@ -726,7 +733,9 @@
|
---|
| 353 | if (pnext == prest)
|
---|
| 354 | break;
|
---|
| 355 | }
|
---|
| 356 | - if (m1 == 0 && GMATCH (srest, se, prest, pe, flags) == 0)
|
---|
| 357 | + /* if srest > s, we are not at start of string */
|
---|
| 358 | + xflags = (srest > s) ? (flags & ~FNM_PERIOD) : flags;
|
---|
| 359 | + if (m1 == 0 && GMATCH (srest, se, prest, pe, xflags) == 0)
|
---|
| 360 | return (0);
|
---|
| 361 | }
|
---|
| 362 | return (FNM_NOMATCH);
|
---|
[69cde8d] | 363 | diff -Naur bash-3.1.orig/lib/readline/display.c bash-3.1/lib/readline/display.c
|
---|
[cf468ea] | 364 | --- bash-3.1.orig/lib/readline/display.c 2005-11-30 14:05:02.000000000 -0500
|
---|
| 365 | +++ bash-3.1/lib/readline/display.c 2006-04-11 11:36:54.716391815 -0400
|
---|
[69cde8d] | 366 | @@ -1983,11 +1983,15 @@
|
---|
| 367 | int pchar;
|
---|
| 368 | {
|
---|
| 369 | int len;
|
---|
| 370 | - char *pmt;
|
---|
| 371 | + char *pmt, *p;
|
---|
| 372 |
|
---|
| 373 | rl_save_prompt ();
|
---|
| 374 |
|
---|
| 375 | - if (saved_local_prompt == 0)
|
---|
| 376 | + /* We've saved the prompt, and can do anything with the various prompt
|
---|
| 377 | + strings we need before they're restored. We want the unexpanded
|
---|
| 378 | + portion of the prompt string after any final newline. */
|
---|
| 379 | + p = rl_prompt ? strrchr (rl_prompt, '\n') : 0;
|
---|
| 380 | + if (p == 0)
|
---|
| 381 | {
|
---|
| 382 | len = (rl_prompt && *rl_prompt) ? strlen (rl_prompt) : 0;
|
---|
| 383 | pmt = (char *)xmalloc (len + 2);
|
---|
| 384 | @@ -1998,19 +2002,17 @@
|
---|
| 385 | }
|
---|
| 386 | else
|
---|
| 387 | {
|
---|
| 388 | - len = *saved_local_prompt ? strlen (saved_local_prompt) : 0;
|
---|
| 389 | + p++;
|
---|
| 390 | + len = strlen (p);
|
---|
| 391 | pmt = (char *)xmalloc (len + 2);
|
---|
| 392 | if (len)
|
---|
| 393 | - strcpy (pmt, saved_local_prompt);
|
---|
| 394 | + strcpy (pmt, p);
|
---|
| 395 | pmt[len] = pchar;
|
---|
| 396 | pmt[len+1] = '\0';
|
---|
| 397 | - local_prompt = savestring (pmt);
|
---|
| 398 | - prompt_last_invisible = saved_last_invisible;
|
---|
| 399 | - prompt_visible_length = saved_visible_length + 1;
|
---|
| 400 | - }
|
---|
| 401 | + }
|
---|
| 402 |
|
---|
| 403 | + /* will be overwritten by expand_prompt, called from rl_message */
|
---|
| 404 | prompt_physical_chars = saved_physical_chars + 1;
|
---|
| 405 | -
|
---|
| 406 | return pmt;
|
---|
| 407 | }
|
---|
| 408 |
|
---|
| 409 | diff -Naur bash-3.1.orig/lib/readline/readline.c bash-3.1/lib/readline/readline.c
|
---|
[cf468ea] | 410 | --- bash-3.1.orig/lib/readline/readline.c 2005-07-04 22:29:35.000000000 -0400
|
---|
| 411 | +++ bash-3.1/lib/readline/readline.c 2006-04-11 11:36:54.717391715 -0400
|
---|
[69cde8d] | 412 | @@ -282,6 +282,7 @@
|
---|
| 413 | {
|
---|
| 414 | FREE (rl_prompt);
|
---|
| 415 | rl_prompt = prompt ? savestring (prompt) : (char *)NULL;
|
---|
| 416 | + rl_display_prompt = rl_prompt ? rl_prompt : "";
|
---|
| 417 |
|
---|
| 418 | rl_visible_prompt_length = rl_expand_prompt (rl_prompt);
|
---|
| 419 | return 0;
|
---|
| 420 | diff -Naur bash-3.1.orig/lib/readline/terminal.c bash-3.1/lib/readline/terminal.c
|
---|
[cf468ea] | 421 | --- bash-3.1.orig/lib/readline/terminal.c 2005-11-12 20:46:54.000000000 -0500
|
---|
| 422 | +++ bash-3.1/lib/readline/terminal.c 2006-04-11 11:36:54.718391615 -0400
|
---|
[69cde8d] | 423 | @@ -122,7 +122,7 @@
|
---|
| 424 | static char *_rl_visible_bell;
|
---|
| 425 |
|
---|
| 426 | /* Non-zero means the terminal can auto-wrap lines. */
|
---|
| 427 | -int _rl_term_autowrap;
|
---|
| 428 | +int _rl_term_autowrap = -1;
|
---|
| 429 |
|
---|
| 430 | /* Non-zero means that this terminal has a meta key. */
|
---|
| 431 | static int term_has_meta;
|
---|
| 432 | @@ -274,6 +274,9 @@
|
---|
| 433 | _rl_set_screen_size (rows, cols)
|
---|
| 434 | int rows, cols;
|
---|
| 435 | {
|
---|
| 436 | + if (_rl_term_autowrap == -1)
|
---|
| 437 | + _rl_init_terminal_io (rl_terminal_name);
|
---|
| 438 | +
|
---|
| 439 | if (rows > 0)
|
---|
| 440 | _rl_screenheight = rows;
|
---|
| 441 | if (cols > 0)
|
---|
| 442 | diff -Naur bash-3.1.orig/parse.y bash-3.1/parse.y
|
---|
[cf468ea] | 443 | --- bash-3.1.orig/parse.y 2005-11-11 23:14:18.000000000 -0500
|
---|
| 444 | +++ bash-3.1/parse.y 2006-04-11 11:36:54.722391216 -0400
|
---|
[69cde8d] | 445 | @@ -2716,6 +2716,7 @@
|
---|
| 446 | #define P_ALLOWESC 0x02
|
---|
| 447 | #define P_DQUOTE 0x04
|
---|
| 448 | #define P_COMMAND 0x08 /* parsing a command, so look for comments */
|
---|
| 449 | +#define P_BACKQUOTE 0x10 /* parsing a backquoted command substitution */
|
---|
| 450 |
|
---|
| 451 | static char matched_pair_error;
|
---|
| 452 | static char *
|
---|
| 453 | @@ -2725,12 +2726,12 @@
|
---|
| 454 | int *lenp, flags;
|
---|
| 455 | {
|
---|
| 456 | int count, ch, was_dollar, in_comment, check_comment;
|
---|
| 457 | - int pass_next_character, nestlen, ttranslen, start_lineno;
|
---|
| 458 | + int pass_next_character, backq_backslash, nestlen, ttranslen, start_lineno;
|
---|
| 459 | char *ret, *nestret, *ttrans;
|
---|
| 460 | int retind, retsize, rflags;
|
---|
| 461 |
|
---|
| 462 | count = 1;
|
---|
| 463 | - pass_next_character = was_dollar = in_comment = 0;
|
---|
| 464 | + pass_next_character = backq_backslash = was_dollar = in_comment = 0;
|
---|
| 465 | check_comment = (flags & P_COMMAND) && qc != '\'' && qc != '"' && (flags & P_DQUOTE) == 0;
|
---|
| 466 |
|
---|
| 467 | /* RFLAGS is the set of flags we want to pass to recursive calls. */
|
---|
| 468 | @@ -2742,11 +2743,8 @@
|
---|
| 469 | start_lineno = line_number;
|
---|
| 470 | while (count)
|
---|
| 471 | {
|
---|
| 472 | -#if 0
|
---|
| 473 | - ch = shell_getc ((qc != '\'' || (flags & P_ALLOWESC)) && pass_next_character == 0);
|
---|
| 474 | -#else
|
---|
| 475 | - ch = shell_getc (qc != '\'' && pass_next_character == 0);
|
---|
| 476 | -#endif
|
---|
| 477 | + ch = shell_getc (qc != '\'' && pass_next_character == 0 && backq_backslash == 0);
|
---|
| 478 | +
|
---|
| 479 | if (ch == EOF)
|
---|
| 480 | {
|
---|
| 481 | free (ret);
|
---|
| 482 | @@ -2771,9 +2769,16 @@
|
---|
| 483 | continue;
|
---|
| 484 | }
|
---|
| 485 | /* Not exactly right yet */
|
---|
| 486 | - else if (check_comment && in_comment == 0 && ch == '#' && (retind == 0 || ret[retind-1] == '\n' || whitespace (ret[retind -1])))
|
---|
| 487 | + else if MBTEST(check_comment && in_comment == 0 && ch == '#' && (retind == 0 || ret[retind-1] == '\n' || whitespace (ret[retind - 1])))
|
---|
| 488 | in_comment = 1;
|
---|
| 489 |
|
---|
| 490 | + /* last char was backslash inside backquoted command substitution */
|
---|
| 491 | + if (backq_backslash)
|
---|
| 492 | + {
|
---|
| 493 | + backq_backslash = 0;
|
---|
| 494 | + /* Placeholder for adding special characters */
|
---|
| 495 | + }
|
---|
| 496 | +
|
---|
| 497 | if (pass_next_character) /* last char was backslash */
|
---|
| 498 | {
|
---|
| 499 | pass_next_character = 0;
|
---|
| 500 | @@ -2814,6 +2819,8 @@
|
---|
| 501 | {
|
---|
| 502 | if MBTEST((flags & P_ALLOWESC) && ch == '\\')
|
---|
| 503 | pass_next_character++;
|
---|
| 504 | + else if MBTEST((flags & P_BACKQUOTE) && ch == '\\')
|
---|
| 505 | + backq_backslash++;
|
---|
| 506 | continue;
|
---|
| 507 | }
|
---|
| 508 |
|
---|
| 509 | @@ -2898,7 +2905,11 @@
|
---|
| 510 | }
|
---|
| 511 | else if MBTEST(qc == '`' && (ch == '"' || ch == '\'') && in_comment == 0)
|
---|
| 512 | {
|
---|
| 513 | - nestret = parse_matched_pair (0, ch, ch, &nestlen, rflags);
|
---|
| 514 | + /* Add P_BACKQUOTE so backslash quotes the next character and
|
---|
| 515 | + shell_getc does the right thing with \<newline>. We do this for
|
---|
| 516 | + a measure of backwards compatibility -- it's not strictly the
|
---|
| 517 | + right POSIX thing. */
|
---|
| 518 | + nestret = parse_matched_pair (0, ch, ch, &nestlen, rflags|P_BACKQUOTE);
|
---|
| 519 | goto add_nestret;
|
---|
| 520 | }
|
---|
| 521 | else if MBTEST(was_dollar && (ch == '(' || ch == '{' || ch == '[')) /* ) } ] */
|
---|
| 522 | @@ -2907,7 +2918,7 @@
|
---|
| 523 | if (open == ch) /* undo previous increment */
|
---|
| 524 | count--;
|
---|
| 525 | if (ch == '(') /* ) */
|
---|
| 526 | - nestret = parse_matched_pair (0, '(', ')', &nestlen, rflags);
|
---|
| 527 | + nestret = parse_matched_pair (0, '(', ')', &nestlen, rflags & ~P_DQUOTE);
|
---|
| 528 | else if (ch == '{') /* } */
|
---|
| 529 | nestret = parse_matched_pair (0, '{', '}', &nestlen, P_FIRSTCLOSE|rflags);
|
---|
| 530 | else if (ch == '[') /* ] */
|
---|
| 531 | @@ -3578,7 +3589,7 @@
|
---|
| 532 | FREE (ttok);
|
---|
| 533 | all_digit_token = 0;
|
---|
| 534 | compound_assignment = 1;
|
---|
| 535 | -#if 0
|
---|
| 536 | +#if 1
|
---|
| 537 | goto next_character;
|
---|
| 538 | #else
|
---|
| 539 | goto got_token; /* ksh93 seems to do this */
|
---|
| 540 | @@ -3695,7 +3706,9 @@
|
---|
| 541 | struct builtin *b;
|
---|
| 542 | b = builtin_address_internal (token, 0);
|
---|
| 543 | if (b && (b->flags & ASSIGNMENT_BUILTIN))
|
---|
| 544 | - parser_state |= PST_ASSIGNOK;
|
---|
| 545 | + parser_state |= PST_ASSIGNOK;
|
---|
| 546 | + else if (STREQ (token, "eval") || STREQ (token, "let"))
|
---|
| 547 | + parser_state |= PST_ASSIGNOK;
|
---|
| 548 | }
|
---|
| 549 |
|
---|
| 550 | yylval.word = the_word;
|
---|
| 551 | @@ -4686,18 +4699,21 @@
|
---|
| 552 | int *retlenp;
|
---|
| 553 | {
|
---|
| 554 | WORD_LIST *wl, *rl;
|
---|
| 555 | - int tok, orig_line_number, orig_token_size;
|
---|
| 556 | + int tok, orig_line_number, orig_token_size, orig_last_token, assignok;
|
---|
| 557 | char *saved_token, *ret;
|
---|
| 558 |
|
---|
| 559 | saved_token = token;
|
---|
| 560 | orig_token_size = token_buffer_size;
|
---|
| 561 | orig_line_number = line_number;
|
---|
| 562 | + orig_last_token = last_read_token;
|
---|
| 563 |
|
---|
| 564 | last_read_token = WORD; /* WORD to allow reserved words here */
|
---|
| 565 |
|
---|
| 566 | token = (char *)NULL;
|
---|
| 567 | token_buffer_size = 0;
|
---|
| 568 |
|
---|
| 569 | + assignok = parser_state&PST_ASSIGNOK; /* XXX */
|
---|
| 570 | +
|
---|
| 571 | wl = (WORD_LIST *)NULL; /* ( */
|
---|
| 572 | parser_state |= PST_COMPASSIGN;
|
---|
| 573 |
|
---|
| 574 | @@ -4740,7 +4756,7 @@
|
---|
| 575 | jump_to_top_level (DISCARD);
|
---|
| 576 | }
|
---|
| 577 |
|
---|
| 578 | - last_read_token = WORD;
|
---|
| 579 | + last_read_token = orig_last_token; /* XXX - was WORD? */
|
---|
| 580 | if (wl)
|
---|
| 581 | {
|
---|
| 582 | rl = REVERSE_LIST (wl, WORD_LIST *);
|
---|
| 583 | @@ -4752,6 +4768,10 @@
|
---|
| 584 |
|
---|
| 585 | if (retlenp)
|
---|
| 586 | *retlenp = (ret && *ret) ? strlen (ret) : 0;
|
---|
| 587 | +
|
---|
| 588 | + if (assignok)
|
---|
| 589 | + parser_state |= PST_ASSIGNOK;
|
---|
| 590 | +
|
---|
| 591 | return ret;
|
---|
| 592 | }
|
---|
| 593 |
|
---|
| 594 | diff -Naur bash-3.1.orig/patchlevel.h bash-3.1/patchlevel.h
|
---|
[cf468ea] | 595 | --- bash-3.1.orig/patchlevel.h 2005-07-20 13:58:20.000000000 -0400
|
---|
| 596 | +++ bash-3.1/patchlevel.h 2006-04-11 11:37:12.869577641 -0400
|
---|
[69cde8d] | 597 | @@ -25,6 +25,6 @@
|
---|
| 598 | regexp `^#define[ ]*PATCHLEVEL', since that's what support/mkversion.sh
|
---|
| 599 | looks for to find the patch level (for the sccs version string). */
|
---|
| 600 |
|
---|
| 601 | -#define PATCHLEVEL 0
|
---|
[cf468ea] | 602 | +#define PATCHLEVEL 16
|
---|
[69cde8d] | 603 |
|
---|
| 604 | #endif /* _PATCHLEVEL_H_ */
|
---|
| 605 | diff -Naur bash-3.1.orig/subst.c bash-3.1/subst.c
|
---|
[cf468ea] | 606 | --- bash-3.1.orig/subst.c 2005-10-24 09:51:13.000000000 -0400
|
---|
| 607 | +++ bash-3.1/subst.c 2006-04-11 11:36:54.727390716 -0400
|
---|
[69cde8d] | 608 | @@ -2187,7 +2187,7 @@
|
---|
| 609 | if (mklocal && variable_context)
|
---|
| 610 | {
|
---|
| 611 | v = find_variable (name);
|
---|
| 612 | - if (v == 0 || array_p (v) == 0)
|
---|
| 613 | + if (v == 0 || array_p (v) == 0 || v->context != variable_context)
|
---|
| 614 | v = make_local_array_variable (name);
|
---|
| 615 | v = assign_array_var_from_string (v, value, flags);
|
---|
| 616 | }
|
---|
| 617 | @@ -6795,6 +6795,12 @@
|
---|
| 618 | if (temp && *temp && t_index > 0)
|
---|
| 619 | {
|
---|
| 620 | temp1 = bash_tilde_expand (temp, tflag);
|
---|
| 621 | + if (temp1 && *temp1 == '~' && STREQ (temp, temp1))
|
---|
| 622 | + {
|
---|
| 623 | + FREE (temp);
|
---|
| 624 | + FREE (temp1);
|
---|
| 625 | + goto add_character; /* tilde expansion failed */
|
---|
| 626 | + }
|
---|
| 627 | free (temp);
|
---|
| 628 | temp = temp1;
|
---|
| 629 | sindex += t_index;
|
---|
| 630 | diff -Naur bash-3.1.orig/variables.c bash-3.1/variables.c
|
---|
[cf468ea] | 631 | --- bash-3.1.orig/variables.c 2005-11-12 21:22:37.000000000 -0500
|
---|
| 632 | +++ bash-3.1/variables.c 2006-04-11 11:36:54.731390316 -0400
|
---|
[69cde8d] | 633 | @@ -860,9 +860,11 @@
|
---|
| 634 | {
|
---|
| 635 | char val[INT_STRLEN_BOUND(int) + 1], *v;
|
---|
| 636 |
|
---|
| 637 | +#if defined (READLINE)
|
---|
| 638 | /* If we are currently assigning to LINES or COLUMNS, don't do anything. */
|
---|
| 639 | if (winsize_assignment)
|
---|
| 640 | return;
|
---|
| 641 | +#endif
|
---|
| 642 |
|
---|
| 643 | v = inttostr (lines, val, sizeof (val));
|
---|
| 644 | bind_variable ("LINES", v, 0);
|
---|