Malformed associative array declaration faults

2010-07-08 Thread lsteeger
Configuration Information [Automatically generated, do not change]:
Machine: x86_64
OS: linux-gnu
Compiler: gcc -I/usr/src/packages/BUILD/bash-4.0 
-L/usr/src/packages/BUILD/bash-4.0/../readline-6.0
Compilation CFLAGS:  -DPROGRAM='bash' -DCONF_HOSTTYPE='x86_64' 
-DCONF_OSTYPE='linux-gnu' -DCONF_MACHTYPE='x86_64-suse-linux-gnu' 
-DCONF_VENDOR='suse' -DLOCALEDIR='/usr/share/locale' -DPACKAGE='bash' -DSHELL 
-DHAVE_CONFIG_H   -I.  -I. -I./include -I./lib   -fmessage-length=0 -O2 -Wall 
-D_FORTIFY_SOURCE=2 -fstack-protector -funwind-tables 
-fasynchronous-unwind-tables -g  -D_GNU_SOURCE -DRECYCLES_PIDS -Wall -g 
-std=gnu89 -Wuninitialized -Wextra -Wno-unprototyped-calls -Wno-switch-enum 
-Wno-unused-variable -Wno-unused-parameter -ftree-loop-linear -pipe 
-fprofile-use
uname output: Linux russte14 2.6.31.12-0.2-desktop #1 SMP PREEMPT 2010-03-16 
21:25:39 +0100 x86_64 x86_64 x86_64 GNU/Linux
Machine Type: x86_64-suse-linux-gnu

Bash Version: 4.0
Patch Level: 35
Release Status: release

Description:
When executing a malformed associative array declaration, 
  a segmentation fault occurs:

Repeat-By:
  Sample script:
 
#!/bin/bash
declare -A xyz=




Re: Malformed associative array declaration faults

2010-07-08 Thread Chet Ramey
> Machine Type: x86_64-suse-linux-gnu
> 
> Bash Version: 4.0
> Patch Level: 35
> Release Status: release
> 
> Description:
>   When executing a malformed associative array declaration, 
>   a segmentation fault occurs:

This was fixed in bash-4.1.

Chet

-- 
``The lyf so short, the craft so long to lerne.'' - Chaucer
 ``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, ITS, CWRUc...@case.eduhttp://cnswww.cns.cwru.edu/~chet/



bad substitution: no closing `)' in $( #"...

2010-07-08 Thread Thomas Hafner
Configuration Information [Automatically generated, do not change]:
Machine: i386
OS: freebsd6.2
Compiler: cc
Compilation CFLAGS:  -DPROGRAM='bash' -DCONF_HOSTTYPE='i386' 
-DCONF_OSTYPE='freebsd6.2' -DCONF_MACHTYPE='i386-portbld-freebsd6.2' 
-DCONF_VENDOR='portbld' -DLOCALEDIR='/usr/local/share/locale' -DPACKAGE='bash' 
-DSHELL  -DHAVE_CONFIG_H   -I.  -I. -I./include -I./lib  -I/usr/local/include 
-O2 -fno-strict-aliasing -pipe
uname output: FreeBSD m-net.arbornet.org 6.3-PRERELEASE FreeBSD 6.3-PRERELEASE 
#1: Tue Nov  6 16:13:56 EST 2007 
r...@newmnet.arbornet.org:/usr/src/sys/i386/compile/MNET  i386
Machine Type: i386-portbld-freebsd6.2

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

Description:
See this shell code:
: $( #"
)

The shell complains: bad substitution: no closing `)' in $( #"
)

Repeat-By:
see description above



Re: bad substitution: no closing `)' in $( #"...

2010-07-08 Thread Sven Mascheck
On Thu, Jul 08, 2010 at 10:23:00PM +0200, Thomas Hafner wrote:

> Bash Version: 3.1
> Patch Level: 17
> 
> Description:
> See this shell code:
> : $( #"
> )


bash-3.2 has this fixed.

In case you want to exploit further, you might find
http://www.in-ulm.de/~mascheck/various/cmd-subst/ interesting



Where is the syntax of ${arr...@]:1:2} described?

2010-07-08 Thread Peng Yu
Hi,

array=(a b c)
echo ${arr...@]:1:2}


I'm looking for the document for the above usage. I checked the Arrays
section of man bash, but I don't see a description of such usage. I
also searched man bash with [0-9]+:[0-9]+. But I still don't find a
description. Could anybody let me know where this is documented?

-- 
Regards,
Peng



Re: Where is the syntax of ${arr...@]:1:2} described?

2010-07-08 Thread Peng Yu
I find the following. But this is for string according to the
highlighted word "Substring Expansion".

${parameter:offset:length}
  Substring Expansion.  Expands to  up  to  length  characters  of
  


The following description is actually for array. Therefore, I suggest
to put this into the array section and add references between the two
sections.

   . If
  parameter is @,  the  result  is  length  positional  parameters
  beginning at offset.  If parameter is an indexed array
name sub\u2010
 .



On Thu, Jul 8, 2010 at 9:27 PM, Peng Yu  wrote:
> Hi,
>
> array=(a b c)
> echo ${arr...@]:1:2}
>
>
> I'm looking for the document for the above usage. I checked the Arrays
> section of man bash, but I don't see a description of such usage. I
> also searched man bash with [0-9]+:[0-9]+. But I still don't find a
> description. Could anybody let me know where this is documented?
>
> --
> Regards,
> Peng
>



-- 
Regards,
Peng



Re: Where is the syntax of ${arr...@]:1:2} described?

2010-07-08 Thread Chet Ramey
On 7/8/10 10:27 PM, Peng Yu wrote:
> Hi,
> 
> array=(a b c)
> echo ${arr...@]:1:2}
> 
> 
> I'm looking for the document for the above usage. I checked the Arrays
> section of man bash, but I don't see a description of such usage. I
> also searched man bash with [0-9]+:[0-9]+. But I still don't find a
> description. Could anybody let me know where this is documented?

In substring expansion:

  If parameter is @, the result is length  posi-
tional  parameters  beginning  at  offset.   If  parameter is an
indexed array name subscripted by @ or  *,  the  result  is  the
length members of the array beginning with ${parameter[offset]}.

-- 
``The lyf so short, the craft so long to lerne.'' - Chaucer
 ``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, ITS, CWRUc...@case.eduhttp://cnswww.cns.cwru.edu/~chet/