source:
patches/bash-4.4-branch_update-1.patch@
79bc757
Last change on this file since 79bc757 was 5344c0b, checked in by , 8 years ago | |
---|---|
|
|
File size: 16.2 KB |
-
bashline.c
Submitted By: William Harrington (kb0iic at cross-lfs dot org) Date: 05-03-2017 Initial Package Version: 4.4 Origin: Upstream Upstream Status: Applied Description: Contains all upstream patches up to 4.4-012 diff -Naur bash-4.4.orig/bashline.c bash-4.4/bashline.c
old new 142 142 static rl_icppfunc_t *save_directory_hook __P((void)); 143 143 static void restore_directory_hook __P((rl_icppfunc_t)); 144 144 145 static int directory_exists __P((const char * ));145 static int directory_exists __P((const char *, int)); 146 146 147 147 static void cleanup_expansion_error __P((void)); 148 148 static void maybe_make_readline_line __P((char *)); … … 3102 3102 rl_directory_rewrite_hook = hookf; 3103 3103 } 3104 3104 3105 /* Check whether not the (dequoted) version of DIRNAME, with any trailing slash3106 removed, exists. */3105 /* Check whether not DIRNAME, with any trailing slash removed, exists. If 3106 SHOULD_DEQUOTE is non-zero, we dequote the directory name first. */ 3107 3107 static int 3108 directory_exists (dirname )3108 directory_exists (dirname, should_dequote) 3109 3109 const char *dirname; 3110 int should_dequote; 3110 3111 { 3111 3112 char *new_dirname; 3112 3113 int dirlen, r; 3113 3114 struct stat sb; 3114 3115 3115 /* First, dequote the directory name */ 3116 new_dirname = bash_dequote_filename ((char *)dirname, rl_completion_quote_character); 3116 /* We save the string and chop the trailing slash because stat/lstat behave 3117 inconsistently if one is present. */ 3118 new_dirname = should_dequote ? bash_dequote_filename ((char *)dirname, rl_completion_quote_character) : savestring (dirname); 3117 3119 dirlen = STRLEN (new_dirname); 3118 3120 if (new_dirname[dirlen - 1] == '/') 3119 3121 new_dirname[dirlen - 1] = '\0'; … … 3145 3147 else if (t = mbschr (local_dirname, '`')) /* XXX */ 3146 3148 should_expand_dirname = '`'; 3147 3149 3148 if (should_expand_dirname && directory_exists (local_dirname ))3150 if (should_expand_dirname && directory_exists (local_dirname, 0)) 3149 3151 should_expand_dirname = 0; 3150 3152 3151 3153 if (should_expand_dirname) … … 3155 3157 have to worry about restoring this setting. */ 3156 3158 global_nounset = unbound_vars_is_error; 3157 3159 unbound_vars_is_error = 0; 3158 wl = expand_prompt_string (new_dirname, 0, W_NOCOMSUB|W_ COMPLETE); /* does the right thing */3160 wl = expand_prompt_string (new_dirname, 0, W_NOCOMSUB|W_NOPROCSUB|W_COMPLETE); /* does the right thing */ 3159 3161 unbound_vars_is_error = global_nounset; 3160 3162 if (wl) 3161 3163 { … … 3244 3246 should_expand_dirname = '`'; 3245 3247 } 3246 3248 3247 if (should_expand_dirname && directory_exists (local_dirname ))3249 if (should_expand_dirname && directory_exists (local_dirname, 1)) 3248 3250 should_expand_dirname = 0; 3249 3251 3250 3252 if (should_expand_dirname) 3251 3253 { 3252 3254 new_dirname = savestring (local_dirname); 3253 wl = expand_prompt_string (new_dirname, 0, W_NOCOMSUB|W_ COMPLETE); /* does the right thing */3255 wl = expand_prompt_string (new_dirname, 0, W_NOCOMSUB|W_NOPROCSUB|W_COMPLETE); /* does the right thing */ 3254 3256 if (wl) 3255 3257 { 3256 3258 *dirname = string_list (wl); -
builtins/evalstring.c
diff -Naur bash-4.4.orig/builtins/evalstring.c bash-4.4/builtins/evalstring.c
old new 104 104 running_trap == 0 && 105 105 *bash_input.location.string == '\0' && 106 106 command->type == cm_simple && 107 #if 0108 107 signal_is_trapped (EXIT_TRAP) == 0 && 109 108 signal_is_trapped (ERROR_TRAP) == 0 && 110 #else111 109 any_signals_trapped () < 0 && 112 #endif113 110 command->redirects == 0 && command->value.Simple->redirects == 0 && 114 111 ((command->flags & CMD_TIME_PIPELINE) == 0) && 115 112 ((command->flags & CMD_INVERT_RETURN) == 0)); -
builtins/pushd.def
diff -Naur bash-4.4.orig/builtins/pushd.def bash-4.4/builtins/pushd.def
old new 365 365 break; 366 366 } 367 367 368 if (which > directory_list_offset || ( directory_list_offset == 0 && which == 0))368 if (which > directory_list_offset || (which < -directory_list_offset) || (directory_list_offset == 0 && which == 0)) 369 369 { 370 370 pushd_error (directory_list_offset, which_word ? which_word : ""); 371 371 return (EXECUTION_FAILURE); … … 387 387 remove that directory from the list and shift the remainder 388 388 of the list into place. */ 389 389 i = (direction == '+') ? directory_list_offset - which : which; 390 if (i < 0 || i > directory_list_offset) 391 { 392 pushd_error (directory_list_offset, which_word ? which_word : ""); 393 return (EXECUTION_FAILURE); 394 } 390 395 free (pushd_directory_list[i]); 391 396 directory_list_offset--; 392 397 -
builtins/read.def
diff -Naur bash-4.4.orig/builtins/read.def bash-4.4/builtins/read.def
old new 181 181 WORD_LIST *list; 182 182 { 183 183 register char *varname; 184 int size, i, nr, pass_next, saw_escape, eof, opt, retval, code, print_ps2; 184 int size, nr, pass_next, saw_escape, eof, opt, retval, code, print_ps2; 185 volatile int i; 185 186 int input_is_tty, input_is_pipe, unbuffered_read, skip_ctlesc, skip_ctlnul; 186 187 int raw, edit, nchars, silent, have_timeout, ignore_delim, fd, lastsig, t_errno; 187 188 unsigned int tmsec, tmusec; -
bash-4.4
diff -Naur bash-4.4.orig/expr.c bash-4.4/expr.c
old new 578 578 rval = cval = explor (); 579 579 if (curtok == QUES) /* found conditional expr */ 580 580 { 581 readtok ();582 if (curtok == 0 || curtok == COL)583 evalerror (_("expression expected"));584 581 if (cval == 0) 585 582 { 586 583 set_noeval = 1; 587 584 noeval++; 588 585 } 589 586 587 readtok (); 588 if (curtok == 0 || curtok == COL) 589 evalerror (_("expression expected")); 590 590 591 val1 = EXP_HIGHEST (); 591 592 592 593 if (set_noeval) 593 594 noeval--; 594 595 if (curtok != COL) 595 596 evalerror (_("`:' expected for conditional expression")); 596 readtok (); 597 if (curtok == 0) 598 evalerror (_("expression expected")); 597 599 598 set_noeval = 0; 600 599 if (cval) 601 600 { … … 603 602 noeval++; 604 603 } 605 604 605 readtok (); 606 if (curtok == 0) 607 evalerror (_("expression expected")); 606 608 val2 = expcond (); 609 607 610 if (set_noeval) 608 611 noeval--; 609 612 rval = cval ? val1 : val2; -
bash-4.4
diff -Naur bash-4.4.orig/jobs.c bash-4.4/jobs.c
old new 453 453 discard_pipeline (disposer); 454 454 } 455 455 456 void 457 discard_last_procsub_child () 458 { 459 PROCESS *disposer; 460 sigset_t set, oset; 461 462 BLOCK_CHILD (set, oset); 463 disposer = last_procsub_child; 464 last_procsub_child = (PROCESS *)NULL; 465 UNBLOCK_CHILD (oset); 466 467 if (disposer) 468 discard_pipeline (disposer); 469 } 470 456 471 struct pipeline_saver * 457 472 alloc_pipeline_saver () 458 473 { -
bash-4.4
diff -Naur bash-4.4.orig/jobs.h bash-4.4/jobs.h
old new 190 190 extern void making_children __P((void)); 191 191 extern void stop_making_children __P((void)); 192 192 extern void cleanup_the_pipeline __P((void)); 193 extern void discard_last_procsub_child __P((void)); 193 194 extern void save_pipeline __P((int)); 194 195 extern PROCESS *restore_pipeline __P((int)); 195 196 extern void start_pipeline __P((void)); -
lib/glob/sm_loop.c
diff -Naur bash-4.4.orig/lib/glob/sm_loop.c bash-4.4/lib/glob/sm_loop.c
old new 330 330 for (pc = 0; p[pc]; pc++) 331 331 if (p[pc] == L('.') && p[pc+1] == L(']')) 332 332 break; 333 if (p[pc] == 0) 334 { 335 if (vp) 336 *vp = INVALID; 337 return (p + pc); 338 } 333 339 val = COLLSYM (p, pc); 334 340 if (vp) 335 341 *vp = val; … … 483 489 c = *p++; 484 490 c = FOLD (c); 485 491 492 if (c == L('\0')) 493 return ((test == L('[')) ? savep : (CHAR *)0); 494 486 495 if ((flags & FNM_PATHNAME) && c == L('/')) 487 496 /* [/] can never match when matching a pathname. */ 488 497 return (CHAR *)0; -
lib/readline/history.c
diff -Naur bash-4.4.orig/lib/readline/history.c bash-4.4/lib/readline/history.c
old new 57 57 /* How big to make the_history when we first allocate it. */ 58 58 #define DEFAULT_HISTORY_INITIAL_SIZE 502 59 59 60 #define MAX_HISTORY_INITIAL_SIZE 8192 61 60 62 /* The number of slots to increase the_history by. */ 61 63 #define DEFAULT_HISTORY_GROW_SIZE 50 62 64 … … 277 279 const char *string; 278 280 { 279 281 HIST_ENTRY *temp; 282 int new_length; 280 283 281 284 if (history_stifled && (history_length == history_max_entries)) 282 285 { … … 293 296 294 297 /* Copy the rest of the entries, moving down one slot. Copy includes 295 298 trailing NULL. */ 296 #if 0297 for (i = 0; i < history_length; i++)298 the_history[i] = the_history[i + 1];299 #else300 299 memmove (the_history, the_history + 1, history_length * sizeof (HIST_ENTRY *)); 301 #endif302 300 301 new_length = history_length; 303 302 history_base++; 304 303 } 305 304 else … … 307 306 if (history_size == 0) 308 307 { 309 308 if (history_stifled && history_max_entries > 0) 310 history_size = history_max_entries + 2; 309 history_size = (history_max_entries > MAX_HISTORY_INITIAL_SIZE) 310 ? MAX_HISTORY_INITIAL_SIZE 311 : history_max_entries + 2; 311 312 else 312 313 history_size = DEFAULT_HISTORY_INITIAL_SIZE; 313 314 the_history = (HIST_ENTRY **)xmalloc (history_size * sizeof (HIST_ENTRY *)); 314 history_length = 1;315 new_length = 1; 315 316 } 316 317 else 317 318 { … … 321 322 the_history = (HIST_ENTRY **) 322 323 xrealloc (the_history, history_size * sizeof (HIST_ENTRY *)); 323 324 } 324 history_length++;325 new_length = history_length + 1; 325 326 } 326 327 } 327 328 328 329 temp = alloc_history_entry ((char *)string, hist_inittime ()); 329 330 330 the_history[history_length] = (HIST_ENTRY *)NULL; 331 the_history[history_length - 1] = temp; 331 the_history[new_length] = (HIST_ENTRY *)NULL; 332 the_history[new_length - 1] = temp; 333 history_length = new_length; 332 334 } 333 335 334 336 /* Change the time stamp of the most recent history entry to STRING. */ -
patchlevel.h
diff -Naur bash-4.4.orig/patchlevel.h bash-4.4/patchlevel.h
old new 25 25 regexp `^#define[ ]*PATCHLEVEL', since that's what support/mkversion.sh 26 26 looks for to find the patch level (for the sccs version string). */ 27 27 28 #define PATCHLEVEL 028 #define PATCHLEVEL 12 29 29 30 30 #endif /* _PATCHLEVEL_H_ */ -
bash-4.4
diff -Naur bash-4.4.orig/sig.c bash-4.4/sig.c
old new 585 585 #if defined (JOB_CONTROL) 586 586 if (sig == SIGHUP && (interactive || (subshell_environment & (SUBSHELL_COMSUB|SUBSHELL_PROCSUB)))) 587 587 hangup_all_jobs (); 588 end_job_control (); 588 if ((subshell_environment & (SUBSHELL_COMSUB|SUBSHELL_PROCSUB)) == 0) 589 end_job_control (); 589 590 #endif /* JOB_CONTROL */ 590 591 591 592 #if defined (PROCESS_SUBSTITUTION) -
subst.c
diff -Naur bash-4.4.orig/subst.c bash-4.4/subst.c
old new 2825 2825 2826 2826 /* Parse a single word from STRING, using SEPARATORS to separate fields. 2827 2827 ENDPTR is set to the first character after the word. This is used by 2828 the `read' builtin. This is never called with SEPARATORS != $IFS; 2829 it should be simplified. 2828 the `read' builtin. 2829 2830 This is never called with SEPARATORS != $IFS, and takes advantage of that. 2830 2831 2831 2832 XXX - this function is very similar to list_string; they should be 2832 2833 combined - XXX */ 2834 2835 #define islocalsep(c) (local_cmap[(unsigned char)(c)] != 0) 2836 2833 2837 char * 2834 2838 get_word_from_string (stringp, separators, endptr) 2835 2839 char **stringp, *separators, **endptr; … … 2837 2841 register char *s; 2838 2842 char *current_word; 2839 2843 int sindex, sh_style_split, whitesep, xflags; 2844 unsigned char local_cmap[UCHAR_MAX+1]; /* really only need single-byte chars here */ 2840 2845 size_t slen; 2841 2846 2842 2847 if (!stringp || !*stringp || !**stringp) … … 2846 2851 separators[1] == '\t' && 2847 2852 separators[2] == '\n' && 2848 2853 separators[3] == '\0'; 2849 for (xflags = 0, s = ifs_value; s && *s; s++) 2854 memset (local_cmap, '\0', sizeof (local_cmap)); 2855 for (xflags = 0, s = separators; s && *s; s++) 2850 2856 { 2851 2857 if (*s == CTLESC) xflags |= SX_NOCTLESC; 2852 2858 if (*s == CTLNUL) xflags |= SX_NOESCCTLNUL; 2859 local_cmap[(unsigned char)*s] = 1; /* local charmap of separators */ 2853 2860 } 2854 2861 2855 2862 s = *stringp; 2856 2863 slen = 0; 2857 2864 2858 2865 /* Remove sequences of whitespace at the beginning of STRING, as 2859 long as those characters appear in IFS. */ 2860 if (sh_style_split || !separators || !*separators) 2866 long as those characters appear in SEPARATORS. This happens if 2867 SEPARATORS == $' \t\n' or if IFS is unset. */ 2868 if (sh_style_split || separators == 0) 2861 2869 { 2862 for (; *s && spctabnl (*s) && is ifs(*s); s++);2870 for (; *s && spctabnl (*s) && islocalsep (*s); s++); 2863 2871 2864 2872 /* If the string is nothing but whitespace, update it and return. */ 2865 2873 if (!*s) … … 2878 2886 2879 2887 This obeys the field splitting rules in Posix.2. */ 2880 2888 sindex = 0; 2881 /* Don't need string length in ADVANCE_CHAR or string_extract_verbatim2882 unless multibyte chars are possible.*/2883 slen = (MB_CUR_MAX > 1) ? STRLEN (s) : 1;2889 /* Don't need string length in ADVANCE_CHAR unless multibyte chars are 2890 possible, but need it in string_extract_verbatim for bounds checking */ 2891 slen = STRLEN (s); 2884 2892 current_word = string_extract_verbatim (s, slen, &sindex, separators, xflags); 2885 2893 2886 2894 /* Set ENDPTR to the first character after the end of the word. */ … … 2899 2907 2900 2908 /* Now skip sequences of space, tab, or newline characters if they are 2901 2909 in the list of separators. */ 2902 while (s[sindex] && spctabnl (s[sindex]) && is ifs(s[sindex]))2910 while (s[sindex] && spctabnl (s[sindex]) && islocalsep (s[sindex])) 2903 2911 sindex++; 2904 2912 2905 2913 /* If the first separator was IFS whitespace and the current character is 2906 2914 a non-whitespace IFS character, it should be part of the current field 2907 2915 delimiter, not a separate delimiter that would result in an empty field. 2908 2916 Look at POSIX.2, 3.6.5, (3)(b). */ 2909 if (s[sindex] && whitesep && is ifs(s[sindex]) && !spctabnl (s[sindex]))2917 if (s[sindex] && whitesep && islocalsep (s[sindex]) && !spctabnl (s[sindex])) 2910 2918 { 2911 2919 sindex++; 2912 2920 /* An IFS character that is not IFS white space, along with any adjacent 2913 2921 IFS white space, shall delimit a field. */ 2914 while (s[sindex] && spctabnl (s[sindex]) && is ifs(s[sindex]))2922 while (s[sindex] && spctabnl (s[sindex]) && islocalsep(s[sindex])) 2915 2923 sindex++; 2916 2924 } 2917 2925 … … 5808 5816 { 5809 5817 #if defined (JOB_CONTROL) 5810 5818 if (last_procsub_child) 5811 { 5812 discard_pipeline (last_procsub_child); 5813 last_procsub_child = (PROCESS *)NULL; 5814 } 5819 discard_last_procsub_child (); 5815 5820 last_procsub_child = restore_pipeline (0); 5816 5821 #endif 5817 5822 … … 5931 5936 char *istring, buf[128], *bufp, *s; 5932 5937 int istring_index, istring_size, c, tflag, skip_ctlesc, skip_ctlnul; 5933 5938 ssize_t bufn; 5939 int nullbyte; 5934 5940 5935 5941 istring = (char *)NULL; 5936 5942 istring_index = istring_size = bufn = tflag = 0; … … 5938 5944 for (skip_ctlesc = skip_ctlnul = 0, s = ifs_value; s && *s; s++) 5939 5945 skip_ctlesc |= *s == CTLESC, skip_ctlnul |= *s == CTLNUL; 5940 5946 5947 nullbyte = 0; 5948 5941 5949 /* Read the output of the command through the pipe. This may need to be 5942 5950 changed to understand multibyte characters in the future. */ 5943 5951 while (1) … … 5956 5964 if (c == 0) 5957 5965 { 5958 5966 #if 1 5959 internal_warning ("%s", _("command substitution: ignored null byte in input")); 5967 if (nullbyte == 0) 5968 { 5969 internal_warning ("%s", _("command substitution: ignored null byte in input")); 5970 nullbyte = 1; 5971 } 5960 5972 #endif 5961 5973 continue; 5962 5974 } … … 9454 9466 tword->flags |= word->flags & (W_ASSIGNARG|W_ASSIGNRHS); /* affects $@ */ 9455 9467 if (word->flags & W_COMPLETE) 9456 9468 tword->flags |= W_COMPLETE; /* for command substitutions */ 9469 if (word->flags & W_NOCOMSUB) 9470 tword->flags |= W_NOCOMSUB; 9471 if (word->flags & W_NOPROCSUB) 9472 tword->flags |= W_NOPROCSUB; 9457 9473 9458 9474 temp = (char *)NULL; 9459 9475
Note:
See TracBrowser
for help on using the repository browser.