bash manpage problems + patch

2008-01-16 Thread Peter Breitenlohner
Configuration Information [Automatically generated, do not change]:
Machine: i686
OS: linux-gnu
Compiler: gcc
Compilation CFLAGS:  -DPROGRAM='bash' -DCONF_HOSTTYPE='i686' 
-DCONF_OSTYPE='linux-gnu' -DCONF_MACHTYPE='i686-pc-linux-gnu' 
-DCONF_VENDOR='pc' -DLOCALEDIR='/usr/share/locale' -DPACKAGE='bash' -DSHELL 
-DHAVE_CONFIG_H   -I.  -I../bash-3.2 -I../bash-3.2/include -I../bash-3.2/lib   
-O2
uname output: Linux pcl321 2.6.20-i686 #3 SMP Fri Mar 23 15:31:48 CET 2007 i686 
GNU/Linux
Machine Type: i686-pc-linux-gnu

Bash Version: 3.2
Patch Level: 33
Release Status: release

Description:
(1) The bash.1 manpage suffers from a rather ugly formatting problem
due to a typo.

(2) I like the bash_builtins.1 manpage, which is, however, not installed
by the distributed Makefile.in. Unfortunately that manpage cannot be
displayed by all man browsers (man-db and possibly others as well).
Whereas AFAIK all man browsers understand ".so man1/bash.1" only some of
them understand ".so bash.1".

(3) It would be nice if the bash_builtins.1 manpage could be installed
without modifying Makefile.in (and without doing it manually), e.g., via
a configure option or a make variable specified on the make command 
line.

Repeat-By:
(1) Say "man bash" and search for the paragraph starting with
"${parameter/pattern/string}" in the section "Parameter Expansion".

(2) Install bash_builtins.1 on a system using man-db (e.g., debian or 
suse)
and try "man bash_builtins".

Fix:
For (1) and (2) apply these two patches.
--  cut here ---
diff -ur -x configure bash-3.2.orig/doc/bash.1 bash-3.2/doc/bash.1
--- bash-3.2.orig/doc/bash.12006-10-03 14:54:26.0 +0200
+++ bash-3.2/doc/bash.1 2008-01-15 19:44:43.0 +0100
@@ -2539,7 +2539,7 @@
 pathname expansion.
 \fIParameter\fP is expanded and the longest match of \fIpattern\fP
 against its value is replaced with \fIstring\fP.
-If \Ipattern\fP begins with \fB/\fP, all matches of \fIpattern\fP are
+If \fIpattern\fP begins with \fB/\fP, all matches of \fIpattern\fP are
 replaced with \fIstring\fP.  Normally only the first match is replaced.
 If \fIpattern\fP begins with \fB#\fP, it must match at the beginning
 of the expanded value of \fIparameter\fP.
--  cut here ---
diff -ur bash-3.2.orig/doc/builtins.1 bash-3.2/doc/builtins.1
--- bash-3.2.orig/doc/builtins.12004-05-24 16:19:55.0 +0200
+++ bash-3.2/doc/builtins.1 2007-03-28 22:20:48.0 +0200
@@ -10,6 +10,6 @@
 ulimit, umask, unalias, unset, wait \- bash built-in commands, see 
\fBbash\fR(1)
 .SH BASH BUILTIN COMMANDS
 .nr zZ 1
-.so bash.1
+.so man1/bash.1
 .SH SEE ALSO
 bash(1), sh(1)
--  cut here ---
It would be nice if something could be done about (3).




premature execution of command substution during tab completion solicitation

2008-01-16 Thread jared r r spiegel
Configuration Information [Automatically generated, do not change]:
Machine: i386
OS: openbsd4.0
Compiler: cc
Compilation CFLAGS:  -DPROGRAM='bash' -DCONF_HOSTTYPE='i386' 
-DCONF_OSTYPE='openbsd4.0' -DCONF_MACHTYPE='i386-unknown-openbsd4.0' 
-DCONF_VENDOR='unknown' -DLOCALEDIR='/usr/local/share/locale' -DPACKAGE='bash' 
-DSHELL  -DHAVE_CONFIG_H   -I.  -I. -I./include -I./lib  -I/usr/local/include 
-O2 -pipe
uname output: OpenBSD iorek.ice-nine.org 4.0 IOREK.MP#1 i386
Machine Type: i386-unknown-openbsd4.0

Bash Version: 3.1
Patch Level: 17
Release Status: release

Description:
unexpected execution of incomplete (and currently syntactically 
invalid?)
commandline by tab-completion subsystem

Repeat-By:
enter ``"$(echo $RANDOM >/dev/stderr) /dev/null'' a the command
prompt (with .Dq removed).  note the \" at the beginning of line
has no matching end quote.  the cursor in my case is directly
after the last 'l', as if i had just finished typing null, however
it doesn't seem to be utterly critical to the duplication.

hit tab a lot.

my term looks like this:

bash-3.1$ "$(echo $RANDOM >/dev/stderr) /dev/null
20560
nullnull
bash-3.1$ "$(echo $RANDOM >/dev/stderr) /dev/null
26528
nullnull
bash-3.1$ "$(echo $RANDOM >/dev/stderr) /dev/null
13871
nullnull
bash-3.1$ "$(echo $RANDOM >/dev/stderr) /dev/null
18086
nullnull
bash-3.1$ "$(echo $RANDOM >/dev/stderr) /dev/null

bash is prematurely executing command substitutions inside the open 
quote.
tested some other unterminated tokens:

" - happens
' - happens
( - appears safe
{ - appears safe

`command` shows the behaviour same as $(command).

also duplicated with current bash '3.1dfsg-8' from debian current
(which has the same $BASH_VERSION string of 3.1.17(1)-release)