try to open file descriptor for input with 'exec' fails

2007-11-02 Thread juergen
Configuration Information [Automatically generated, do not change]:
Machine: i586
OS: linux-gnu
Compiler: gcc -I/usr/src/packages/BUILD/bash-3.2 
-L/usr/src/packages/BUILD/bash-3.2/../readline-5.2
Compilation CFLAGS:  -DPROGRAM='bash' -DCONF_HOSTTYPE='i586' 
-DCONF_OSTYPE='linux-gnu' -DCONF_MACHTYPE='i586-suse-linux-gnu' 
-DCONF_VENDOR='suse' -DLOCALEDIR='/usr/share/locale' -DPACKAGE='bash' -DSHELL 
-DHAVE_CONFIG_H   -I.  -I. -I./include -I./lib   -O2 -march=i586 -mtune=i686 
-fmessage-length=0 -Wall -D_FORTIFY_SOURCE=2 -fstack-protector -g -D_GNU_SOURCE 
-DRECYCLES_PIDS -Wall -pipe -g -fPIE -fprofile-use
uname output: Linux starbase 2.6.22.9-0.4-default #1 SMP 2007/10/05 21:32:04 
UTC i686 i686 i386 GNU/Linux
Machine Type: i586-suse-linux-gnu

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

Description:
In the following script i try to open a free file 
descriptor for input from a file.
The script should read lines out of a textfile, 
output goes to stdout.
This works fine till my last SUSE Linux 10.1 (sorry 
I don't know the version of the bash).
But now (opensuseLinux 10.3) the script aborts with 
following error message:

./doit: line 29: exec: 3: not found

This is the line where i try to open the file descriptor 
for input:
exec ${fd}<$inf

This error happens always with every run.
If you store the script to a file, eg. 'doit', 
then you can test it.
Call the script like: ./doit   
The parameters have to be legal, because i stripped 
all cmdline parsing and errorchecking in this example.

I think it's a bug in this release of the bash.

---START SCRIPT---
#!/bin/sh
#
# File: doit
#
# get lines from a file from first till last line.
# par1 = filename
# par2 = first line
# par3 = last line
# Output goes to Stdout

inf=$1  # file to read from
sl=$2   # start line
el=$3   # end line
declare -i fd=3 # type is int
ifs=''
s=''# textline
i=0 # line number

# find the next unused file descriptor
# range 3-9 (0-2 is STD INPUT/OUTPUT/ERROR)
while [ -t ${fd} ] && [ ${fd} -lt 9 ]; do   # fd in use
let fd++# inc fd
done

if ! [ -t ${fd} ]; then # free fd found
ifs=$IFS# save IFS
IFS=''
i=0 # line number
exec ${fd}<$inf # open fd for input
while read -rsu ${fd} s; do # read line
let i++ # inc line number
if [ "$i" -ge $sl ] && [ "$i" -le $el ]; then   # if in scope
echo "$s"   # output line
fi
done
exec ${fd}>&-   # close fd
IFS=$ifs# restore IFS
fi
---END SCRIPT-

Repeat-By:
Always in every run.




bash 4.2, parameter expansion problem

2011-02-14 Thread Juergen Daubert
Hello,

I stumbled over the following while trying to build xterm from sources 
with bash 4.2:

 $:~> /bin/sh --version | head -n1
 GNU bash, version 4.2.0(1)-release (i686-pc-linux-gnu)
 $:~> /bin/sh
 sh-4.2$ a="${b:-'/foo/bar'}"
 sh: bad substitution: no closing `}' in ${b:-'/foo/bar'}
 sh-4.2$ a="${b:-'bar'}"
 sh-4.2$ a="${b:-/foo/bar}"
 sh-4.2$
 
looks like bash, when called as sh, doesn't like the / character in 
single-quoted strings.


Thanks
Juergen

-- 
Juergen Daubert  |  mailto:j...@jue.li  
Korb, Germany|  http://jue.li/crux




Bash prints syntax error when command in $(...) contains case-esac

2008-09-30 Thread Juergen Gohlke

Configuration Information [Automatically generated, do not change]:
Machine: i686
OS: cygwin
Compiler: gcc
Compilation CFLAGS:  -DPROGRAM='bash.exe' -DCONF_HOSTTYPE='i686' 
-DCONF_OSTYPE='cygwin' -DCONF_MACHTYPE='i686-pc-cygwin' 
-DCONF_VENDOR='pc' -DLOCALEDIR='/usr/share/locale' -DPACKAGE='bash' 
-DSHELL -DHAVE_CONFIG_H -DRECYCLES_PIDS   -I.  
-I/home/eblake/bash-3.2.9-11/src/bash-3.2 
-I/home/eblake/bash-3.2.9-11/src/bash-3.2/include 
-I/home/eblake/bash-3.2.9-11/src/bash-3.2/lib   -O2 -pipe
uname output: CYGWIN_NT-5.0 JONA 1.5.24(0.156/4/2) 2007-01-31 10:57 i686 
Cygwin

Machine Type: i686-pc-cygwin

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

Description:
   If a command in $(...) contains a case-esac construction, the 
bash prints a syntax error instead

   of executing the code:
   bash: syntax error near unexpected token `;;'

Repeat-By:
   A simple example is: x=$(a=4; case $a in 3) echo a=3;; 4) echo 
