diff --git a/CWRU/CWRU.chlog b/CWRU/CWRU.chlog index 7717fe3f..6cd92744 100644 --- a/CWRU/CWRU.chlog +++ b/CWRU/CWRU.chlog @@ -11580,3 +11580,24 @@ arrayfunc.[ch] array_value_internal,array_value,get_array_value: first argument (always variable name) now a `const char *' Fix from Mike Frysinger + + 8/19 + ---- +print_cmd.c + - xtrace_print_word_list: if (xtflags & 2), don't try to quote the words in + the LIST argument. Intended to be used in places where the list has not + yet been expanded + - xtrace_print_for_command_head: call xtrace_print_word_list with flags argument + of 2. Fixes issue reported by Aharon Robbins + - xtrace_print_select_command_head: call xtrace_print_word_list with flags + argument of 2 + + 8/21 + ---- +lib/sh/netopen.c + - netopen: fix memory leak by freeing allocated path before error + return. Fix from Dmitry Goncharov + +doc/{bash.1,bashref.texi} + - change conditional commands description to make it clearer that + bash doesn't emulate /dev/fd if the OS provides it diff --git a/MANIFEST b/MANIFEST index 5c6d0bcf..a44b2012 100644 --- a/MANIFEST +++ b/MANIFEST @@ -609,6 +609,7 @@ doc/bash.pdf f doc/bashref.pdf f doc/rose94.pdf f doc/aosa-bash.pdf f +doc/aosa-bash-full.pdf f # support/Makefile.in f support/bash.pc.in f diff --git a/doc/aosa-bash-full.pdf b/doc/aosa-bash-full.pdf new file mode 100644 index 00000000..01815492 Binary files /dev/null and b/doc/aosa-bash-full.pdf differ diff --git a/doc/bash.1 b/doc/bash.1 index b483f89c..62ba8db7 100644 --- a/doc/bash.1 +++ b/doc/bash.1 @@ -5,12 +5,12 @@ .\" Case Western Reserve University .\" chet.ramey@case.edu .\" -.\" Last Change: Sun May 29 13:48:21 EDT 2016 +.\" Last Change: Sun Aug 21 14:47:11 EDT 2016 .\" .\" bash_builtins, strip all but Built-Ins section .if \n(zZ=1 .ig zZ .if \n(zY=1 .ig zY -.TH BASH 1 "2016 May 29" "GNU Bash 4.4" +.TH BASH 1 "2016 August 21" "GNU Bash 4.4" .\" .\" There's some problem with having a `@' .\" in a tagged paragraph with the BSD man macros. @@ -4330,6 +4330,11 @@ Conditional expressions are used by the \fB[[\fP compound command and the \fBtest\fP and \fB[\fP builtin commands to test file attributes and perform string and arithmetic comparisons. Expressions are formed from the following unary or binary primaries. +\fBBash\fP handles several filenames specially when they are used in +expressions. +If the operating system on which \fBbash\fP is running provides these +special files, bash will use them; otherwise it will emulate them +internally with this behavior: If any \fIfile\fP argument to one of the primaries is of the form \fI/dev/fd/n\fP, then file descriptor \fIn\fP is checked. If the \fIfile\fP argument to one of the primaries is one of diff --git a/doc/bashref.texi b/doc/bashref.texi index 69d38d80..b950daa5 100644 --- a/doc/bashref.texi +++ b/doc/bashref.texi @@ -6617,6 +6617,11 @@ and the @code{test} and @code{[} builtin commands. Expressions may be unary or binary. Unary expressions are often used to examine the status of a file. There are string operators and numeric comparison operators as well. +Bash handles several filenames specially when they are used in +expressions. +If the operating system on which Bash is running provides these +special files, Bash will use them; otherwise it will emulate them +internally with this behavior: If the @var{file} argument to one of the primaries is of the form @file{/dev/fd/@var{N}}, then file descriptor @var{N} is checked. If the @var{file} argument to one of the primaries is one of diff --git a/doc/version.texi b/doc/version.texi index 429a155a..18d229f1 100644 --- a/doc/version.texi +++ b/doc/version.texi @@ -2,10 +2,10 @@ Copyright (C) 1988-2016 Free Software Foundation, Inc. @end ignore -@set LASTCHANGE Sun May 29 13:48:02 EDT 2016 +@set LASTCHANGE Sun Aug 21 14:48:56 EDT 2016 @set EDITION 4.4 @set VERSION 4.4 -@set UPDATED 29 May 2016 -@set UPDATED-MONTH May 2016 +@set UPDATED 21 August 2016 +@set UPDATED-MONTH August 2016 diff --git a/execute_cmd.c b/execute_cmd.c index c0260bf1..b01b2707 100644 --- a/execute_cmd.c +++ b/execute_cmd.c @@ -5488,7 +5488,8 @@ shell_execve (command, args, env) run it for some reason. See why. */ #if defined (HAVE_HASH_BANG_EXEC) READ_SAMPLE_BUF (command, sample, sample_len); - sample[sample_len - 1] = '\0'; + if (sample_len > 0) + sample[sample_len - 1] = '\0'; if (sample_len > 2 && sample[0] == '#' && sample[1] == '!') { char *interp; diff --git a/lib/sh/netopen.c b/lib/sh/netopen.c index 736d4138..bc3d8f8a 100644 --- a/lib/sh/netopen.c +++ b/lib/sh/netopen.c @@ -5,7 +5,7 @@ * chet@ins.CWRU.Edu */ -/* Copyright (C) 1987-2002 Free Software Foundation, Inc. +/* Copyright (C) 1987-2016 Free Software Foundation, Inc. This file is part of GNU Bash, the Bourne Again SHell. @@ -304,6 +304,7 @@ netopen (path) if (t == 0) { internal_error (_("%s: bad network path specification"), path); + free (np); return -1; } *t++ = '\0'; diff --git a/print_cmd.c b/print_cmd.c index 617501e4..5a1ec5f1 100644 --- a/print_cmd.c +++ b/print_cmd.c @@ -1,6 +1,6 @@ /* print_command -- A way to make readable commands from a command tree. */ -/* Copyright (C) 1989-2011 Free Software Foundation, Inc. +/* Copyright (C) 1989-2016 Free Software Foundation, Inc. This file is part of GNU Bash, the Bourne Again SHell. @@ -515,7 +515,11 @@ xtrace_print_assignment (name, value, assign_list, xflags) fflush (xtrace_fp); } -/* A function to print the words of a simple command when set -x is on. */ +/* A function to print the words of a simple command when set -x is on. Also + used to print the word list in a for or select command header; in that case, + we suppress quoting the words because they haven't been expanded yet. + XTFLAGS&1 means to print $PS4; XTFLAGS&2 means to suppress quoting the + words in LIST. */ void xtrace_print_word_list (list, xtflags) WORD_LIST *list; @@ -526,7 +530,7 @@ xtrace_print_word_list (list, xtflags) CHECK_XTRACE_FP; - if (xtflags) + if (xtflags&1) fprintf (xtrace_fp, "%s", indirection_level_string ()); for (w = list; w; w = w->next) @@ -534,6 +538,8 @@ xtrace_print_word_list (list, xtflags) t = w->word->word; if (t == 0 || *t == '\0') fprintf (xtrace_fp, "''%s", w->next ? " " : ""); + else if (xtflags & 2) + fprintf (xtrace_fp, "%s%s", t, w->next ? " " : ""); else if (sh_contains_shell_metas (t)) { x = sh_single_quote (t); @@ -576,7 +582,7 @@ xtrace_print_for_command_head (for_command) CHECK_XTRACE_FP; fprintf (xtrace_fp, "%s", indirection_level_string ()); fprintf (xtrace_fp, "for %s in ", for_command->name->word); - xtrace_print_word_list (for_command->map_list, 0); + xtrace_print_word_list (for_command->map_list, 2); } static void @@ -634,7 +640,7 @@ xtrace_print_select_command_head (select_command) CHECK_XTRACE_FP; fprintf (xtrace_fp, "%s", indirection_level_string ()); fprintf (xtrace_fp, "select %s in ", select_command->name->word); - xtrace_print_word_list (select_command->map_list, 0); + xtrace_print_word_list (select_command->map_list, 2); } static void diff --git a/tests/RUN-ONE-TEST b/tests/RUN-ONE-TEST index d29259a9..a5ab273d 100755 --- a/tests/RUN-ONE-TEST +++ b/tests/RUN-ONE-TEST @@ -1,4 +1,4 @@ -BUILD_DIR=/usr/local/build/chet/bash/bash-current +BUILD_DIR=/usr/local/build/bash/bash-current THIS_SH=$BUILD_DIR/bash PATH=$PATH:$BUILD_DIR