diff --git a/CWRU/CWRU.chlog b/CWRU/CWRU.chlog index 4ab72f6e..7f83559e 100644 --- a/CWRU/CWRU.chlog +++ b/CWRU/CWRU.chlog @@ -15252,4 +15252,20 @@ parse.y and CTLNUL in the input. Fixes bug with ^A in here document reported by Jorge Alberto Baca Garcia + 4/18 + ---- +pathexp.c + - quote_string_for_globbing: make sure the QGLOB_CTLESC code handles + both CTLESC CTLESC and CTLESC CTLNUL in the same way. Fixes bug + reported by Martijn Dekker + + 4/19 + ---- +execute_cmd.c + - execute_command_internal: before executing any command in the current + shell, and before copying any existing FIFO list, call + reap_procsubs to unlink or close any process substitution pipes + associated with processes that have exited. Fixes hang in test suite + when trying to open a FIFO with no process having it open for + reading diff --git a/execute_cmd.c b/execute_cmd.c index 5180c1ed..eadc836e 100644 --- a/execute_cmd.c +++ b/execute_cmd.c @@ -744,6 +744,10 @@ execute_command_internal (command, asynchronous, pipe_in, pipe_out, stdin_redir = stdin_redirects (command->redirects); #if defined (PROCESS_SUBSTITUTION) +# if !defined (HAVE_DEV_FD) + reap_procsubs (); +# endif + if (variable_context != 0) { ofifo = num_fifos (); @@ -3473,9 +3477,9 @@ execute_case_command (case_command) /* Convert quoted null strings into empty strings. */ qflags = QGLOB_CVTNULL; - /* We left CTLESC in place quoting CTLESC after the call to - expand_word_leave_quoted; tell quote_string_for_globbing to - remove those here. This works for both unquoted portions of + /* We left CTLESC in place quoting CTLESC and CTLNUL after the + call to expand_word_leave_quoted; tell quote_string_for_globbing + to remove those here. This works for both unquoted portions of the word (which call quote_escapes) and quoted portions (which call quote_string). */ qflags |= QGLOB_CTLESC; diff --git a/pathexp.c b/pathexp.c index 91e612d6..714e5ed3 100644 --- a/pathexp.c +++ b/pathexp.c @@ -205,7 +205,7 @@ quote_string_for_globbing (pathname, qflags) } /* If we are parsing regexp, turn CTLESC CTLESC into CTLESC. It's not an ERE special character, so we should just be able to pass it through. */ - else if ((qflags & (QGLOB_REGEXP|QGLOB_CTLESC)) && pathname[i] == CTLESC && pathname[i+1] == CTLESC) + else if ((qflags & (QGLOB_REGEXP|QGLOB_CTLESC)) && pathname[i] == CTLESC && (pathname[i+1] == CTLESC || pathname[i+1] == CTLNUL)) { i++; temp[j++] = pathname[i]; @@ -326,8 +326,8 @@ quote_string_for_globbing (pathname, qflags) break; /* If we are turning CTLESC CTLESC into CTLESC, we need to do that even when the first CTLESC is preceded by a backslash. */ - if ((qflags & QGLOB_CTLESC) && pathname[i] == CTLESC && pathname[i+1] == CTLESC) - i++; /* skip over one of the CTLESCs */ + if ((qflags & QGLOB_CTLESC) && pathname[i] == CTLESC && (pathname[i+1] == CTLESC || pathname[i+1] == CTLNUL)) + i++; /* skip over the CTLESC */ } else if (pathname[i] == '\\' && (qflags & QGLOB_REGEXP)) last_was_backslash = 1; diff --git a/subst.c b/subst.c index 1f364cf6..ec47dcc2 100644 --- a/subst.c +++ b/subst.c @@ -5392,7 +5392,7 @@ find_procsub_child (pid) int i; for (i = 0; i < nfifo; i++) - if ((fifo_list[i].proc == pid) + if (fifo_list[i].proc == pid) return i; return -1; } @@ -5422,7 +5422,7 @@ reap_procsubs () void wait_procsubs () { - int i; + int i, r; for (i = 0; i < nfifo; i++) { diff --git a/support/mkdep b/support/mkdep old mode 100755 new mode 100644 index a79c90a3..15fe14b0 --- a/support/mkdep +++ b/support/mkdep @@ -1,7 +1,5 @@ #!/bin/sh - # -# BSDI $Id: mkdep.gcc.sh,v 2.1 1995/02/03 12:54:13 polk Exp $ -# # Copyright (c) 1991, 1993 # The Regents of the University of California. All rights reserved. # @@ -13,10 +11,6 @@ # 2. Redistributions in binary form must reproduce the above copyright # notice, this list of conditions and the following disclaimer in the # documentation and/or other materials provided with the distribution. -# 3. All advertising materials mentioning features or use of this software -# must display the following acknowledgement: -# This product includes software developed by the University of -# California, Berkeley and its contributors. # 4. Neither the name of the University nor the names of its contributors # may be used to endorse or promote products derived from this software # without specific prior written permission. @@ -33,59 +27,72 @@ # OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF # SUCH DAMAGE. # -# @(#)mkdep.gcc.sh 8.1 (Berkeley) 6/6/93 +# $FreeBSD: stable/11/usr.bin/mkdep/mkdep.sh 216370 2010-12-11 08:32:16Z joel $ +# +# @(#)mkdep.sh 8.1 (Berkeley) 6/6/93 # -PATH=/bin:/usr/bin:/usr/gnu/bin:/usr/local/bin:/usr/local/bin/gnu +PATH=/bin:/usr/bin:/usr/ucb:/usr/old/bin export PATH -cpp=${CPP:-gcc} -#trad="-notraditional" - -D=depends # default dependency file is depends +D=.depend # default dependency file is .depend append=0 -pflag= -usage() -{ - echo 'usage: mkdep [-t] [-p] [-f depend_file] [-c compiler] [cc_flags] file ...' >&2 -} +while : + do case "$1" in + # -a appends to the depend file + -a) + append=1 + shift ;; -while getopts "2af:c:pt" opt; do - case "$opt" in - # -2 => gcc2 -- this option is temporary, hence not documented - 2) cpp=${CPP:-gcc2} ; trad= ;; - # -a appends to the depend file - a) append=1;; - # -c specifies the compiler to use - c) CPP=$OPTARG ;; - # -f allows you to select a makefile name - f) D=$OPTARG ;; - # the -p flag produces "program: program.c" style dependencies - # so .o's don't get produced - p) pflag=p ;; - # -t means use -traditional with gnu cpp - t) trad="-traditional" ;; - \?) usage ; exit 2;; + # -f allows you to select a makefile name + -f) + D=$2 + shift; shift ;; + + # the -p flag produces "program: program.c" style dependencies + # so .o's don't get produced + -p) + SED='s;\.o ; ;' + shift ;; + *) + break ;; esac done -shift $(( $OPTIND - 1 )) - if [ $# = 0 ] ; then - usage + echo 'usage: mkdep [-p] [-f depend_file] [cc_flags] file ...' exit 1 fi TMP=/tmp/mkdep$$ -trap 'rm -f $TMP ; exit 1' 1 2 3 13 15 +trap 'rm -f $TMP ; trap 2 ; kill -2 $$' 1 2 3 13 15 -if [ x$pflag = x ]; then - $cpp $trad -M $* | sed -e 's; \./; ;g' > $TMP -else - $cpp $trad -M $* | sed -e 's;\.o *:;:;' -e 's; \./; ;g' > $TMP -fi +cc -M $* | +sed " + s; \./; ;g + /\.c:$/d + $SED" | +awk '{ + if ($1 != prev) { + if (rec != "") + print rec; + rec = $0; + prev = $1; + } + else { + if (length(rec $2) > 78) { + print rec; + rec = $0; + } + else + rec = rec " " $2 + } +} +END { + print rec +}' > $TMP if [ $? != 0 ]; then echo 'mkdep: compile failed.' diff --git a/tests/RUN-ONE-TEST b/tests/RUN-ONE-TEST index 58c375b7..554f3d6e 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 diff --git a/tests/case.right b/tests/case.right index fc3a1285..d2055c9d 100644 --- a/tests/case.right +++ b/tests/case.right @@ -52,3 +52,11 @@ ok1ok2ok3ok4ok5 ok1ok2ok3ok4ok5 ok1ok2ok3ok4ok5 ok1ok2ok3ok4ok5 +--- testing: del +ok1ok2ok3ok4ok5 +ok1ok2ok3ok4ok5 +ok1ok2ok3ok4ok5 +ok1ok2ok3ok4ok5 +ok1ok2ok3ok4ok5 +ok1ok2ok3ok4ok5 +ok1ok2ok3ok4ok5 diff --git a/tests/case3.sub b/tests/case3.sub index 6b987153..321543d6 100644 --- a/tests/case3.sub +++ b/tests/case3.sub @@ -24,7 +24,7 @@ testmatch() { echo } -for c in $'\1' $'\2'; do +for c in $'\1' $'\2' $'\177'; do echo -n "--- testing: " echo "$c" | od -t a | awk 'NR==1 { print $2 } ' testmatch "${c}" "\\${c}" diff --git a/tests/exec12.sub b/tests/exec12.sub index 4bd6121b..bc627d2d 100644 --- a/tests/exec12.sub +++ b/tests/exec12.sub @@ -1,5 +1,6 @@ : ${TMPDIR:=/var/tmp} TMPFILE=$TMPDIR/exitcode +trap 'rm -f $TMPFILE' 0 rm -f $TMPFILE set -e diff --git a/tests/extglob5.sub b/tests/extglob5.sub index 54e37238..d400f839 100644 --- a/tests/extglob5.sub +++ b/tests/extglob5.sub @@ -15,3 +15,4 @@ echo * rm ';' '++' cd $OLDPWD +rmdir $TESTDIR diff --git a/tests/history.right b/tests/history.right index 3bfa140b..d83fc718 100644 --- a/tests/history.right +++ b/tests/history.right @@ -97,7 +97,7 @@ line 2 for history 6 HISTFILE=$TMPDIR/newhistory 7 echo displaying \$HISTFILE after history -a 8 cat $HISTFILE -./history.tests: line 75: fc: history specification out of range +./history.tests: line 76: fc: history specification out of range 14 set -H 15 echo line 2 for history 16 unset HISTSIZE @@ -107,7 +107,7 @@ echo xx xb xc xx xb xc echo 44 48 4c 44 48 4c -./history.tests: line 90: fc: no command found +./history.tests: line 91: fc: no command found aa bb cc diff --git a/tests/history.tests b/tests/history.tests index 978c13ab..4001bd6c 100644 --- a/tests/history.tests +++ b/tests/history.tests @@ -20,6 +20,7 @@ HISTFILE=history.list HISTCONTROL=ignoreboth HISTIGNORE='&:history*:fc*' HISTSIZE=32 +export HISTIGNORE shopt -s cmdhist set -o history diff --git a/tests/run-all b/tests/run-all index 68fd2a5f..34d3e4c8 100644 --- a/tests/run-all +++ b/tests/run-all @@ -9,7 +9,7 @@ SUFFIX=`${THIS_SH} -c 'echo $(( $RANDOM + $BASHPID ))'` BASH_TSTOUT=${TMPDIR}/bashtst-$SUFFIX # for now export BASH_TSTOUT -trap 'rm -f $BASH_TSTOUT' 0 +trap 'rm -f $BASH_TSTOUT' 0 1 2 3 15 PATH=.:$PATH # just to get recho/zecho/printenv if not run via `make tests' export PATH diff --git a/tests/test1.sub b/tests/test1.sub index 2f4c2c0d..a1c58170 100644 --- a/tests/test1.sub +++ b/tests/test1.sub @@ -2,7 +2,7 @@ # return different results : ${TMPDIR:=/tmp} -trap 'rm -f ${TMPDIR}/pipe}' 0 1 2 3 6 15 +trap 'rm -f ${TMPDIR}/pipe' 0 1 2 3 6 15 exec 6>&- echo "t -p /dev/fd/6"