bug-bash
[Top][All Lists]
Advanced

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

Re: . (source) builtin behavior changed when commands are in {} braces


From: Chet Ramey
Subject: Re: . (source) builtin behavior changed when commands are in {} braces
Date: Sun, 17 Aug 2008 20:25:50 -0400
User-agent: Thunderbird 2.0.0.16 (Macintosh/20080707)

Roman Rakus wrote:

It's strange. Now I build bash with only official patches. Version 3.2.39. Hello isn't printed. If I don't use patch 20, then Hello is printed. I'm using this command:
./bash -c ". ~/tmp/bash/braces/test.sh"


Did you use . builtin?

I must not have, because when I use it now, I get the results you observe.

One of the effects of patch 20 (restoring internal consistency when a
builtin does a longjmp) is to unwind the saved state.  One of the things
that does is to cause the `.' command to abort, which I think is closer
to what Posix specifies.  It's also historical sh behavior.

If you want to experiment with it, try the attached patch, which
restores some of the old behavior at a potential cost (which I have not
analyzed) in internal inconsistency.

Chet
--
``The lyf so short, the craft so long to lerne.'' - Chaucer

Chet Ramey, ITS, CWRU    chet@case.edu    http://cnswww.cns.cwru.edu/~chet/
*** ../bash-20080724/subst.c    2008-08-01 22:20:31.000000000 -0400
--- subst.c     2008-08-17 20:15:52.000000000 -0400
***************
*** 135,139 ****
  extern int last_command_exit_value, last_command_exit_signal;
  extern int subshell_environment;
! extern int subshell_level;
  extern int eof_encountered;
  extern int return_catch_flag, return_catch_value;
--- 135,139 ----
  extern int last_command_exit_value, last_command_exit_signal;
  extern int subshell_environment;
! extern int subshell_level, parse_and_execute_level;
  extern int eof_encountered;
  extern int return_catch_flag, return_catch_value;
***************
*** 8092,8096 ****
    assigning_in_environment = 0;
  
!   top_level_cleanup ();                       /* from sig.c */
    jump_to_top_level (v);
  }
--- 8092,8098 ----
    assigning_in_environment = 0;
  
!   if (parse_and_execute_level == 0)
!     top_level_cleanup ();                     /* from sig.c */
! 
    jump_to_top_level (v);
  }

reply via email to

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