Re: direxpand in 4.3 is different from in 4.2

2014-03-16 Thread Clark Wang
On Sat, Mar 15, 2014 at 12:06 AM, Chet Ramey  wrote:

> On 3/14/14 2:39 AM, Clark Wang wrote:
> > For example in 4.3 when direxpand is enabled, `cd ./tmp' would be
> > expand `./tmp' to the full path (e.g. `/root/tmp/'). I think this is not
> > good especially when the full dir path is very long. Bash 4.2 (tested
> with
> > 4.2.37) does not behave like this. Could we keep the 4.2 behavior?
>
> This isn't accurate.  When you build bash-4.3 with the default options, and
> choose to enable direxpand using shopt, you get the same behavior as in
> bash-4.2.  In particular, relative paths aren't expanded to full paths.
>
> Recompiled with default options and it worked fine. Thanks.


> If, on the other hand, you build bash with the enable-direxpand-default
> configuration option, you do get this behavior.  I left the relative-path
> expansion option enabled when bash is built this way.  In retrospect, I
> should probably have left it out.  If you prefer it disabled, you can
> change the assignment to dircomplete_expand_relpath in bashline.c.
>
> That is not to say there aren't problems with relative paths and completion
> in bash-4.3, but they aren't with direxpand.  Additionally, I'm not talking
> about the situation when bash-completion is included in the mix.
>
> Chet
> --
> ``The lyf so short, the craft so long to lerne.'' - Chaucer
>  ``Ars longa, vita brevis'' - Hippocrates
> Chet Ramey, ITS, CWRUc...@case.edu
> http://cnswww.cns.cwru.edu/~chet/
>


Re: odd behavior from overloading the "source" builtin

2014-03-16 Thread Chris F.A. Johnson

On Sun, 16 Mar 2014, Doug McIlroy wrote:


GNU bash, version 4.2.39(1)-release (x86_64-redhat-linux-gnu)
interprets this shell script differently when bash input comes 
from a terminal or when it conmes from a file:

source(){
echo x
}
source
In the former case it prints x; in the latter it gives a
missing-filename diagnostic, presumably from the builtin "source".
The behavior is independent of whether the environment
contains "source()".



The bash man page leads me to expect the former behavior
because commands are said to be looked up first among
shell functions, then among builtins.



The behavior seems to be peculiar to "source". If "source"
is replaced by "wait, the difference vanishes.


   I get the same behaviour whether entered in a terminal or executed
   in a script (bash 4.2 and 4.3).

$ source(){
  echo x
}
$ source
x
$ xx.sh
x



odd behavior from overloading the "source" builtin

2014-03-16 Thread Doug McIlroy


binxQRPThwkqX.bin
Description: Binary data


odd behavior from overloading the "source" builtin

2014-03-16 Thread Doug McIlroy
wait() {
echo x
}
wait



[no subject]

2014-03-16 Thread Doug McIlroy


binK813SZFOYK.bin
Description: Binary data


bash cross with installed readline

2014-03-16 Thread Andrew Kosteltsev
Dear All,

When we build bash for some targets the INCLUDES variable for BUILD_CC
contains the path to target readline headers. This path points to the
target headers which not preferred for utilities which prepared for build
machine.

Also when we have installed readline on the target the configure script
avoids cross_compilation problems with AC_TRY_RUN and substitutes wrong
(very old) version of libreadline. If we sure that we installed correct
readline version we can change configure script for cross compilation
process.

Please look at attached patches. If this solution can be used for common
case then please apply these patches for the future versions of bash.

Best Regards,
Andrey K.
diff -b --unified -Nr bash-4.2-orig/Makefile.in bash-4.2/Makefile.in
--- bash-4.2-orig/Makefile.in	2010-12-01 03:22:42.0 +0300
+++ bash-4.2/Makefile.in	2014-03-16 13:07:47.973897424 +0400
@@ -142,14 +142,17 @@
 BASE_CCFLAGS = $(PROFILE_FLAGS) $(SYSTEM_FLAGS) $(LOCAL_DEFS) \
 	  $(DEFS) $(LOCAL_CFLAGS) $(INCLUDES)
 
+BASE_CCFLAGS_FOR_BUILD = $(PROFILE_FLAGS) $(SYSTEM_FLAGS) $(LOCAL_DEFS) $(DEFS) $(LOCAL_CFLAGS) $(INCLUDES_FOR_BUILD)
+
 CCFLAGS = $(BASE_CCFLAGS) $(CPPFLAGS) $(CFLAGS)
 
-CCFLAGS_FOR_BUILD = $(BASE_CCFLAGS) $(CPPFLAGS_FOR_BUILD) $(CFLAGS_FOR_BUILD)
+CCFLAGS_FOR_BUILD = $(BASE_CCFLAGS_FOR_BUILD) $(CPPFLAGS_FOR_BUILD) $(CFLAGS_FOR_BUILD)
 
 LDFLAGS = @LDFLAGS@ $(STATIC_LD) $(LOCAL_LDFLAGS) $(PROFILE_FLAGS) $(CFLAGS)
 LDFLAGS_FOR_BUILD = @LDFLAGS_FOR_BUILD@ $(LOCAL_LDFLAGS) $(CFLAGS_FOR_BUILD)
 
 INCLUDES = -I. @RL_INCLUDE@ -I$(srcdir) -I$(BASHINCDIR) -I$(LIBSRC) $(INTL_INC)
+INCLUDES_FOR_BUILD = -I. -I$(srcdir) -I$(BASHINCDIR) -I$(LIBSRC) $(INTL_INC)
 
 # Maybe add: -Wextra
 GCC_LINT_FLAGS = -O -Wall -Wshadow -Wpointer-arith -Wcast-qual -Wno-parentheses \
