Possible bug in bash error reporting

2005-07-31 Thread Jan Schampera


Configuration Information [Automatically generated, do not change]:
 Machine: i586
 OS: linux-gnu
 Compiler: gcc
 Compilation CFLAGS:  -DPROGRAM='bash' -DCONF_HOSTTYPE='i586'
-DCONF_OSTYPE='linux-gnu' -DCONF_MACHTYPE='i586-mandrake-linux-gnu'
-DCONF_VENDOR='mandrake' -DLOCALEDIR='/usr/share/locale'
-DPACKAGE='bash' -DSHELL -DHAVE_CONFIG_H  -I.  -I.. -I../include
-I../lib  -D_GNU_SOURCE  -O2 -fomit-frame-pointer -pipe -march=i586
-mtune=pentiumpro  uname output: Linux mainserver 2.6.11.11 #1 Sat Jun 4
00:31:34 CEST 2005 i686 AMD Sempron(TM) 2800+ unknown GNU/Linux Machine
Type: i586-mandrake-linux-gnu

 Bash Version: 3.0
 Patch Level: 13
 Release Status: release

 Description:
Say, you have a file, A.sh, and source another file, B.sh, all
errors in B.sh are reported with the line number of B.sh. BUT: it seems
that only internal (parser? interpreter?) errors are reported mentioning
B.sh. Errors generated by builtins and errors during the execution of a
program just come up with only the linenumber. Also present in 2.x
versions.

 Repeat-By:
 A.sh
 
 #!/bin/sh
 echo "we're on line $LINENO"
 echo "about to source B.sh"
 source B.sh
 echo "finished sourcing B.sh"

 B.sh
 
 echo "first line of B.sh. next line has an error.. were in $LINENO"
 /ubin/[
 # try that with '()' or whatever keyword, too
 echo "third line of B.sh"

 [EMAIL PROTECTED] tests]$./A.sh
 we're on line 3
 about to source B.sh
 first line of B.sh. next line has an error.. were in 1
 ./A.sh: line 2: /ubin/[: No such file or directory
 third line of B.sh
 finished sourcing B.sh

-- 
I know life sometimes can get tough! and I know life sometimes can be a
drag! But people, we have been given a gift, we have been given a road
And that roads name is... rock and roll!
KISS in "God gave Rock'n'Roll to you"


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


Bug in [ error reporting

2005-07-31 Thread nick
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 client1 2.6.8-2-386 #1 Thu May 19 17:40:50 JST 2005 i686
GNU/Linux
Machine Type: i386-pc-linux-gnu

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

Description:
The [ command error reporting can incorrectly state which file an error
occured in.

Repeat-By:
Create A.sh:
#!/bin/sh
echo "about to source B.sh"
source B.sh
echo "finished sourcing B.sh"

Create B.sh:
#!/bin/sh
echo "first line of B.sh. next line has an error.."
[ 0 [
echo "after error-line"

Run A.sh:
[EMAIL PROTECTED]:~> ./A.sh
line 3 of A.sh. about to source B.sh
line 2 of B.sh. next line has an error..
./A.sh: line 3: [: missing `]'
after error-line
finished sourcing B.sh
[EMAIL PROTECTED]:~>

See that the error message says that the error occured on line 3 of A.sh,
when in fact the error occured on line 3 of B.sh

-Nick Hoffman
[EMAIL PROTECTED]


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


Re: Possible bug in bash error reporting

2005-07-31 Thread Chet Ramey
Jan Schampera wrote:
> 
> Configuration Information [Automatically generated, do not change]:
>  Machine: i586
>  OS: linux-gnu
>  Compiler: gcc
>  Compilation CFLAGS:  -DPROGRAM='bash' -DCONF_HOSTTYPE='i586'
> -DCONF_OSTYPE='linux-gnu' -DCONF_MACHTYPE='i586-mandrake-linux-gnu'
> -DCONF_VENDOR='mandrake' -DLOCALEDIR='/usr/share/locale'
> -DPACKAGE='bash' -DSHELL -DHAVE_CONFIG_H  -I.  -I.. -I../include
> -I../lib  -D_GNU_SOURCE  -O2 -fomit-frame-pointer -pipe -march=i586
> -mtune=pentiumpro  uname output: Linux mainserver 2.6.11.11 #1 Sat Jun 4
> 00:31:34 CEST 2005 i686 AMD Sempron(TM) 2800+ unknown GNU/Linux Machine
> Type: i586-mandrake-linux-gnu
> 
>  Bash Version: 3.0
>  Patch Level: 13
>  Release Status: release
> 
>  Description:
>   Say, you have a file, A.sh, and source another file, B.sh, all
> errors in B.sh are reported with the line number of B.sh. BUT: it seems
> that only internal (parser? interpreter?) errors are reported mentioning
> B.sh. Errors generated by builtins and errors during the execution of a
> program just come up with only the linenumber. Also present in 2.x
> versions.

I can reproduce this in bash-2.05b, but not in bash-3.x.  I suspect
you're running some version of bash-2.05 as /bin/sh and seeing the
error as a result.

Chet

-- 
``The lyf so short, the craft so long to lerne.'' - Chaucer
( ``Discere est Dolere'' -- chet )
Live...Laugh...Love
Chet Ramey, ITS, CWRU[EMAIL PROTECTED]http://cnswww.cns.cwru.edu/~chet/


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