[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bash -c mishandles $LINENO when in complex command

From: Paul Eggert
Subject: bash -c mishandles $LINENO when in complex command
Date: Thu, 1 Nov 2001 02:05:27 -0800 (PST)

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' 
-I/home/swt/doko/export/packages/bash/bash-2.03/lib -I/usr/include -g -O2
uname output: Linux dum.twinsun.com 2.2.18ss.e820-bda652a #4 SMP Tue Jun 5 
11:24:08 PDT 2001 i686 unknown
Machine Type: i386-pc-linux-gnu

Bash Version: 2.03
Patch Level: 0
Release Status: release

        Bash's -c option mishandles $LINENO when it is part of a
        complex command.  This bug caused Bash to fail some recently
        proposed Autoconf tests for $LINENO.  The bug still exists in
        the latest Bash beta.

        In the following example, the output should always be "1"; but
        in the last two instances it is "2".  The Korn shell gets it right.

        $ (echo '(echo $LINENO'; echo ')') | bash 
        $ (echo '{ echo $LINENO'; echo '}') | bash 
        $ bash -c '(echo $LINENO
        > )'
        $ bash -c '{ echo $LINENO
        > }'

The following patch assumes the latest Bash beta, plus all the patches
I've already submitted.

2001-11-01  Paul Eggert  <address@hidden>

        * shell.c (main): Initialize 'executing' to 1 when executing
        a -c option when ONESHOT is defined.  This fixes a bug with
        $LINENO in some -c options that contain newlines.

RCS file: shell.c,v
retrieving revision
retrieving revision
diff -pu -r2. -r2.
--- shell.c     2001/10/14 05:26:36
+++ shell.c     2001/11/01 10:01:28
@@ -599,6 +599,7 @@ main (argc, argv, env)
       arg_index = bind_args (argv, arg_index, argc, 0);
       startup_state = 2;
 #if defined (ONESHOT)
+      executing = 1;
       run_one_command (local_pending_command);
       exit_shell (last_command_exit_value);
 #else /* ONESHOT */

reply via email to

[Prev in Thread] Current Thread [Next in Thread]