bash does not handle escape sequences for inserted paramaters to for
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/local/share/locale' -DPACKAGE='bash' -DSHELL -DHAVE_CONFIG_H -I. -I. -I./include -I./lib -g -O2 uname output: Linux x2 2.6.9-42.ELsmp #1 SMP Wed Jul 12 23:27:17 EDT 2006 i686 i686 i386 GNU/Linux Machine Type: i686-pc-linux-gnu Bash Version: 3.2 Patch Level: 0 Release Status: release Description: I need to process files with spaces in them in a for loop. I tried using ls --quoting-style=escape but that didn't work because bash didn't honor the \ escaping for the spaces. Repeat-By: [EMAIL PROTECTED] /local/download/src/bash-3.2]# for I in a b\ c ; do echo $I ; done a b c [EMAIL PROTECTED] /local/download/src/bash-3.2]# for I in `echo a b\\ c` ; do echo $I ; done a b c Fix: [Description of how to fix the problem. If you don't know a fix for the problem, don't include this section.] ___ Bug-bash mailing list Bug-bash@gnu.org http://lists.gnu.org/mailman/listinfo/bug-bash
bash 3.2 fails to detect bzero in configure stage
Hi, I am using uClibc 0.9.29 and GCC 4.1.2 to compile bash 3.2 (with the 17 patches released on web). And I have a problem that configure does not detect bzero properly, and thus resulting in a crash later when compiling. I have enabled SUSV3 functions in uClibc, so it has bzero defined in the headers, but declared as "void bzero (void *__s, size_t __n)". Any pointers to a correct fix or where I should start looking would be greatly appreciated. Below is the relevant part (AFAIK) from config.log: configure:12821: checking for bzero configure:12877: /home/hcegtvedt/gitwork/buildroot-test/build_avr32/staging_dir/usr/bin/avr32-linux-uclibc-gcc -Os -pipe -I/home/hcegtvedt/gitwork/buildroot-test/build_avr32/staging_dir/usr/include -o conftest -g -O2 conftest.c >&5 conftest.c:172: warning: conflicting types for built-in function 'bzero' /tmp/ccHJjzHr.o: In function `main': /home/hcegtvedt/gitwork/buildroot-test/build_avr32/bash-3.2/conftest.c:183: undefined reference to `bzero' collect2: ld returned 1 exit status configure:12883: $? = 1 configure: failed program was: | /* confdefs.h. */ | #define PACKAGE_NAME "bash" | #define PACKAGE_TARNAME "bash" | #define PACKAGE_VERSION "3.2-release" | #define PACKAGE_STRING "bash 3.2-release" | #define PACKAGE_BUGREPORT "bug-bash@gnu.org" | #define ALIAS 1 | #define PUSHD_AND_POPD 1 | #define RESTRICTED_SHELL 1 | #define PROCESS_SUBSTITUTION 1 | #define PROMPT_STRING_DECODE 1 | #define SELECT_COMMAND 1 | #define HELP_BUILTIN 1 | #define ARRAY_VARS 1 | #define DPAREN_ARITHMETIC 1 | #define BRACE_EXPANSION 1 | #define COMMAND_TIMING 1 | #define EXTENDED_GLOB 1 | #define COND_COMMAND 1 | #define COND_REGEXP 1 | #define ARITH_FOR_COMMAND 1 | #define NETWORK_REDIRECTIONS 1 | #define PROGRAMMABLE_COMPLETION 1 | #define DEBUGGER 1 | #define MEMSCRAMBLE 1 | #define STDC_HEADERS 1 | #define HAVE_SYS_TYPES_H 1 | #define HAVE_SYS_STAT_H 1 | #define HAVE_STDLIB_H 1 | #define HAVE_STRING_H 1 | #define HAVE_MEMORY_H 1 | #define HAVE_STRINGS_H 1 | #define HAVE_INTTYPES_H 1 | #define HAVE_STDINT_H 1 | #define HAVE_UNISTD_H 1 | #define _FILE_OFFSET_BITS 64 | #define READLINE 1 | #define HISTORY 1 | #define BANG_HISTORY 1 | #define _GNU_SOURCE 1 | #define WORDS_BIGENDIAN 1 | #define HAVE_STRINGIZE 1 | #define PROTOTYPES 1 | #define __PROTOTYPES 1 | #define HAVE_ALLOCA_H 1 | #define HAVE_ALLOCA 1 | #define HAVE_STDLIB_H 1 | #define HAVE_UNISTD_H 1 | #define HAVE_GETPAGESIZE 1 | #define INTDIV0_RAISES_SIGFPE 0 | #define HAVE_INTTYPES_H_WITH_UINTMAX 1 | #define HAVE_STDINT_H_WITH_UINTMAX 1 | #define HAVE_UNSIGNED_LONG_LONG 1 | #define HAVE_UINTMAX_T 1 | #define HAVE_INTTYPES_H 1 | #define HAVE_LIMITS_H 1 | #define HAVE_LOCALE_H 1 | #define HAVE_NL_TYPES_H 1 | #define HAVE_MALLOC_H 1 | #define HAVE_STDDEF_H 1 | #define HAVE_STDLIB_H 1 | #define HAVE_STRING_H 1 | #define HAVE_UNISTD_H 1 | #define HAVE_SYS_PARAM_H 1 | #define HAVE_FEOF_UNLOCKED 1 | #define HAVE_FGETS_UNLOCKED 1 | #define HAVE_GETC_UNLOCKED 1 | #define HAVE_GETCWD 1 | #define HAVE_GETEGID 1 | #define HAVE_GETEUID 1 | #define HAVE_GETGID 1 | #define HAVE_GETUID 1 | #define HAVE_MEMPCPY 1 | #define HAVE_MUNMAP 1 | #define HAVE_PUTENV 1 | #define HAVE_SETENV 1 | #define HAVE_SETLOCALE 1 | #define HAVE_STPCPY 1 | #define HAVE_STRCASECMP 1 | #define HAVE_STRDUP 1 | #define HAVE_STRTOUL 1 | #define HAVE_TSEARCH 1 | #define HAVE___FSETLOCKING 1 | #define HAVE_LANGINFO_CODESET 1 | #define HAVE_LC_MESSAGES 1 | #define HAVE_DIRENT_H 1 | #define TIME_WITH_SYS_TIME 1 | #define HAVE_INTTYPES_H 1 | #define HAVE_UNISTD_H 1 | #define HAVE_STDLIB_H 1 | #define HAVE_STDARG_H 1 | #define HAVE_LIMITS_H 1 | #define HAVE_STRING_H 1 | #define HAVE_MEMORY_H 1 | #define HAVE_LOCALE_H 1 | #define HAVE_TERMCAP_H 1 | #define HAVE_TERMIO_H 1 | #define HAVE_TERMIOS_H 1 | #define HAVE_DLFCN_H 1 | #define HAVE_STDDEF_H 1 | #define HAVE_STDINT_H 1 | #define HAVE_NETDB_H 1 | #define HAVE_PWD_H 1 | #define HAVE_GRP_H 1 | #define HAVE_STRINGS_H 1 | #define HAVE_REGEX_H 1 | #define HAVE_SYS_SELECT_H 1 | #define HAVE_SYS_FILE_H 1 | #define HAVE_SYS_RESOURCE_H 1 | #define HAVE_SYS_PARAM_H 1 | #define HAVE_SYS_SOCKET_H 1 | #define HAVE_SYS_STAT_H 1 | #define HAVE_SYS_TIME_H 1 | #define HAVE_SYS_TIMES_H 1 | #define HAVE_SYS_TYPES_H 1 | #define HAVE_SYS_WAIT_H 1 | #define HAVE_NETINET_IN_H 1 | #define HAVE_ARPA_INET_H 1 | #define HAVE_ALLOCA_H 1 | #define HAVE_ALLOCA 1 | #define GETPGRP_VOID 1 | #define HAVE_VPRINTF 1 | #define RETSIGTYPE void | #define HAVE_WAIT3 1 | #define HAVE_MKFIFO 1 | #define HAVE_DUP2 1 | #define HAVE_FCNTL 1 | #define HAVE_GETDTABLESIZE 1 | #define HAVE_GETGROUPS 1 | #define HAVE_GETHOSTNAME 1 | #define HAVE_GETPAGESIZE 1 | #define HAVE_GETPEERNAME 1 | #define HAVE_GETRLIMIT 1 | #define HAVE_GETRUSAGE 1 | #define HAVE_GETTIMEOFDAY 1 | #define HAVE_KILL 1 | #define HAVE_KILLPG 1 | #define HAVE_LSTAT 1 | #define HAVE_READLINK 1 | #define HAVE_SBRK 1 | #define HAVE_SELECT 1 | #define HAVE_TCGETPGRP 1 | #define HAVE_UNAME 1 | #define HA
RE: bash does not handle escape sequences for inserted paramaters to for
This will work $ eval "for i in $(echo a b\\ c); do echo \"\$i\"; done" a b c http://lists.gnu.org/archive/html/bug-bash/2007-07/msg00011.html ___ Bug-bash mailing list Bug-bash@gnu.org http://lists.gnu.org/mailman/listinfo/bug-bash
Re: bash 3.2 fails to detect bzero in configure stage
On Wed, 2007-08-08 at 10:39 +0200, Hans-Christian Egtvedt wrote: > I am using uClibc 0.9.29 and GCC 4.1.2 to compile bash 3.2 (with the 17 > patches released on web). And I have a problem that configure does not > detect bzero properly, and thus resulting in a crash later when > compiling. I am a bit unsure if it is uClibc fault or configure for bash, but I have included a patch for bash which fixes my problem. I just remove the check and code for bzero in bash. After greping around in the source code, I saw that there already has been done numerous changes to use memset instead. -- Mvh Hans-Christian Egtvedt diff -upr bash-3.2.orig/config.h.in bash-3.2/config.h.in --- bash-3.2.orig/config.h.in 2006-09-12 22:00:54.0 +0200 +++ bash-3.2/config.h.in 2007-08-08 14:15:12.0 +0200 @@ -504,9 +504,6 @@ /* Define if you have the bcopy function. */ #undef HAVE_BCOPY -/* Define if you have the bzero function. */ -#undef HAVE_BZERO - /* Define if you have the confstr function. */ #undef HAVE_CONFSTR diff -upr bash-3.2.orig/configure.in bash-3.2/configure.in --- bash-3.2.orig/configure.in 2006-09-26 17:05:45.0 +0200 +++ bash-3.2/configure.in 2007-08-08 14:14:36.0 +0200 @@ -702,7 +702,7 @@ AC_CHECK_FUNCS(dup2 eaccess fcntl getdta AC_REPLACE_FUNCS(rename) dnl checks for c library functions -AC_CHECK_FUNCS(bcopy bzero confstr fnmatch \ +AC_CHECK_FUNCS(bcopy confstr fnmatch \ getaddrinfo gethostbyname getservbyname getservent inet_aton \ memmove pathconf putenv raise regcomp regexec \ setenv setlinebuf setlocale setvbuf siginterrupt strchr \ diff -upr bash-3.2.orig/CWRU/misc/sigstat.c bash-3.2/CWRU/misc/sigstat.c --- bash-3.2.orig/CWRU/misc/sigstat.c 2002-04-17 19:41:40.0 +0200 +++ bash-3.2/CWRU/misc/sigstat.c 2007-08-08 14:11:36.0 +0200 @@ -86,7 +86,7 @@ int sig; init_signames() { register int i; - bzero(signames, sizeof(signames)); + memset(signames, 0, sizeof(signames)); #if defined (SIGHUP) /* hangup */ signames[SIGHUP] = "SIGHUP"; diff -upr bash-3.2.orig/lib/sh/oslib.c bash-3.2/lib/sh/oslib.c --- bash-3.2.orig/lib/sh/oslib.c 2001-12-06 19:26:21.0 +0100 +++ bash-3.2/lib/sh/oslib.c 2007-08-08 14:11:44.0 +0200 @@ -170,23 +170,6 @@ bcopy (s,d,n) } #endif /* !HAVE_BCOPY */ -#if !defined (HAVE_BZERO) -# if defined (bzero) -#undef bzero -# endif -void -bzero (s, n) - char *s; - int n; -{ - register int i; - register char *r; - - for (i = 0, r = s; i < n; i++) -*r++ = '\0'; -} -#endif - #if !defined (HAVE_GETHOSTNAME) # if defined (HAVE_UNAME) #include ___ Bug-bash mailing list Bug-bash@gnu.org http://lists.gnu.org/mailman/listinfo/bug-bash
Re: I can't get bash-3.2.17 to process startup/login scripts to save me, please help!
SciFi wrote: > Got bash-3.2 patchlevel 17 running on MacOSX in place of Apple's: Is this a self-compiled binary? > I'm unable to get it to run the (login) startup files at all in any > way-shape-form. If the startup file was being executed, the PS1 > prompt should change as a very visible clue (among other things). > ... > 0 12422 348 0 31 027576668 - Ssp10:00.01 login > -pf scifi > 501 12423 12422 0 31 030932 1324 - S p10:00.01 -bash Seeing "-bash" there looks promising that bash is being started as a login shell. > The /etc/bashrc has many things to do, all of which do work (no > noticable errors when actually sourced manually). Plus /etc/bashrc > does set PS1 to another string so we'd instantly know if it'd been > executed. I copied /etc/bashrc to /etc/bash.bashrc as an extra > precaution: > > -bash-3.2$ ls -al /etc/*bash* > -rwxrwxrwx 1 root wheel 1739 Aug 4 17:18 /etc/bash.bashrc > -rwxrwxrwx 1 root wheel 1739 Aug 4 17:18 /etc/bashrc > -rw-r--r-- 1 root wheel 329 Jul 3 11:40 /etc/bashrc_orig But the login files sourced by bash are /etc/profile if that file exists. After reading that file it looks for ~/.bash_profile, ~/.bash_login, and ~/.profile in that order and reads and executes the first one that is readable. The above files that you show are not read by bash when it is a login shell. > Any help would be appreciated. I really need to use bash-3.2 while > working on the vast other open projects I'm keeping track of. > Having to manually source /etc/bashrc each & every time is becoming > a massive chore, enough that I go back to using Apple's bash-2.05b. I think there is simply confusion over which files are read by login shells. I think if you check you will find that bash invoked as a login shell will read /etc/profile and ~/.bash_profile okay. Normally the ~/.bash_profile will 'source ~/.bashrc' so that it can be shared between both login shells and non-login shells. Bob ___ Bug-bash mailing list Bug-bash@gnu.org http://lists.gnu.org/mailman/listinfo/bug-bash