[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
A new test to verify that LINENO is updated correctly
From: |
worley |
Subject: |
A new test to verify that LINENO is updated correctly |
Date: |
Mon, 23 Aug 2004 12:23:28 -0400 |
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 dragon.ariadne.com 2.4.25s #1 Thu Mar 4 18:02:19 EST 2004
i686 athlon i386 GNU/Linux
Machine Type: i686-pc-linux-gnu
Bash Version: 3.0
Patch Level: 0
Release Status: release
Description:
I am submitting a new test for bash. It checks that the LINENO
variable is updated correctly when here-documents are processed.
This test is useful because bash 2.0 contained a bug. It would
not increment LINENO when an "unquoted" here-document contained
a backslash-newline continuation. This behavior was fixed in 3.0,
but there is no test in the test suite to verify that the behavior
remains correct. As this bug has caused us some problems (when using
Gnu's autoconf!), I wrote a test.
Repeat-By:
You can cause bash 2.0 to show the problem by running:
#! /bin/bash
cat <<EOF
Line 1 \
Line 2
EOF
echo Should be 8: $LINENO
This script will output "Should be 8: 7" in bash 2.0.
Fix:
The following is a diff listing to install the files
tests/lineno.right, tests/lineno.tests, and tests/run-lineno.
diff -r --new-file --exclude-from=excluded-files
bash-3.0.orig/tests/lineno.right bash-3.0/tests/lineno.right
0a1,4
> 8
> 14
> 20
> 26
diff -r --new-file --exclude-from=excluded-files
bash-3.0.orig/tests/lineno.tests bash-3.0/tests/lineno.tests
0a1,26
> # Test that the LINENO variable is incremented correctly while here-documents
> # are being processed.
>
> cat <<EOF >/dev/null
> #define max(a, b) \
> ( (a) < (b) ? (b) : (a) )
> EOF
> echo $LINENO
>
> cat <<'EOF' >/dev/null
> #define max(a, b) \
> ( (a) < (b) ? (b) : (a) )
> EOF
> echo $LINENO
>
> cat <<-EOF >/dev/null
> #define max(a, b) \
> ( (a) < (b) ? (b) : (a) )
> EOF
> echo $LINENO
>
> cat <<-'EOF' >/dev/null
> #define max(a, b) \
> ( (a) < (b) ? (b) : (a) )
> EOF
> echo $LINENO
diff -r --new-file --exclude-from=excluded-files bash-3.0.orig/tests/run-lineno
bash-3.0/tests/run-lineno
0a1,5
> # Test that the LINENO variable is incremented correctly while here-documents
> # are being processed.
>
> ${THIS_SH} ./lineno.tests > /tmp/xx
> diff /tmp/xx lineno.right && rm -f /tmp/xx
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- A new test to verify that LINENO is updated correctly,
worley <=