diff -b --unified -Nr bash-4.2-orig/builtins/Makefile.in bash-4.2/builtins/Makefile.in
--- bash-4.2-orig/builtins/Makefile.in	2010-12-21 16:37:18.0 +0300
+++ bash-4.2/builtins/Makefile.in	2014-03-16 13:07:47.973897424 +0400
@@ -86,13 +86,17 @@
 MKDIRS = ${topdir}/support/mkdirs
 
 INCLUDES = -I. -I.. @RL_INCLUDE@ -I$(topdir) -I$(BASHINCDIR) -I$(topdir)/lib -I$(srcdir) ${INTL_INC}
+INCLUDES_FOR_BUILD = -I. -I.. -I$(topdir) -I$(BASHINCDIR) -I$(topdir)/lib -I$(srcdir) ${INTL_INC}
 
 BASE_CCFLAGS = ${PROFILE_FLAGS} $(DEFS) $(LOCAL_DEFS) $(SYSTEM_FLAGS) \
 	 ${INCLUDES} $(LOCAL_CFLAGS)
 
+BASE_CCFLAGS_FOR_BUILD = ${PROFILE_FLAGS} $(DEFS) $(LOCAL_DEFS) $(SYSTEM_FLAGS) \
+	 ${INCLUDES_FOR_BUILD} $(LOCAL_CFLAGS)
+
 CCFLAGS = $(BASE_CCFLAGS) $(CPPFLAGS) $(CFLAGS)
 
-CCFLAGS_FOR_BUILD = $(BASE_CCFLAGS) $(CPPFLAGS_FOR_BUILD) $(CFLAGS_FOR_BUILD)
+CCFLAGS_FOR_BUILD = $(BASE_CCFLAGS_FOR_BUILD) $(CPPFLAGS_FOR_BUILD) $(CFLAGS_FOR_BUILD)
 
 GCC_LINT_FLAGS = -Wall -Wshadow -Wpointer-arith -Wcast-qual \
 		 -Wcast-align -Wstrict-prototypes -Wconversion \
diff -b --unified -Nr bash-4.2-orig/aclocal.m4 bash-4.2/aclocal.m4
--- bash-4.2-orig/aclocal.m4	2010-07-05 23:36:21.0 +0400
+++ bash-4.2/aclocal.m4	2014-03-16 13:07:48.157897417 +0400
@@ -1828,7 +1828,7 @@
 ],
 ac_cv_rl_version=`cat conftest.rlv`,
 ac_cv_rl_version='0.0',
-ac_cv_rl_version='4.2')])
+ac_cv_rl_version='6.2')])
 
 CFLAGS="$_save_CFLAGS"
 LDFLAGS="$_save_LDFLAGS"
diff -b --unified -Nr bash-4.2-orig/configure bash-4.2/configure
--- bash-4.2-orig/configure	2011-02-08 01:03:22.0 +0300
+++ bash-4.2/configure	2014-03-16 13:07:48.157897417 +0400
@@ -5563,7 +5563,7 @@
   $as_echo_n "(cached) " >&6
 else
   if test "$cross_compiling" = yes; then
-  ac_cv_rl_version='4.2'
+  ac_cv_rl_version='6.2'
 else
   cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
diff -b --unified -Nr bash-4.3-orig/Makefile.in bash-4.3/Makefile.in
--- bash-4.3-orig/Makefile.in	2014-01-26 01:27:30.0 +0400
+++ bash-4.3/Makefile.in	2014-03-16 13:07:48.360897408 +0400
@@ -146,14 +146,17 @@
 BASE_CCFLAGS = $(PROFILE_FLAGS) $(SYSTEM_FLAGS) $(LOCAL_DEFS) \
 	  $(DEFS) $(LOCAL_CFLAGS) $(INCLUDES)
 
+BASE_CCFLAGS_FOR_BUILD = $(PROFILE_FLAGS) $(SYSTEM_FLAGS) $(LOCAL_DEFS) $(DEFS) $(LOCAL_CFLAGS) $(INCLUDES_FOR_BUILD)
+
 CCFLAGS = $(BASE_CCFLAGS) $(CPPFLAGS) $(CFLAGS)
 
-CCFLAGS_FOR_BUILD = $(BASE_CCFLAGS) $(CPPFLAGS_FOR_BUILD) $(CFLAGS_FOR_BUILD)
+CCFLAGS_FOR_BUILD = $(BASE_CCFLAGS_FOR_BUILD) $(CPPFLAGS_FOR_BUILD) $(CFLAGS_FOR_BUILD)
 
 LDFLAGS = @LDFLAGS@ $(STATIC_LD) $(LOCAL_LDFLAGS) $(PROFILE_FLAGS) $(CFLAGS)
 LDFLAGS_FOR_BUILD = @LDFLAGS_FOR_BUILD@ $(LOCAL_LDFLAGS) $(CFLAGS_FOR_BUILD)
 
 INCLUDES = -I. @RL_INCLUDE@ -I$(srcdir) -I$(BASHINCDIR) -I$(LIBSRC) $(INTL_INC)
+INCLUDES_FOR_BUILD = -I. -I$(srcdir) -I$(BASHINCDIR) -I$(LIBSRC) $(INTL_INC)
 
 # Maybe add: -Wextra
 GCC_LINT_FLAGS = -O -Wall -Wshadow -Wpointer-arith -Wcast-qual -Wno-parentheses \
diff -b --unified -Nr bash-4.3-orig/builtins/Makefile.in bash-4.3/builtins/Makefile.in
--- bash-4.3-orig/builtins/Makefile.in	2012-05-25 17:29:19.0 +0400
+++ bash-4.3/builtins/Makefile.in	2014-03-16 13:07:48.360897408 +0400
@@ -88,13 +88,17 @@
 HELPFILES_TARGET