When bash 3.1 is installed from ports, some of the patches cause a change to parse.y which cause the parser to get rebuilt with yacc. If you install bash-completion-20060301 and source the completion file, filename completion with ~ causes bash to get into a bad state. If you build bash 3.1 with bison2, the problem goes away. Note that you cannot use bison 1.75 because of PR ports/94086. Fix: Install bison2. Build bash from ports with YACC environment variable set to bison2. How-To-Repeat: Install bash-3.1. Install bash-completion-20060301 Run bash. Source the completion file: . /usr/local/etc/bash_completion Type cd ~/<TAB> pick a directory from the completion, and press RETURN. Notice bash doesn't change directory and goes into a bad state. Hitting CTRL-C once or twice should break out of it. If you press UP to look at your history, you may notice the command in the history with a semicolon at the end as-if bash were expecting additional input from a multi-line statement.
Responsible Changed From-To: freebsd-ports-bugs->obrien Over to maintainer.
On Tue, Aug 01, 2006 at 11:48:09PM +0000, Eric Huss wrote: > >Description: > When bash 3.1 is installed from ports, some of the patches cause a change to parse.y which cause the parser to get rebuilt with yacc. > > If you install bash-completion-20060301 and source the completion file, filename completion with ~ causes bash to get into a bad state. > > If you build bash 3.1 with bison2, the problem goes away. Note that you cannot use bison 1.75 because of PR ports/94086. > > >How-To-Repeat: > Install bash-3.1. > Install bash-completion-20060301 > Run bash. > Source the completion file: . /usr/local/etc/bash_completion > Type cd ~/<TAB> pick a directory from the completion, and press RETURN. > > Notice bash doesn't change directory and goes into a bad state. Hitting CTRL-C once or twice should break out of it. If you press UP to look at your history, you may notice the command in the history with a semicolon at the end as-if bash were expecting additional input from a multi-line statement. > > >Fix: > Install bison2. > Build bash from ports with YACC environment variable set to bison2. I can confirm that this does fix problem with bash-completion. I was bothered by this problem for some time. Thank you very much! Regards, Rong-En Fan
State Changed From-To: open->feedback Do you by chance have a tested patch to address this that meets your needs?
Until our yacc is fixed, I proposed the following patch which force bash built with devel/bison2. Index: Makefile =================================================================== RCS file: /home/pcvs/ports/shells/bash/Makefile,v retrieving revision 1.99 diff -u -r1.99 Makefile --- Makefile 11 Sep 2007 18:15:34 -0000 1.99 +++ Makefile 15 Oct 2007 10:15:17 -0000 @@ -9,7 +9,7 @@ PORTNAME= bash PATCHLEVEL= 25 PORTVERSION= 3.2.${PATCHLEVEL:S/^0//g} -PORTREVISION?= 0 +PORTREVISION?= 1 CATEGORIES= shells MASTER_SITES= ${MASTER_SITE_GNU:S/$/:bash/} \ ftp://ftp.cwru.edu/pub/%SUBDIR%/:faq @@ -29,6 +29,10 @@ MAINTAINER= obrien@FreeBSD.org COMMENT= The GNU Project's Bourne Again SHell +# workaround ports/101230 +BUILD_DEPENDS= bison2:${PORTSDIR}/devel/bison2 +YACC= bison2 + IGNOREFILES= FAQ CONFLICTS= bash-[0-24-9].*
On Mon, Oct 15, 2007 at 10:20:02AM +0000, rafan@FreeBSD.org wrote: > Until our yacc is fixed, I proposed the following patch which > force bash built with devel/bison2. Has anyone experiencing the problem with bash_completion looked that what is "broken" in our YACC? Possibly the input file is broken. I'm hesitant to include yet another build dependnancy unless we really have no choice. -- -- David (obrien@FreeBSD.org)
On Mon, Oct 15, 2007 at 10:51:50AM -0700, David O'Brien wrote: > Has anyone experiencing the problem with bash_completion looked that what > is "broken" in our YACC? Possibly the input file is broken. I'm > hesitant to include yet another build dependnancy unless we really have > no choice. For the record, the part of bash-completion that causing problem is _expand() { true [ "$cur" != "${cur%\\}" ] && cur="$cur\\" # expand ~username type directory specifications if [[ "$cur" == \~*/* ]]; then eval cur=$cur elif [[ "$cur" == \~* ]]; then cur=${cur#\~} COMPREPLY=( $( compgen -P '~' -u $cur ) ) return ${#COMPREPLY[@]} fi } Removing 'eval cur=$cur' seems working (or changed to cur=/home/rafan). I haven't look into bash's parse.y. Regards, Rong-En Fan
State Changed From-To: feedback->suspended I don't want to add a dependancy on Bison without someone digging into what is the root of the problem.
Now that the port has been updated to 4.0.x, even more central uses of the parser are broken, including command substitution. At least in the interim, we should build with bison. With the new bison, I think we can use something like the attached patch. It also includes a regression-test target, to try to make finding problems a bit easier. Chet Ramey, the upstream maintainer, does not now know what is wrong with using yacc with bash, and he may look into it, but it doesn't seem to be a high priority. b.
I submitted a bug-report to Bash. This is the response I received. <quote> Chet Ramey <chet.ramey@case.edu> Bash-4.0 parses the contents of command substitutions before executing them. This is what Posix requires. Previous versions deferred parsing to the subshell spawned to execute the command. (This part works best if you're looking at the yacc grammar.) BSD yacc will not reduce a simple_list1 to a simple_list when the look a head token is `)'. Bison will. It's that simple. </quote> It would appear as if it is time to switch to Bison if we want this problem corrected. -- Gerard gerard@seibercom.net
obrien 2009-03-13 15:54:23 UTC FreeBSD ports repository Modified files: shells/bash Makefile Log: Use Bison in the build instead of byacc. This fixes the issue of '$()' (for ``) not being parsed correctly. PR: 101230 Submitted by: bf2006a@yahoo.com Revision Changes Path 1.111 +6 -2 ports/shells/bash/Makefile _______________________________________________ cvs-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/cvs-all To unsubscribe, send any mail to "cvs-all-unsubscribe@freebsd.org"
State Changed From-To: suspended->closed switched to bison for now