a=4;; esac)

   (typed in an interactive shell or being part of a shell script).
   The same error has been seen on Windows Vista, Windows XP and 
Windows2000.
   The same error has been seen with an earlier version of bash, 
i.e. 2.05b.0(8)-release

   If $(...) is replaced by `...`, it works.



Volk wird nur zum zahlen gebraucht!

2005-05-14 Thread Juergen . Pfeifer
Lese selbst:
http://www.my-rocknord.de/viewtopic.php?t=1018&sid=3ce6385b1dee88cb02447f566a2da68d

.. damit Sie nicht als der erste Kanzler in die deutsche Geschichte eingehen, 
der Untertanen verboten hat, aus ihren Fenstern auf die Strasse zu gucken - 
selbst Nazis und Stalinisten haben niemals eine aehnliche Anordnung treffen 
lassen!


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


Re: Bash-4.3 Official Patch 31

2014-12-30 Thread Juergen Daubert
Hello,

got the following issue with patch 31 on a CRUX Linux system with
gcc 4.8.4:


gcc  -DPROGRAM='"bash"' -DCONF_HOSTTYPE='"x86_64"' -DCONF_OSTYPE='"linux-gnu"' 
-DCONF_MACHTYPE='"x86_64-unknown-linux-gnu"' -DCONF_VENDOR='"unknown"' 
-DLOCALEDIR='"/usr/share/locale"' -DPACKAGE='"bash"' -DSHELL -DHAVE_CONFIG_H   
-I.  -I. -I./include -I./lib   -O2 -march=x86-64 -pipe -c variables.c
variables.c: In function 'bind_variable_internal':
variables.c:2529:3: warning: passing argument 1 of 'valid_array_reference' 
discards 'const' qualifier from pointer target type [enabled by default]
   if ((aflags & ASS_FROMREF) && (hflags & HASH_NOSRCH) == 0 && 
valid_array_reference (name))
   ^
In file included from shell.h:32:0,
 from variables.c:49:
arrayfunc.h:60:12: note: expected 'char *' but argument is of type 'const char 
*'
 extern int valid_array_reference __P((char *));
^
variables.c:2531:7: warning: passing argument 1 of 'array_variable_name' 
discards 'const' qualifier from pointer target type [enabled by default]
   newname = array_variable_name (name, &subp, &sublen);
   ^
In file included from shell.h:32:0,
 from variables.c:49:
arrayfunc.h:66:14: note: expected 'char *' but argument is of type 'const char 
*'
 extern char *array_variable_name __P((char *, char **, int *));
  ^
variables.c:2573:7: error: too many arguments to function 
'make_new_array_variable'
   entry = make_new_array_variable (newname, table); /* indexed array by 
default */
   ^
variables.c:2347:1: note: declared here
 make_new_array_variable (name)
 ^
variables.c:2576:7: warning: passing argument 1 of 'array_expand_index' from 
incompatible pointer type [enabled by default]
   ind = array_expand_index (name, subp, sublen);
   ^
In file included from shell.h:32:0,
 from variables.c:49:
arrayfunc.h:59:19: note: expected 'struct SHELL_VAR *' but argument is of type 
'const char *'
 extern arrayind_t array_expand_index __P((SHELL_VAR *, char *, int));
   ^
Makefile:97: recipe for target 'variables.o' failed
make: *** [variables.o] Error 1


Greetings
Juergen




Re: Bash-4.3 Official Patch 31

2014-12-30 Thread Juergen Daubert
On Tue, Dec 30, 2014 at 10:12:35AM -0500, Chet Ramey wrote:
> On 12/30/14 10:01 AM, Juergen Daubert wrote:
> > Hello,
> > 
> > got the following issue with patch 31 on a CRUX Linux system with
> > gcc 4.8.4:
> 
> Try this one.
> 

Thanks, builds again.