set and type garbles functions that set v=$'\001'

2007-05-04 Thread Bo Ørsted Andresen
Configuration Information [Automatically generated, do not change]:
Machine: i686
OS: linux-gnu
Compiler: i686-pc-linux-gnu-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. -I./include -I./lib   -march=pentium-m -Os -pipe
uname output: Linux BA 2.6.20-suspend2-r4 #1 PREEMPT Tue Apr 24 08:51:12 CEST 
2007 i686 Intel(R) Pentium(R) M processor 1600MHz GenuineIntel GNU/Linux
Machine Type: i686-pc-linux-gnu

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

Description:
If a function f set a variable v to $'\001' then type f or set
add a second \001 in it's output. Hence v becomes $'\001\001'.
You'll need to use a hex viewer (in the example xxd) to see it.

Repeat-By:
f() {
v=$'\001'
}
type f | xxd


___
Bug-bash mailing list
Bug-bash@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-bash


bash: error exporting/importing function with here document

2007-05-04 Thread Chris Lesner

This seems to be broken in several version of bash including: version
3.00.16(1)-release (i386-pc-linux-gnu)
Configuration Information [Automatically generated, do not change]:
Machine: i386
OS: linux-gnu
Compiler: gcc
Compilation CFLAGS:  -DPROGRAM='bash' -DCONF_HOSTTYPE='i386'
-DCONF_OSTYPE='linux-gnu' -DCONF_MACHTYPE='i386-pc-linux-gnu'
-DCONF_VENDOR='pc' -DSHELL -DHAVE_CONFIG_H  -I.  -I../bash -I../bash/include
-I../bash/lib  -g -O2
uname output: Linux portege 2.4.27-3-686 #1 Tue Dec 5 21:03:54 UTC 2006 i686
GNU/Linux
Machine Type: i386-pc-linux-gnu

Bash Version: 2.05b
Patch Level: 0
Release Status: release

Description:
   Function with a here document fails to be exported/imported

Repeat-By:

$cat bin/itk/column/itkColumnTypeGenerateCommandExampleGet.bish
itkColumnTypeGenerateCommandExampleGet()
{
   cat <<-'+' | tr "\t" " " | tr -s " "
   cat - | utkSort
   itkSchemaToColumnType
   atkCacheToColumnType \"$npName\" | atkActiveTableLineSelect
| utkSort
   atkCacheToColumnType \"$npName\" |
atkTransactionTableLineSelect | utkSort
   itkDirToColumnType \"$dirName\" | atkActiveTableLineSelect |
utkSort
   itkDirToColumnType \"$dirName\" | atkActiveTableLineSelect |
utkSort
   +
}
$

$( . bin/itk/column/itkColumnTypeGenerateCommandExampleGet.bish ; export -f
itkColumnTypeGenerateCommandExampleGet ; echo ls | bash3 )
bash3: itkColumnTypeGenerateCommandExampleGet: line 8: syntax error near
unexpected token `|'
bash3: itkColumnTypeGenerateCommandExampleGet: line 8: ` | tr "\t" " " | tr
-s " "'
bash3: error importing function definition for
`itkColumnTypeGenerateCommandExampleGet'
aq  bin  columnTypes  data  dictionary  doc  _index  java  _remove  tags
tags2  test

This is because:

$ ( . bin/itk/column/itkColumnTypeGenerateCommandExampleGet.bish ; export -f
itkColumnTypeGenerateCommandExampleGet ; set | less )

itkColumnTypeGenerateCommandExampleGet ()
{
   cat  <<-'+'
cat - | utkSort
itkSchemaToColumnType
atkCacheToColumnType \"$npName\" | atkActiveTableLineSelect | utkSort
atkCacheToColumnType \"$npName\" | atkTransactionTableLineSelect | utkSort
itkDirToColumnType \"$dirName\" | atkActiveTableLineSelect | utkSort
itkDirToColumnType \"$dirName\" | atkActiveTableLineSelect | utkSort
+
| tr "\t" " " | tr -s " "
}

However the shell function as defined above works fine as long as not
exported:

$ ( . bin/itk/column/itkColumnTypeGenerateCommandExampleGet.bish ; export -f
itkColumnTypeGenerateCommandExampleGet ;
itkColumnTypeGenerateCommandExampleGet )
cat - | utkSort
itkSchemaToColumnType
atkCacheToColumnType \"$npName\" | atkActiveTableLineSelect | utkSort
atkCacheToColumnType \"$npName\" | atkTransactionTableLineSelect | utkSort
itkDirToColumnType \"$dirName\" | atkActiveTableLineSelect | utkSort
itkDirToColumnType \"$dirName\" | atkActiveTableLineSelect | utkSort
$

Fix:
   None that I know of.
___
Bug-bash mailing list
Bug-bash@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-bash