diff --git a/CWRU/CWRU.chlog b/CWRU/CWRU.chlog index 6e696404..3b314444 100644 --- a/CWRU/CWRU.chlog +++ b/CWRU/CWRU.chlog @@ -9514,3 +9514,48 @@ examples/loadables/Makefile.in an example - uninstall-supported,uninistall-unsupported: uninstall targets, make uninstall chooses one based on $(SHOBJ_STATUS) + + 8/31 + ---- +lib/glob/Makefile.in + - CPPFLAGS: move after ${INCLUDES} so library-specific include paths + take precedence. This is what the other parts of the shell do. + Report from Poor Yorick + +builtins/read.def + - reset_alarm: cancel alarm before restoring signal handler to avoid + possible race condition. Report and fix from Oleg Popov + + +subst.c + - string_extract_verbatim: if SEPARATORS is "'", don't short-circuit + to string_extract_single_quoted unless the SX_NOCTLESC flag is set. + Callers expect this function to honor CTLESC, even to quote a single + quote. Fixes bug reported by isabella parakiss + and several others + + 9/2 + --- +include/chartypes.h + - TOCTRL: handle '?' by special-casing it to 0x7f. Fixes a problem + with $'\c?' reported by Helmut Karlowski + +redir.c + - write_here_string: don't word-split the here string document. The + bash documentation has always said this doesn't happen, even though + bash has done so for years, and other shells that implement here- + strings don't perform any word splitting. The practical effect is + that sequences of IFS characters are collapsed to spaces. Fixes + bug reported by Clint Hepner + + 9/3 + --- +doc/{bash.1,bashref.texi} + - add \? to the list of backslash escapes expanded by $'...' ANSI-C + quoting. It was expanded but not documented + +lib/readline/util.c + - _rl_audit_tty: updated from Red Hat patch + +lib/readline/readline.c + - HAVE_DECL_AUDIT_USER_TTY: correct #define check diff --git a/MANIFEST b/MANIFEST index 9dcf1b34..70ebed7f 100644 --- a/MANIFEST +++ b/MANIFEST @@ -915,6 +915,7 @@ tests/dollar-at-star2.sub f tests/dollar-at-star3.sub f tests/dollar-at-star4.sub f tests/dollar-at-star5.sub f +tests/dollar-at-star6.sub f tests/dollar-at1.sub f tests/dollar-at2.sub f tests/dollar-at3.sub f @@ -1010,6 +1011,7 @@ tests/heredoc2.sub f tests/heredoc3.sub f tests/herestr.tests f tests/herestr.right f +tests/herestr1.sub f tests/histexp.tests f tests/histexp1.sub f tests/histexp.right f diff --git a/builtins/read.def b/builtins/read.def index 7f8243a9..75a0b13e 100644 --- a/builtins/read.def +++ b/builtins/read.def @@ -165,8 +165,9 @@ sigalrm (s) static void reset_alarm () { - set_signal_handler (SIGALRM, old_alrm); + /* Cancel alarm before restoring signal handler. */ falarm (0, 0); + set_signal_handler (SIGALRM, old_alrm); } /* Read the value of the shell variables whose names follow. diff --git a/doc/bash.1 b/doc/bash.1 index 8399e839..3587414f 100644 --- a/doc/bash.1 +++ b/doc/bash.1 @@ -5,12 +5,12 @@ .\" Case Western Reserve University .\" chet.ramey@case.edu .\" -.\" Last Change: Sat Aug 15 15:17:33 EDT 2015 +.\" Last Change: Thu Sep 3 15:09:13 EDT 2015 .\" .\" bash_builtins, strip all but Built-Ins section .if \n(zZ=1 .ig zZ .if \n(zY=1 .ig zY -.TH BASH 1 "2015 August 15" "GNU Bash 4.4" +.TH BASH 1 "2015 September 3" "GNU Bash 4.4" .\" .\" There's some problem with having a `@' .\" in a tagged paragraph with the BSD man macros. @@ -1135,6 +1135,9 @@ single quote .B \e\(dq double quote .TP +.B \e? +question mark +.TP .B \e\fInnn\fP the eight-bit character whose value is the octal value \fInnn\fP (one to three digits) diff --git a/doc/bashref.texi b/doc/bashref.texi index 2c321d66..55914043 100644 --- a/doc/bashref.texi +++ b/doc/bashref.texi @@ -500,6 +500,8 @@ backslash single quote @item \" double quote +@item \? +question mark @item \@var{nnn} the eight-bit character whose value is the octal value @var{nnn} (one to three digits) diff --git a/doc/version.texi b/doc/version.texi index 182402bf..a2d3c499 100644 --- a/doc/version.texi +++ b/doc/version.texi @@ -2,10 +2,10 @@ Copyright (C) 1988-2015 Free Software Foundation, Inc. @end ignore -@set LASTCHANGE Sat Aug 15 15:17:52 EDT 2015 +@set LASTCHANGE Thu Sep 3 15:09:13 EDT 2015 @set EDITION 4.4 @set VERSION 4.4 -@set UPDATED 15 August 2015 -@set UPDATED-MONTH August 2015 +@set UPDATED 3 September 2015 +@set UPDATED-MONTH September 2015 diff --git a/include/chartypes.h b/include/chartypes.h index 0333f944..098cfb96 100644 --- a/include/chartypes.h +++ b/include/chartypes.h @@ -103,7 +103,7 @@ #ifndef TOCTRL /* letter to control char -- ASCII. The TOUPPER is in there so \ce and \cE will map to the same character in $'...' expansions. */ -# define TOCTRL(x) (TOUPPER(x) & 037) +# define TOCTRL(x) ((x) == '?' ? 0x7f : (TOUPPER(x) & 0x1f)) #endif #ifndef UNCTRL /* control char to letter -- ASCII */ diff --git a/lib/glob/Makefile.in b/lib/glob/Makefile.in index 7af743ad..23bf8c8b 100644 --- a/lib/glob/Makefile.in +++ b/lib/glob/Makefile.in @@ -52,7 +52,7 @@ BASHINCDIR = ${topdir}/include INCLUDES = -I. -I../.. -I$(topdir) -I$(BASHINCDIR) -I$(topdir)/lib -CCFLAGS = $(PROFILE_FLAGS) $(DEFS) $(LOCAL_DEFS) $(CPPFLAGS) ${INCLUDES} \ +CCFLAGS = $(PROFILE_FLAGS) $(DEFS) $(LOCAL_DEFS) ${INCLUDES} $(CPPFLAGS) \ $(LOCAL_CFLAGS) $(CFLAGS) # Here is a rule for making .o files from .c files that doesn't force diff --git a/lib/readline/readline.c b/lib/readline/readline.c index 71f666ce..332b8cb8 100644 --- a/lib/readline/readline.c +++ b/lib/readline/readline.c @@ -386,7 +386,7 @@ readline (prompt) RL_SETSTATE (RL_STATE_CALLBACK); #endif -#if HAVE_DECL_AUDIT_TTY && defined (ENABLE_TTY_AUDIT_SUPPORT) +#if HAVE_DECL_AUDIT_USER_TTY && defined (ENABLE_TTY_AUDIT_SUPPORT) if (value) _rl_audit_tty (value); #endif diff --git a/lib/readline/util.c b/lib/readline/util.c index e75e2556..b253f08c 100644 --- a/lib/readline/util.c +++ b/lib/readline/util.c @@ -551,6 +551,7 @@ _rl_settracefp (fp) #if HAVE_DECL_AUDIT_USER_TTY && defined (ENABLE_TTY_AUDIT_SUPPORT) #include +#include #include #include @@ -559,42 +560,33 @@ void _rl_audit_tty (string) char *string; { + struct audit_message req; struct sockaddr_nl addr; - struct msghdr msg; - struct nlmsghdr nlm; - struct iovec iov[2]; size_t size; int fd; - fd = socket (AF_NETLINK, SOCK_RAW, NETLINK_AUDIT); + fd = socket (PF_NETLINK, SOCK_RAW, NETLINK_AUDIT); if (fd < 0) return; size = strlen (string) + 1; - nlm.nlmsg_len = NLMSG_LENGTH (size); - nlm.nlmsg_type = AUDIT_USER_TTY; - nlm.nlmsg_flags = NLM_F_REQUEST; - nlm.nlmsg_seq = 0; - nlm.nlmsg_pid = 0; + if (NLMSG_SPACE (size) > MAX_AUDIT_MESSAGE_LENGTH) + return; - iov[0].iov_base = &nlm; - iov[0].iov_len = sizeof (nlm); - iov[1].iov_base = string; - iov[1].iov_len = size; + memset (&req, 0, sizeof(req)); + req.nlh.nlmsg_len = NLMSG_SPACE (size); + req.nlh.nlmsg_type = AUDIT_USER_TTY; + req.nlh.nlmsg_flags = NLM_F_REQUEST; + req.nlh.nlmsg_seq = 0; + if (size && string) + memcpy (NLMSG_DATA(&req.nlh), string, size); + memset (&addr, 0, sizeof(addr)); addr.nl_family = AF_NETLINK; addr.nl_pid = 0; addr.nl_groups = 0; - msg.msg_name = &addr; - msg.msg_namelen = sizeof (addr); - msg.msg_iov = iov; - msg.msg_iovlen = 2; - msg.msg_control = NULL; - msg.msg_controllen = 0; - msg.msg_flags = 0; - - (void)sendmsg (fd, &msg, 0); + sendto (fd, &req, req.nlh.nlmsg_len, 0, (struct sockaddr*)&addr, sizeof(addr)); close (fd); } #endif diff --git a/redir.c b/redir.c index 63801548..0f40bd00 100644 --- a/redir.c +++ b/redir.c @@ -1,6 +1,6 @@ /* redir.c -- Functions to perform input and output redirection. */ -/* Copyright (C) 1997-2012 Free Software Foundation, Inc. +/* Copyright (C) 1997-2015 Free Software Foundation, Inc. This file is part of GNU Bash, the Bourne Again SHell. @@ -325,7 +325,7 @@ write_here_string (fd, redirectee) /* Now that we've changed the variable search order to ignore the temp environment, see if we need to change the cached IFS values. */ sv_ifs ("IFS"); - herestr = expand_string_to_string (redirectee->word, 0); + herestr = expand_string_unsplit_to_string (redirectee->word, 0); expanding_redir = 0; /* Now we need to change the variable search order back to include the temp environment. We force the temp environment search by forcing diff --git a/subst.c b/subst.c index 5a0e3574..5df5a5ed 100644 --- a/subst.c +++ b/subst.c @@ -1100,7 +1100,7 @@ string_extract_verbatim (string, slen, sindex, charlist, flags) char *temp; DECLARE_MBSTATE; - if (charlist[0] == '\'' && charlist[1] == '\0') + if ((flags & SX_NOCTLESC) && charlist[0] == '\'' && charlist[1] == '\0') { temp = string_extract_single_quoted (string, sindex); --*sindex; /* leave *sindex at separator character */ diff --git a/tests/dollar-at-star b/tests/dollar-at-star index 611c5c10..70daf4de 100755 --- a/tests/dollar-at-star +++ b/tests/dollar-at-star @@ -217,6 +217,7 @@ ${THIS_SH} ./dollar-at-star2.sub ${THIS_SH} ./dollar-at-star3.sub ${THIS_SH} ./dollar-at-star4.sub ${THIS_SH} ./dollar-at-star5.sub +${THIS_SH} ./dollar-at-star6.sub # tests for special expansion of "$*" and "${array[*]}" when used with other # expansions -- bugs through bash-2.05b diff --git a/tests/dollar-at-star6.sub b/tests/dollar-at-star6.sub new file mode 100644 index 00000000..7366df50 --- /dev/null +++ b/tests/dollar-at-star6.sub @@ -0,0 +1,29 @@ +OIFS="$IFS" +arr=(a b c) + +recho ${arr[@]@Q} +recho "${arr[@]@Q}" + +IFS="'" +recho ${arr[@]@Q} +recho "${arr[@]@Q}" +IFS="$OIFS" + +arr=("'a'" "'b'" "'c'") + +IFS="'" +recho ${arr[@]} +recho "${arr[@]}" +IFS="$OIFS" + +IFS="'" +a="'a'" +recho $a +recho "$a" +IFS="$OIFS" + +set -- "'a'" "'b'" "'c'" + +IFS="'" +recho "${@}" +recho "$@" diff --git a/tests/dollar.right b/tests/dollar.right index 689f550d..4729ecda 100644 --- a/tests/dollar.right +++ b/tests/dollar.right @@ -229,6 +229,43 @@ argv[1] = <> variable argv[1] = <> dollar-at +argv[1] = <'a'> +argv[2] = <'b'> +argv[3] = <'c'> +argv[1] = <'a'> +argv[2] = <'b'> +argv[3] = <'c'> +argv[1] = <> +argv[2] = +argv[3] = <> +argv[4] = <> +argv[5] = +argv[6] = <> +argv[7] = <> +argv[8] = +argv[1] = <'a'> +argv[2] = <'b'> +argv[3] = <'c'> +argv[1] = <> +argv[2] = +argv[3] = <> +argv[4] = <> +argv[5] = +argv[6] = <> +argv[7] = <> +argv[8] = +argv[1] = <'a'> +argv[2] = <'b'> +argv[3] = <'c'> +argv[1] = <> +argv[2] = +argv[1] = <'a'> +argv[1] = <'a'> +argv[2] = <'b'> +argv[3] = <'c'> +argv[1] = <'a'> +argv[2] = <'b'> +argv[3] = <'c'> xa|xb|xc xa|xb|xc a|b|c diff --git a/tests/herestr.right b/tests/herestr.right index 473e1234..096dda11 100644 --- a/tests/herestr.right +++ b/tests/herestr.right @@ -26,3 +26,7 @@ echo ho echo off to work we go declare -a uu=([0]="" [1]="kghfjk" [2]="jkfzuk" [3]="i ") +foo bar +foo bar +qux:::::bax +qux:::::bax diff --git a/tests/herestr.tests b/tests/herestr.tests index f77b229f..607f85ee 100644 --- a/tests/herestr.tests +++ b/tests/herestr.tests @@ -37,3 +37,5 @@ cat <<< "echo $(echo off to work we go)" IFS="/" read -r -d $'\000' -a uu <<< /kghfjk/jkfzuk/i declare -p uu + +${THIS_SH} ./herestr1.sub diff --git a/tests/herestr1.sub b/tests/herestr1.sub new file mode 100644 index 00000000..0cf80828 --- /dev/null +++ b/tests/herestr1.sub @@ -0,0 +1,10 @@ +# problems with word splitting unquoted here-strings present since bash-3.2 + +x="foo bar" +cat <<< $x # Word-splitting appears to collapse the run of whitespace +cat <<< "$x" # Whitespace preserved, as with here doc + +x="qux:::::bax" +IFS=':' +cat <<< $x # Word-splitting appears to collapse the run of whitespace +cat <<< "$x" # Whitespace preserved, as with here doc